Add a test for indented function calls (#79)

This change adds a test that verifies that indented function calls
are correctly highlighted. This was fixed as part of the previous
change to make static methods highlight correctly, but this test
will ensure we don’t see any regressions for this particular use case.
This commit is contained in:
John Sundell 2019-08-07 15:45:29 +02:00 committed by GitHub
parent dcf5951d10
commit 016aaa13f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -130,6 +130,26 @@ final class FunctionCallTests: SyntaxHighlighterTestCase {
])
}
func testIndentedFunctionCalls() {
let components = highlighter.highlight("""
variable
.callOne()
.callTwo()
""")
XCTAssertEqual(components, [
.plainText("variable"),
.whitespace("\n "),
.plainText("."),
.token("callOne", .call),
.plainText("()"),
.whitespace("\n "),
.plainText("."),
.token("callTwo", .call),
.plainText("()")
])
}
func testXCTAssertCalls() {
let components = highlighter.highlight("XCTAssertTrue(variable)")
@ -156,6 +176,7 @@ extension FunctionCallTests {
("testCallingStaticMethodOnGenericType", testCallingStaticMethodOnGenericType),
("testPassingTypeToFunction", testPassingTypeToFunction),
("testPassingBoolToUnnamedArgument", testPassingBoolToUnnamedArgument),
("testIndentedFunctionCalls", testIndentedFunctionCalls),
("testXCTAssertCalls", testXCTAssertCalls)
]
}