Skip to content

Commit 59d2fea

Browse files
committed
Improve strange-interpolation test
There were a number of mistakes in this test: • The whole thing was indented one space. • Some fix-it tests were malformed and therefore not being tested. • The output checking could in theory allow content before or after the intended content.
1 parent d0ae1d9 commit 59d2fea

File tree

1 file changed

+50
-44
lines changed

1 file changed

+50
-44
lines changed

test/Parse/strange_interpolation.swift

Lines changed: 50 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,53 @@
66

77
// REQUIRES: executable_test
88

9-
let x = 1
10-
11-
print("[\(x)]")
12-
// CHECK: [1]
13-
14-
print("[\(foo: x)]")
15-
// CHECK: [1]
16-
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
17-
// expected-note@-3{{remove 'foo' label to keep current behavior}} {{12-17=}}
18-
19-
print("[\(x, x)]")
20-
// CHECK: [(1, 1)]
21-
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
22-
// expected-note@-3{{insert parentheses to keep current behavior}} {{12-12=(}} {{16-16=)}}
23-
24-
print("[\(foo: x, x)]")
25-
// CHECK: [(foo: 1, 1)]
26-
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
27-
// expected-note@-3{{insert parentheses to keep current behavior}} {{12-12=(}} {{21-21=)}}
28-
29-
print("[\(x, foo: x)]")
30-
// CHECK: [(1, foo: 1)]
31-
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
32-
// expected-note@-3{{insert parentheses to keep current behavior}} {11-11(}} {{20-20=)}}
33-
34-
print("[\(foo: x, foo: x)]")
35-
// CHECK: [(foo: 1, foo: 1)]
36-
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
37-
// expected-note@-3{{insert parentheses to keep current behavior}} {11-11(}} {{25-25=)}}
38-
39-
print("[\(describing: x)]")
40-
// CHECK: [1]
41-
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
42-
// expected-note@-3{{remove 'describing' label to keep current behavior}} {{12-24=}}
43-
44-
print("[\(x, radix: x)]")
45-
// CHECK: [(1, radix: 1)]
46-
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
47-
// expected-note@-3{{insert parentheses to keep current behavior}} {11-11(}} {{25-25=)}}
48-
49-
print("[\(stringInterpolationSegment: x)]")
50-
// CHECK: [1]
51-
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
52-
// expected-note@-3{{remove 'stringInterpolationSegment' label to keep current behavior}} {{12-40=}}
9+
print("Begin")
10+
// CHECK: Begin
11+
12+
let x = 1
13+
14+
print("[\(x)]")
15+
// CHECK-NEXT: [1]
16+
17+
print("[\(foo: x)]")
18+
// CHECK-NEXT: [1]
19+
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
20+
// expected-note@-3{{remove 'foo' label to keep current behavior}} {{11-16=}}
21+
22+
print("[\(x, x)]")
23+
// CHECK-NEXT: [(1, 1)]
24+
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
25+
// expected-note@-3{{insert parentheses to keep current behavior}} {{11-11=(}} {{15-15=)}}
26+
27+
print("[\(foo: x, x)]")
28+
// CHECK-NEXT: [(foo: 1, 1)]
29+
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
30+
// expected-note@-3{{insert parentheses to keep current behavior}} {{11-11=(}} {{20-20=)}}
31+
32+
print("[\(x, foo: x)]")
33+
// CHECK-NEXT: [(1, foo: 1)]
34+
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
35+
// expected-note@-3{{insert parentheses to keep current behavior}} {{11-11=(}} {{20-20=)}}
36+
37+
print("[\(foo: x, foo: x)]")
38+
// CHECK-NEXT: [(foo: 1, foo: 1)]
39+
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
40+
// expected-note@-3{{insert parentheses to keep current behavior}} {{11-11=(}} {{25-25=)}}
41+
42+
print("[\(describing: x)]")
43+
// CHECK-NEXT: [1]
44+
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
45+
// expected-note@-3{{remove 'describing' label to keep current behavior}} {{11-23=}}
46+
47+
print("[\(x, radix: x)]")
48+
// CHECK-NEXT: [(1, radix: 1)]
49+
// expected-warning@-2{{interpolating multiple values will not form a tuple in Swift 5}}
50+
// expected-note@-3{{insert parentheses to keep current behavior}} {{11-11=(}} {{22-22=)}}
51+
52+
print("[\(stringInterpolationSegment: x)]")
53+
// CHECK-NEXT: [1]
54+
// expected-warning@-2{{labeled interpolations will not be ignored in Swift 5}}
55+
// expected-note@-3{{remove 'stringInterpolationSegment' label to keep current behavior}} {{11-39=}}
56+
57+
print("End")
58+
// CHECK-NEXT: End

0 commit comments

Comments
 (0)