fix/schema: fix string literals
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user