aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/internal/parsing_spec.moon12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/internal/parsing_spec.moon b/spec/internal/parsing_spec.moon
index 47de338..8f9b79e 100644
--- a/spec/internal/parsing_spec.moon
+++ b/spec/internal/parsing_spec.moon
@@ -134,6 +134,18 @@ describe 'TemplateString parsing', ->
node = verify_parse tplstr, '$hi"\\$(this would\\${3}be invalid!"'
assert.is.same {'$(this would${3}be invalid!'}, node.children[2]\eval!.result!
+ test 'can contain quotes', ->
+ node = verify_parse tplstr, '$hi"$"this" is a string"'
+ assert.is.same {'', ' is a string'}, node.children[2]\eval!.result!
+ assert.is.same 'this', node.children[3]\eval!.result!
+
+ node = verify_parse tplstr, '$hi"a string is $"this""'
+ assert.is.same {'a string is ', ''}, node.children[2]\eval!.result!
+ assert.is.same 'this', node.children[3]\eval!.result!
+
+ node = verify_parse tplstr, '$hi"uh $(= "a" "b") huh"'
+ assert.is.same {'uh ', ' huh'}, node.children[2]\eval!.result!
+
test 'can be applied', ->
node = verify_parse tplstr, '$[123]hi" string with $3$5 some $(= "contents") "'
substituted = node.__class.subst node.children[2]\eval!.result!, {123, "foot", " where "}