-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: operators now check that the next symbol is other than letter
- Loading branch information
Showing
5 changed files
with
37 additions
and
183 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
181 changes: 0 additions & 181 deletions
181
units/src/commonTest/kotlin/me/y9san9/calkt/units/parse/CornerCaseTest.kt
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
units/src/commonTest/kotlin/me/y9san9/calkt/units/parse/UnitsParseUnitKeyFunction.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,33 @@ | ||
package me.y9san9.calkt.units.parse | ||
|
||
import me.y9san9.calkt.Expression | ||
import me.y9san9.calkt.annotation.ExpressionSubclass | ||
import me.y9san9.calkt.calculate.CalculateResult | ||
import me.y9san9.calkt.parse.ParseContext | ||
import me.y9san9.calkt.parse.ParseResult | ||
import me.y9san9.calkt.parse.tryParse | ||
import me.y9san9.calkt.units.UnitKey | ||
import me.y9san9.calkt.units.annotation.UnitKeySubclass | ||
import kotlin.test.Test | ||
import kotlin.test.assertEquals | ||
import kotlin.test.assertIs | ||
|
||
class UnitsParseUnitKeyFunctionTest { | ||
@Test | ||
fun testDefaultImplementationChecksForNextChar() { | ||
val function = create() | ||
|
||
val result = tryParse("prefixtest") { context -> | ||
function(context) as Expression | ||
} | ||
assertIs<ParseResult.Success<TestKey>>(result) | ||
assertEquals(TestKey, result.value) | ||
} | ||
|
||
private fun create(): UnitsParseUnitKeyFunction { | ||
return UnitsParseUnitKeyFunction.ofStrings(TestKey, "prefix", "prefixtest") | ||
} | ||
|
||
@OptIn(UnitKeySubclass::class, ExpressionSubclass::class) | ||
private data object TestKey : UnitKey, Expression | ||
} |