Skip to content

Commit eb4ee76

Browse files
committed
Update testcases & Remove TODOs
1 parent b37f0c5 commit eb4ee76

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

Tests/SwiftParserTest/translated/InitDeinitTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,11 @@ final class InitDeinitTests: XCTestCase {
8383
AssertParse(
8484
"""
8585
struct FooStructConstructorD {
86-
init() -> FooStructConstructorD { }
86+
init() 1️⃣-> FooStructConstructorD { }
8787
}
8888
""",
8989
diagnostics: [
90-
// TODO: Old parser expected error on line 2: initializers cannot have a result type
90+
DiagnosticSpec(message: "initializers cannot have a result type")
9191
]
9292
)
9393
}

Tests/SwiftParserTest/translated/RecoveryTests.swift

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ final class RecoveryTests: XCTestCase {
17281728
DiagnosticSpec(locationMarker: "1️⃣", message: "expected '>' to end generic parameter clause"),
17291729
DiagnosticSpec(locationMarker: "2️⃣", message: "expected type and ')' to end parameter clause"),
17301730
DiagnosticSpec(locationMarker: "3️⃣", message: "unexpected code ')}' before struct"),
1731-
DiagnosticSpec(locationMarker: "4️⃣", message: "unexpected code 'x' before parameter clause"),
1731+
DiagnosticSpec(locationMarker: "4️⃣", message: "initializers cannot have a name", fixIts: ["remove 'x'"]),
17321732
]
17331733
)
17341734
}
@@ -1739,9 +1739,11 @@ final class RecoveryTests: XCTestCase {
17391739
init 1️⃣a(b: Int) {}
17401740
""",
17411741
diagnostics: [
1742-
// TODO: (good first issue) Old parser expected error on line 3: initializers cannot have a name, Fix-It replacements: 8 - 9 = ''
1743-
DiagnosticSpec(message: "unexpected code 'a' before parameter clause")
1744-
]
1742+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'a'"])
1743+
],
1744+
fixedSource: """
1745+
init (b: Int) {}
1746+
"""
17451747
)
17461748
}
17471749

@@ -1751,9 +1753,11 @@ final class RecoveryTests: XCTestCase {
17511753
init? 1️⃣c(_ d: Int) {}
17521754
""",
17531755
diagnostics: [
1754-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 9 - 10 = ''
1755-
DiagnosticSpec(message: "unexpected code 'c' before parameter clause")
1756-
]
1756+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'c'"])
1757+
],
1758+
fixedSource: """
1759+
init? (_ d: Int) {}
1760+
"""
17571761
)
17581762
}
17591763

@@ -1763,9 +1767,11 @@ final class RecoveryTests: XCTestCase {
17631767
init 1️⃣e<T>(f: T) {}
17641768
""",
17651769
diagnostics: [
1766-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 8 - 9 = ''
1767-
DiagnosticSpec(message: "unexpected code 'e<T>' before parameter clause")
1768-
]
1770+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'e<T>'"])
1771+
],
1772+
fixedSource: """
1773+
init (f: T) {}
1774+
"""
17691775
)
17701776
}
17711777

@@ -1775,9 +1781,11 @@ final class RecoveryTests: XCTestCase {
17751781
init? 1️⃣g<T>(_: T) {}
17761782
""",
17771783
diagnostics: [
1778-
// TODO: (good first issue) Old parser expected error on line 1: initializers cannot have a name, Fix-It replacements: 9 - 10 = ''
1779-
DiagnosticSpec(message: "unexpected code 'g<T>' before parameter clause")
1780-
]
1784+
DiagnosticSpec(message: "initializers cannot have a name", fixIts: ["remove 'g<T>'"])
1785+
],
1786+
fixedSource: """
1787+
init? (_: T) {}
1788+
"""
17811789
)
17821790
}
17831791

0 commit comments

Comments
 (0)