Merge branch 'master' into patch-1

This commit is contained in:
John Sundell 2018-09-05 23:32:15 +02:00 committed by GitHub
commit 2a049c2031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 3 deletions

View File

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

View File

@ -494,6 +494,32 @@ final class DeclarationTests: SyntaxHighlighterTestCase {
])
}
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() {
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests))
}
@ -522,7 +548,8 @@ extension DeclarationTests {
("testPropertyDeclarationWithWillSet", testPropertyDeclarationWithWillSet),
("testPropertyDeclarationWithDidSet", testPropertyDeclarationWithDidSet),
("testSubscriptDeclaration", testSubscriptDeclaration),
("testDeferDeclaration", testDeferDeclaration)
("testDeferDeclaration", testDeferDeclaration),
("testFunctionDeclarationWithInOutParameter", testFunctionDeclarationWithInOutParameter)
]
}
}