-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement Dict in Wirespec Language (#212)
Co-authored-by: Jerre van Veluw <[email protected]>
- Loading branch information
1 parent
f1b34b5
commit 99d915f
Showing
18 changed files
with
374 additions
and
313 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
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
23 changes: 23 additions & 0 deletions
23
...r/core/src/commonTest/kotlin/community/flock/wirespec/compiler/core/tokenize/TestUtils.kt
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,23 @@ | ||
package community.flock.wirespec.compiler.core.tokenize | ||
|
||
import community.flock.wirespec.compiler.core.WirespecSpec | ||
import community.flock.wirespec.compiler.core.tokenize.types.Invalid | ||
import community.flock.wirespec.compiler.core.tokenize.types.TokenType | ||
import io.kotest.matchers.collections.shouldNotBeEmpty | ||
import io.kotest.matchers.collections.shouldNotContain | ||
import io.kotest.matchers.shouldBe | ||
|
||
fun testTokenizer( | ||
source: String, | ||
vararg expected: TokenType, | ||
removeWhiteSpace: Boolean = true, | ||
noInvalid: Boolean = true, | ||
) { | ||
WirespecSpec.tokenize(source) | ||
.run { if (removeWhiteSpace) removeWhiteSpace() else this } | ||
.shouldNotBeEmpty() | ||
.apply { size shouldBe expected.size } | ||
.map { it.type } | ||
.apply { if (noInvalid) shouldNotContain(Invalid) } | ||
.onEachIndexed { index, tokenType -> tokenType shouldBe expected[index] } | ||
} |
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
Oops, something went wrong.