diff options
| author | Li Jin <dragon-fly@qq.com> | 2026-01-26 17:45:26 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2026-01-26 17:45:56 +0800 |
| commit | e02321107277a63e7dcb12ab163c9942ac101b87 (patch) | |
| tree | f38c6f2fbf4ee35df4938933dbc1e645733356f4 /spec/inputs/test/string_spec.yue | |
| parent | 5d5b657f606b5939062983b1f90c3359d542672e (diff) | |
| download | yuescript-e02321107277a63e7dcb12ab163c9942ac101b87.tar.gz yuescript-e02321107277a63e7dcb12ab163c9942ac101b87.tar.bz2 yuescript-e02321107277a63e7dcb12ab163c9942ac101b87.zip | |
Updated tests.
Diffstat (limited to 'spec/inputs/test/string_spec.yue')
| -rw-r--r-- | spec/inputs/test/string_spec.yue | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/spec/inputs/test/string_spec.yue b/spec/inputs/test/string_spec.yue index b790518..2afbb13 100644 --- a/spec/inputs/test/string_spec.yue +++ b/spec/inputs/test/string_spec.yue | |||
| @@ -48,12 +48,12 @@ describe "string", -> | |||
| 48 | it "should not interpolate in single quotes", -> | 48 | it "should not interpolate in single quotes", -> |
| 49 | name = "world" | 49 | name = "world" |
| 50 | s = 'hello #{name}' | 50 | s = 'hello #{name}' |
| 51 | assert.same s, "hello #{name}" | 51 | assert.same s, "hello \#{name}" |
| 52 | 52 | ||
| 53 | it "should escape interpolation with \\#", -> | 53 | it "should escape interpolation with \\\#", -> |
| 54 | name = "world" | 54 | name = "world" |
| 55 | s = "hello \\#{name}" | 55 | s = "hello \#{name}" |
| 56 | assert.same s, "hello #{name}" | 56 | assert.same s, 'hello #{name}' |
| 57 | 57 | ||
| 58 | it "should support method calls on string literals", -> | 58 | it "should support method calls on string literals", -> |
| 59 | result = "hello"\upper! | 59 | result = "hello"\upper! |
| @@ -74,7 +74,7 @@ describe "string", -> | |||
| 74 | name = "test" | 74 | name = "test" |
| 75 | s = | | 75 | s = | |
| 76 | hello #{name} | 76 | hello #{name} |
| 77 | assert.same s, "hello test\n" | 77 | assert.same s, "hello test" |
| 78 | 78 | ||
| 79 | it "should support string concatenation", -> | 79 | it "should support string concatenation", -> |
| 80 | s = "hello" .. " " .. "world" | 80 | s = "hello" .. " " .. "world" |
| @@ -109,7 +109,7 @@ describe "string", -> | |||
| 109 | assert.is_true s\match("y: 20") ~= nil | 109 | assert.is_true s\match("y: 20") ~= nil |
| 110 | 110 | ||
| 111 | it "should support function call in interpolation", -> | 111 | it "should support function call in interpolation", -> |
| 112 | s = "result: #{-> 42}" | 112 | s = "result: #{(-> 42)!}" |
| 113 | assert.same s, "result: 42" | 113 | assert.same s, "result: 42" |
| 114 | 114 | ||
| 115 | it "should support table indexing in interpolation", -> | 115 | it "should support table indexing in interpolation", -> |
