aboutsummaryrefslogtreecommitdiffstats
path: root/spec/lib/string_spec.moon
diff options
context:
space:
mode:
authors-ol <s+removethis@s-ol.nu>2025-03-18 11:47:22 +0000
committers-ol <s+removethis@s-ol.nu>2025-03-18 12:06:18 +0000
commitb6cbc69461dc054019f50f8971704f6ef9de63ab (patch)
treed2b8942b780f668ccbe57b52dd8d65f61613e935 /spec/lib/string_spec.moon
parentbuiltins: switch takes single array as value (diff)
downloadalive-wip.tar.gz
alive-wip.zip
language: [array] and {struct} literalswip
Diffstat (limited to 'spec/lib/string_spec.moon')
-rw-r--r--spec/lib/string_spec.moon26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/lib/string_spec.moon b/spec/lib/string_spec.moon
index 859c402..c787609 100644
--- a/spec/lib/string_spec.moon
+++ b/spec/lib/string_spec.moon
@@ -16,22 +16,22 @@ describe "string", ->
it "stringifies arrays", ->
COPILOT\eval_once '
- (expect= "[1 2 3]" (string/str (array 1 2 3)))
- (expect= \'["a" "b" "c"]\' (string/str (array "a" "b" "c")))
+ (expect= "[1 2 3]" (string/str [1 2 3]))
+ (expect= \'["a" "b" "c"]\' (string/str ["a" "b" "c"]))
'
it "stringifies structs", ->
COPILOT\eval_once '
(expect= \'{a: 1 b: true c: "hello"}\'
- (string/str (struct "a" 1
- "b" true
- "c" "hello")))
+ (string/str {"a" 1
+ "b" true
+ "c" "hello"}))
'
it "stringifies deeply", ->
COPILOT\eval_once '
(expect= "{a: {b: [1 2 3]}}"
- (string/str (struct "a" (struct "b" (array 1 2 3)))))
+ (string/str {"a" {"b" [1 2 3]}}))
'
it "joins multiple arguments", ->
@@ -48,23 +48,23 @@ describe "string", ->
describe "concat", ->
it "concatenates string-arrays", ->
COPILOT\eval_once '
- (expect= "hello" (string/concat (array "hello")))
- (expect= "helloworld" (string/concat (array "hello" "world")))
- (expect= "helloobeautifulworld" (string/concat (array "hello" "o" "beautiful" "world")))
+ (expect= "hello" (string/concat ["hello"]))
+ (expect= "helloworld" (string/concat ["hello" "world"]))
+ (expect= "helloobeautifulworld" (string/concat ["hello" "o" "beautiful" "world"]))
'
it "takes custom separator", ->
COPILOT\eval_once '
- (expect= "a, b, c" (string/concat ", " (array "a" "b" "c")))
- (expect= "hello world" (string/concat " " (array "hello" "world")))
- (expect= "hello o beautiful world" (string/concat " " (array "hello" "o" "beautiful" "world")))
+ (expect= "a, b, c" (string/concat ", " ["a" "b" "c"]))
+ (expect= "hello world" (string/concat " " ["hello" "world"]))
+ (expect= "hello o beautiful world" (string/concat " " ["hello" "o" "beautiful" "world"]))
'
describe "join", ->
it "concatenates and stringifies", ->
COPILOT\eval_once '
(expect= "that is 1 beautiful tree" (string/join " " "that is" 1 "beautiful tree"))
- (expect= "my favorite color is [0.9 0.2 1]" (string/join " " "my favorite color is" (array 0.9 0.2 1)))
+ (expect= "my favorite color is [0.9 0.2 1]" (string/join " " "my favorite color is" [0.9 0.2 1]))
(expect= "i_am_snek" (string/join "_" "i" "am" "snek"))
'