Merge pull request #42 from JohnSundell/deinit
Support the deinit keyword
This commit is contained in:
commit
88650438c8
@ -47,7 +47,8 @@ private extension SwiftGrammar {
|
|||||||
"override", "where", "_", "default", "break",
|
"override", "where", "_", "default", "break",
|
||||||
"#selector", "required", "willSet", "didSet",
|
"#selector", "required", "willSet", "didSet",
|
||||||
"lazy", "subscript", "defer", "inout", "while",
|
"lazy", "subscript", "defer", "inout", "while",
|
||||||
"continue", "fallthrough", "repeat", "indirect"
|
"continue", "fallthrough", "repeat", "indirect",
|
||||||
|
"deinit"
|
||||||
] as Set<String>).union(accessControlKeywords)
|
] as Set<String>).union(accessControlKeywords)
|
||||||
|
|
||||||
static let accessControlKeywords: Set<String> = [
|
static let accessControlKeywords: Set<String> = [
|
||||||
|
@ -221,6 +221,24 @@ final class DeclarationTests: SyntaxHighlighterTestCase {
|
|||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testClassDeclarationWithDeinit() {
|
||||||
|
let components = highlighter.highlight("class Foo { deinit {} }")
|
||||||
|
|
||||||
|
XCTAssertEqual(components, [
|
||||||
|
.token("class", .keyword),
|
||||||
|
.whitespace(" "),
|
||||||
|
.plainText("Foo"),
|
||||||
|
.whitespace(" "),
|
||||||
|
.plainText("{"),
|
||||||
|
.whitespace(" "),
|
||||||
|
.token("deinit", .keyword),
|
||||||
|
.whitespace(" "),
|
||||||
|
.plainText("{}"),
|
||||||
|
.whitespace(" "),
|
||||||
|
.plainText("}")
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
func testClassDeclarationWithMultipleProtocolConformances() {
|
func testClassDeclarationWithMultipleProtocolConformances() {
|
||||||
let components = highlighter.highlight("class MyClass: ProtocolA, ProtocolB {}")
|
let components = highlighter.highlight("class MyClass: ProtocolA, ProtocolB {}")
|
||||||
|
|
||||||
@ -690,6 +708,7 @@ extension DeclarationTests {
|
|||||||
("testGenericStructDeclaration", testGenericStructDeclaration),
|
("testGenericStructDeclaration", testGenericStructDeclaration),
|
||||||
("testClassDeclaration", testClassDeclaration),
|
("testClassDeclaration", testClassDeclaration),
|
||||||
("testCompactClassDeclarationWithInitializer", testCompactClassDeclarationWithInitializer),
|
("testCompactClassDeclarationWithInitializer", testCompactClassDeclarationWithInitializer),
|
||||||
|
("testClassDeclarationWithDeinit", testClassDeclarationWithDeinit),
|
||||||
("testClassDeclarationWithMultipleProtocolConformances", testClassDeclarationWithMultipleProtocolConformances),
|
("testClassDeclarationWithMultipleProtocolConformances", testClassDeclarationWithMultipleProtocolConformances),
|
||||||
("testSubclassDeclaration", testSubclassDeclaration),
|
("testSubclassDeclaration", testSubclassDeclaration),
|
||||||
("testProtocolDeclaration", testProtocolDeclaration),
|
("testProtocolDeclaration", testProtocolDeclaration),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user