diff options
Diffstat (limited to 'yamlesque/test/src/StringTest.scala')
-rw-r--r-- | yamlesque/test/src/StringTest.scala | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/yamlesque/test/src/StringTest.scala b/yamlesque/test/src/StringTest.scala new file mode 100644 index 0000000..b4ae519 --- /dev/null +++ b/yamlesque/test/src/StringTest.scala @@ -0,0 +1,33 @@ +package yamlesque + +import utest._ + +object StringTest extends TestSuite { + def tests = Tests { + "quoted simple" - { + read(""""a"""") ==> Str("a") + read(""" "a" """) ==> Str("a") + } + "quoted non-strings" - { + read(""""1"""") ==> Str("1") + read(""""1.2"""") ==> Str("1.2") + read(""""true"""") ==> Str("true") + read(""""false"""") ==> Str("false") + read(""""null"""") ==> Str("null") + } + "quoted comment" - { + read(""""#hello"""") ==> Str("#hello") + read(""""a #hello"""") ==> Str("a #hello") + } + "scalar with quote" - { + read(""" a" """) ==> Str("a\"") + read(""" a"hmm" """) ==> Str("a\"hmm\"") + read(""" -"a" """) ==> Str("-\"a\"") + read(""" :"a" """) ==> Str(":\"a\"") + } + "quoted key" - { + read(""" "a # b": a """) ==> Obj("a # b" -> Str("a")) + read(""" "a # b" : a """) ==> Obj("a # b" -> Str("a")) + } + } +} |