Merge pull request #15 from nik6018/master

added "inout" as keyword
This commit is contained in:
John Sundell 2018-09-05 23:28:19 +02:00 committed by GitHub
commit 5d4ac97678
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 2 deletions

View File

@ -47,7 +47,7 @@ private extension SwiftGrammar {
"super", "self", "set", "true", "false", "nil", "super", "self", "set", "true", "false", "nil",
"override", "where", "_", "default", "break", "override", "where", "_", "default", "break",
"#selector", "required", "willSet", "didSet", "#selector", "required", "willSet", "didSet",
"lazy", "subscript", "defer" "lazy", "subscript", "defer", "inout"
] ]
struct PreprocessingRule: SyntaxRule { struct PreprocessingRule: SyntaxRule {

View File

@ -493,6 +493,32 @@ final class DeclarationTests: SyntaxHighlighterTestCase {
.plainText("}") .plainText("}")
]) ])
} }
func testFunctionDeclarationWithInOutParameter() {
let components = highlighter.highlight("func swapValues(value1: inout Int, value2: inout Int) { }")
XCTAssertEqual(components, [
.token("func", .keyword),
.whitespace(" "),
.plainText("swapValues(value1:"),
.whitespace(" "),
.token("inout", .keyword),
.whitespace(" "),
.token("Int", .type),
.plainText(","),
.whitespace(" "),
.plainText("value2:"),
.whitespace(" "),
.token("inout", .keyword),
.whitespace(" "),
.token("Int", .type),
.plainText(")"),
.whitespace(" "),
.plainText("{"),
.whitespace(" "),
.plainText("}")
])
}
func testAllTestsRunOnLinux() { func testAllTestsRunOnLinux() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests)) XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
@ -522,7 +548,8 @@ extension DeclarationTests {
("testPropertyDeclarationWithWillSet", testPropertyDeclarationWithWillSet), ("testPropertyDeclarationWithWillSet", testPropertyDeclarationWithWillSet),
("testPropertyDeclarationWithDidSet", testPropertyDeclarationWithDidSet), ("testPropertyDeclarationWithDidSet", testPropertyDeclarationWithDidSet),
("testSubscriptDeclaration", testSubscriptDeclaration), ("testSubscriptDeclaration", testSubscriptDeclaration),
("testDeferDeclaration", testDeferDeclaration) ("testDeferDeclaration", testDeferDeclaration),
("testFunctionDeclarationWithInOutParameter", testFunctionDeclarationWithInOutParameter)
] ]
} }
} }