added “defer” as a keyword
This commit is contained in:
parent
1559117b5a
commit
c1465b0a65
@ -47,7 +47,7 @@ private extension SwiftGrammar {
|
||||
"super", "self", "set", "true", "false", "nil",
|
||||
"override", "where", "_", "default", "break",
|
||||
"#selector", "required", "willSet", "didSet",
|
||||
"lazy", "subscript"
|
||||
"lazy", "subscript", "defer"
|
||||
]
|
||||
|
||||
struct PreprocessingRule: SyntaxRule {
|
||||
|
@ -476,6 +476,25 @@ final class DeclarationTests: SyntaxHighlighterTestCase {
|
||||
])
|
||||
}
|
||||
|
||||
func testDeferDeclaration() {
|
||||
let components = highlighter.highlight("func hello() { defer {} }")
|
||||
|
||||
XCTAssertEqual(components, [
|
||||
.token("func", .keyword),
|
||||
.whitespace(" "),
|
||||
.plainText("hello()"),
|
||||
.whitespace(" "),
|
||||
.plainText("{"),
|
||||
.whitespace(" "),
|
||||
.token("defer", .keyword),
|
||||
.whitespace(" "),
|
||||
.plainText("{}"),
|
||||
.whitespace(" "),
|
||||
.plainText("}")
|
||||
])
|
||||
|
||||
}
|
||||
|
||||
func testAllTestsRunOnLinux() {
|
||||
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
|
||||
}
|
||||
@ -503,7 +522,8 @@ extension DeclarationTests {
|
||||
("testGenericPropertyDeclaration", testGenericPropertyDeclaration),
|
||||
("testPropertyDeclarationWithWillSet", testPropertyDeclarationWithWillSet),
|
||||
("testPropertyDeclarationWithDidSet", testPropertyDeclarationWithDidSet),
|
||||
("testSubscriptDeclaration", testSubscriptDeclaration)
|
||||
("testSubscriptDeclaration", testSubscriptDeclaration),
|
||||
("testDeferDeclaration", testDeferDeclaration)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user