Quoted atoms

This commit is contained in:
Tibo De Peuter 2025-04-30 12:08:36 +02:00
parent 1e087c8339
commit 43b364044e
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
5 changed files with 65 additions and 32 deletions

View file

@ -31,6 +31,26 @@ class TermsGrammarTests {
Assertions.assertEquals(Atom(name), result, "Expected atom '$name'")
}
@ParameterizedTest
@ValueSource(
strings = [
"'tick'",
"\"doubleTick\"",
"`backTick`",
"'i have spaces'",
"`i have a 'quote' inside`",
"'I have Cases'",
"'I, h@v3 many (!!!) special characters?! {}'"
]
)
fun `Parse a quoted atom`(input: String) {
val result = parser.parseToEnd(input)
val expected = input.substring(1, input.length - 1)
Assertions.assertEquals(Atom(expected), result, "Expected atom")
}
@ParameterizedTest
@ValueSource(strings = ["X", "X1", "X_1"])
fun `parse variable`(name: String) {