diff options
author | Jakob Odersky <jakob@odersky.com> | 2019-10-22 00:55:50 -0400 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2019-11-08 22:34:57 -0500 |
commit | 99dfd5a3ececf39ae3fd30cbf9581c2fb5da2ba5 (patch) | |
tree | 59dd8a2f5283d436b300478b7197bb8ec9f5164e /yamlesque/test/src/VerbatimTest.scala | |
parent | 70141fc60ec3341057627e9a8f5b83a22c74f0ea (diff) | |
download | yamlesque-0.2.0.tar.gz yamlesque-0.2.0.tar.bz2 yamlesque-0.2.0.zip |
Major refactor for version 0.2.00.2.0
Diffstat (limited to 'yamlesque/test/src/VerbatimTest.scala')
-rw-r--r-- | yamlesque/test/src/VerbatimTest.scala | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/yamlesque/test/src/VerbatimTest.scala b/yamlesque/test/src/VerbatimTest.scala new file mode 100644 index 0000000..5e0b9d6 --- /dev/null +++ b/yamlesque/test/src/VerbatimTest.scala @@ -0,0 +1,114 @@ +package yamlesque + +import utest._ + +object VerbatimTest extends TestSuite { + def tests = Tests { + "empty verbatim" - { + read("|") ==> Str("") + read("|\n") ==> Str("") + } + "single verbatim" - { + read("""|| + | a + |""".stripMargin) ==> Str("a\n") + read("""|| + | a + |""".stripMargin) ==> Str("a\n") + } + "multi-line verbatim" - { + read("""|| + | foo bar + | baz + |""".stripMargin) ==> Str("foo bar\nbaz\n") + } + "multi-line indent verbatim" - { + read("""|| + | foo + | bar + | baz + |""".stripMargin) ==> Str("foo\n bar\nbaz\n") + } + "verbatim in map" - { + read("""|a: | + | foo + | bar + | baz + |b: | + | extra + | cool! + |""".stripMargin) ==> Obj( + "a" -> Str("foo\n bar\nbaz\n"), + "b" -> Str("extra\ncool!\n") + ) + } + "empty verbatim in map" - { + read("""|a: | + |b: + |c: | + |d: |""".stripMargin) ==> Obj( + "a" -> Str(""), + "b" -> Null, + "c" -> Str(""), + "d" -> Str("") + ) + } + "verbatim in list" - { + read("""|- | + | foo + |- | + | extra + | cool! + |""".stripMargin) ==> Arr(Str("foo\n"), Str("extra\ncool!\n")) + } + "empty verbatim in list" - { + read("""|- | + |- + |- | + |- | + |""".stripMargin) ==> Arr(Str(""), Null, Str(""), Str("")) + } + "new lines in verbatim" - { + read("""|a: | + | + | a + | b + | + | + | c + | + | + | + |b: + |""".stripMargin) ==> Obj( + "a" -> Str("\na\nb\n\n\nc\n"), + "b" -> Null + ) + } + "minimum starting col" - { + read("""|a: + | b: | + | c: + |""".stripMargin) ==> Obj( + "a" -> Obj( + "b" -> Str(""), + "c" -> Null + ) + ) + } + "minimum starting col prev" - { + read("""|a: + | a: + | a: | + | b: foo bar + |""".stripMargin) ==> Obj( + "a" -> Obj( + "a" -> Obj( + "a" -> Str("") + ), + "b" -> Str("foo bar") + ) + ) + } + } +} |