-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change makes it possible to implement custom token types, which is really useful when building specialized grammars that use non-standard token types.
- Loading branch information
1 parent
98bfad4
commit 4c6f71c
Showing
4 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* Splash | ||
* Copyright (c) John Sundell 2018 | ||
* MIT license - see LICENSE.md | ||
*/ | ||
|
||
import Foundation | ||
import XCTest | ||
import Splash | ||
|
||
final class TokenTypeTests: SplashTestCase { | ||
func testConvertingToString() { | ||
let standardType = TokenType.comment | ||
XCTAssertEqual(standardType.string, "comment") | ||
|
||
let customType = TokenType.custom("MyCustomType") | ||
XCTAssertEqual(customType.string, "MyCustomType") | ||
} | ||
|
||
func testAllTestsRunOnLinux() { | ||
XCTAssertTrue(TestCaseVerifier.verifyLinuxTests((type(of: self)).allTests)) | ||
} | ||
} | ||
|
||
extension TokenTypeTests { | ||
static var allTests: [(String, TestClosure<TokenTypeTests>)] { | ||
return [ | ||
("testConvertingToString", testConvertingToString) | ||
] | ||
} | ||
} | ||
|