fix/schema: fix string literals

This commit is contained in:
mae
2026-01-28 19:52:13 -06:00
parent dc87bef1c2
commit 73fd1dd90d
12 changed files with 5285 additions and 3720 deletions

View File

@@ -6,16 +6,21 @@ import (
)
func TestParser(t *testing.T) {
test := "(test)\n ; test comment" +
"(test a)\n" +
"(test a b)\n" +
"(test \"a\" \"b\")\n" +
"(+ 0b1010 -0xDEAD_BEEF)\n" +
"(. a b c d e f g)\n" +
"(test (test1 \"hi\") (test2 \"hi 2\"))\n" +
"(test (. \"awa\" `awawa` \"awawawa\" \"awawawawa\"))\n" +
"(test \n `new\nline`)\n" +
"(test (. 0x0.1Fp1 '\\t' 2i '\\u6767' '\\U0001F600' '\\x23' '\\043'))\n"
testSchema(t, "(test)\n ; test comment"+
"(test a)\n"+
"(test a b)\n"+
"(test \"a\" \"b\")\n"+
"(+ 0b1010 -0xDEAD_BEEF)\n"+
"(. a b c d e f g)\n"+
"(test (test1 \"hi\") (test2 \"hi 2\"))\n"+
"(test (. \"awa\" `awawa` \"awawawa\" \"awawawawa\"))\n"+
"(test \n `new\nline`)\n"+
"(test (. 0x0.1Fp1 '\\t' 2i '\\u6767' '\\U0001F600' '\\x23' '\\043'))\n")
}
func TestInterpretString(t *testing.T) {
testSchema(t, "(test \"\\\" \\\\v \\u6767 \\U0001F600 \\x23 \\043 \" `\\\\ \\t \\u6767 \\U0001F600 \\x23 \\043`)")
}
func testSchema(t *testing.T, test string) {
schema, err := CreateSchema(test)
if err != nil {
t.Fatal(err)