r7rs-tests/snow/arvyy/mustache-test/partials.scm

47 lines
1.4 KiB
Scheme
Raw Normal View History

2024-10-05 04:55:06 -04:00
(define (run-tests/partials)
(test-mustache "Basic Behavior"
'()
'(("text" . "from partial"))
"\"{{>text}}\""
"\"from partial\"")
(test-mustache "Failed Lookup"
'()
'()
"\"{{>text}}\""
"\"\"")
(test-mustache "Context"
'((text . "content"))
'(("partial" . "*{{text}}*"))
"\"{{>partial}}\""
"\"*content*\"")
(test-mustache "Recursion"
'((content . "X")
(nodes . #(((content . "Y")
(nodes . #())))))
'(("node" . "{{content}}<{{#nodes}}{{>node}}{{/nodes}}>"))
"{{>node}}"
"X<Y<>>")
(test-mustache "Surrounding Whitespace"
'()
'(("partial" . "\t|\t"))
"| {{>partial}} |"
"| \t|\t |")
(test-mustache "Inline Indentation"
'((data . "|"))
'(("partial" . ">\n>"))
" {{data}} {{> partial}}\n"
" | >\n>\n")
(test-mustache "Standalone Line Endings"
'()
'(("partial" . ">"))
"|\r\n{{>partial}}\r\n|"
"|\r\n>|"))