blob: 5e0b9d68461f467d25442f79cc85f49fe5adafc2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
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")
)
)
}
}
}
|