tcl: list commands — 12 commands (+26 tests, 182 total)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Has been cancelled
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -234,6 +234,33 @@
|
||||
(ok "str-is-alpha-no" (get (run "string is alpha hello1") :result) "0")
|
||||
(ok "str-is-boolean" (get (run "string is boolean true") :result) "1")
|
||||
(ok "str-cat" (get (run "string cat foo bar baz") :result) "foobarbaz")
|
||||
; --- list command tests ---
|
||||
(ok "list-simple" (get (run "list a b c") :result) "a b c")
|
||||
(ok "list-brace-elem" (get (run "list {a b} c") :result) "{a b} c")
|
||||
(ok "list-empty" (get (run "list") :result) "")
|
||||
(ok "lindex-1" (get (run "lindex {a b c} 1") :result) "b")
|
||||
(ok "lindex-0" (get (run "lindex {a b c} 0") :result) "a")
|
||||
(ok "lindex-oob" (get (run "lindex {a b c} 5") :result) "")
|
||||
(ok "lrange" (get (run "lrange {a b c d} 1 2") :result) "b c")
|
||||
(ok "lrange-full" (get (run "lrange {a b c} 0 end") :result) "a b c")
|
||||
(ok "llength" (get (run "llength {a b c}") :result) "3")
|
||||
(ok "llength-empty" (get (run "llength {}") :result) "0")
|
||||
(ok "lreverse" (get (run "lreverse {1 2 3}") :result) "3 2 1")
|
||||
(ok "lsearch-found" (get (run "lsearch {a b c} b") :result) "1")
|
||||
(ok "lsearch-missing" (get (run "lsearch {a b c} z") :result) "-1")
|
||||
(ok "lsearch-exact" (get (run "lsearch -exact {foo bar} foo") :result) "0")
|
||||
(ok "lsort-asc" (get (run "lsort {banana apple cherry}") :result) "apple banana cherry")
|
||||
(ok "lsort-int" (get (run "lsort -integer {10 2 30 5}") :result) "2 5 10 30")
|
||||
(ok "lsort-dec" (get (run "lsort -decreasing {c a b}") :result) "c b a")
|
||||
(ok "lreplace" (get (run "lreplace {a b c d} 1 2 X Y") :result) "a X Y d")
|
||||
(ok "linsert" (get (run "linsert {a b c} 1 X Y") :result) "a X Y b c")
|
||||
(ok "linsert-end" (get (run "linsert {a b} end Z") :result) "a b Z")
|
||||
(ok "concat" (get (run "concat {a b} {c d}") :result) "a b c d")
|
||||
(ok "split-sep" (get (run "split {a:b:c} :") :result) "a b c")
|
||||
(ok "split-ws" (get (run "split {a b c}") :result) "a b c")
|
||||
(ok "join-sep" (get (run "join {a b c} -") :result) "a-b-c")
|
||||
(ok "join-default" (get (run "join {a b c}") :result) "a b c")
|
||||
(ok "list-var" (get (run "set L {x y z}\nllength $L") :result) "3")
|
||||
(dict
|
||||
"passed"
|
||||
tcl-eval-pass
|
||||
|
||||
Reference in New Issue
Block a user