Skip to content

Commit 130b5b2

Browse files
sonologicoRaphael Santos
authored andcommitted
Add test cases for tags containing the '/' character
1 parent 37b2054 commit 130b5b2

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

lib_test/test_mustache.ml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,29 @@ let tests = [
6464
<b>bar</b>\
6565
<b>bar</b>" ) ] ) ;
6666

67+
("Hello {{ /foo }}!"
68+
, concat [ raw "Hello " ;
69+
escaped "/foo" ;
70+
raw "!" ]
71+
, [ (`O [ "/foo", `String "World" ], "Hello World!") ] ) ;
72+
73+
("{{& deep/path/string }}"
74+
, unescaped "deep/path/string"
75+
, [ (`O [ "deep/path/string", `String "<p>Test content</p>" ],
76+
"<p>Test content</p>") ] ) ;
77+
78+
( "{{#things/with/slashes}}{{v/1/}}-{{v/2/}}{{/things/with/slashes}}"
79+
, section "things/with/slashes" (concat [ escaped "v/1/"
80+
; raw "-"
81+
; escaped "v/2/" ])
82+
, [ ( `O [ "things/with/slashes" ,
83+
`A [ `O [ ("v/1/", `String "1" ) ;
84+
("v/2/", `String "one" ) ] ;
85+
`O [ ("v/1/", `String "2" ) ;
86+
("v/2/", `String "two" ) ] ;
87+
] ],
88+
"1-one2-two" ) ] ) ;
89+
6790
]
6891

6992
let () =

0 commit comments

Comments
 (0)