Skip to content

Commit c7a1442

Browse files
committed
Added test case for missing both colon and rhs expression in ternary operator
1 parent 9184378 commit c7a1442

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Tests/SwiftParserTest/translated/InvalidIfExprTests.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,16 @@ final class InvalidIfExprTests: XCTestCase {
8080
fixedSource: "foo ? 1 : 2"
8181
)
8282
}
83+
84+
func testInvalidIfExpr6() {
85+
assertParse(
86+
"""
87+
foo ? 1 1️⃣
88+
""",
89+
diagnostics: [
90+
DiagnosticSpec(message: "expected ':' and expression after '? ...' in ternary expression", fixIts: ["insert ':' and expression"])
91+
],
92+
fixedSource: "foo ? 1 : <#expression#>"
93+
)
94+
}
8395
}

0 commit comments

Comments
 (0)