Skip to content

Commit 3886e22

Browse files
committed
Cleanup translated tests
- Run swift-format over them - Update expectations now that we diagnose unterminated regex literals - Remove semantic errors - Fix test splitting in a few cases - Add TODOs where we should error
1 parent 784e36b commit 3886e22

8 files changed

+467
-1058
lines changed

Tests/SwiftParserTest/translated/ForwardSlashRegexSkippingAllowedTests.swift

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import XCTest
44

55
final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
66
func testForwardSlashRegexSkippingAllowed1() {
7-
AssertParse(
7+
assertParse(
88
"""
99
// Make sure we can skip in all of the below cases.
1010
"""
1111
)
1212
}
1313

1414
func testForwardSlashRegexSkippingAllowed2() {
15-
AssertParse(
15+
assertParse(
1616
#"""
1717
// The printing implementation differs in asserts and no-asserts builds, it will
1818
// either print `"Parse.NumFunctionsParsed" 0` or not print it at all. Make sure
@@ -23,54 +23,53 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
2323
}
2424

2525
func testForwardSlashRegexSkippingAllowed3() {
26-
AssertParse(
26+
assertParse(
2727
"""
2828
// Ensures there is a parse error
2929
var 1️⃣: Int
3030
""",
3131
diagnostics: [
32-
// TODO: Old parser expected error on line 2: expected pattern
33-
DiagnosticSpec(message: "expected pattern in variable"),
32+
DiagnosticSpec(message: "expected pattern in variable")
3433
]
3534
)
3635
}
3736

3837
func testForwardSlashRegexSkippingAllowed4() {
39-
AssertParse(
38+
assertParse(
4039
"""
4140
// Balanced `{}`, so okay.
4241
func a() { 1️⃣/ {}/ }
4342
""",
4443
diagnostics: [
45-
DiagnosticSpec(message: "unexpected code '/ {}/' in function"),
44+
DiagnosticSpec(message: "unexpected code '/ {}/' in function")
4645
]
4746
)
4847
}
4948

5049
func testForwardSlashRegexSkippingAllowed5() {
51-
AssertParse(
50+
assertParse(
5251
#"""
5352
func b() { 1️⃣/ \{}/ }
5453
"""#,
5554
diagnostics: [
56-
DiagnosticSpec(message: #"unexpected code '/ \{}/' in function"#),
55+
DiagnosticSpec(message: #"unexpected code '/ \{}/' in function"#)
5756
]
5857
)
5958
}
6059

6160
func testForwardSlashRegexSkippingAllowed6() {
62-
AssertParse(
61+
assertParse(
6362
#"""
6463
func c() { 1️⃣/ {"{"}/ }
6564
"""#,
6665
diagnostics: [
67-
DiagnosticSpec(message: #"unexpected code '/ {"{"}/' in function"#),
66+
DiagnosticSpec(message: #"unexpected code '/ {"{"}/' in function"#)
6867
]
6968
)
7069
}
7170

7271
func testForwardSlashRegexSkippingAllowed7() {
73-
AssertParse(
72+
assertParse(
7473
"""
7574
// Some cases of infix '/' that we should continue to skip.
7675
func d() {
@@ -82,7 +81,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
8281
}
8382

8483
func testForwardSlashRegexSkippingAllowed8() {
85-
AssertParse(
84+
assertParse(
8685
#"""
8786
func e() {
8887
let arr = [1, 2, 3]
@@ -95,7 +94,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
9594
}
9695

9796
func testForwardSlashRegexSkippingAllowed9() {
98-
AssertParse(
97+
assertParse(
9998
"""
10099
// Some cases of prefix '/' that we should continue to skip.
101100
prefix operator /
@@ -105,7 +104,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
105104
}
106105

107106
func testForwardSlashRegexSkippingAllowed10() {
108-
AssertParse(
107+
assertParse(
109108
"""
110109
enum E {
111110
case e
@@ -116,7 +115,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
116115
}
117116

118117
func testForwardSlashRegexSkippingAllowed11() {
119-
AssertParse(
118+
assertParse(
120119
"""
121120
func f() {
122121
_ = /E.e
@@ -133,7 +132,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
133132
}
134133

135134
func testForwardSlashRegexSkippingAllowed12() {
136-
AssertParse(
135+
assertParse(
137136
"""
138137
postfix operator /
139138
prefix func / <T> (_ x: T) -> T { x }
@@ -142,7 +141,7 @@ final class ForwardSlashRegexSkippingAllowedTests: XCTestCase {
142141
}
143142

144143
func testForwardSlashRegexSkippingAllowed13() {
145-
AssertParse(
144+
assertParse(
146145
"""
147146
// Some cases of postfix '/' that we should continue to skip.
148147
func g() {

0 commit comments

Comments
 (0)