aboutsummaryrefslogtreecommitdiff
path: root/tests/type/set/testscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/type/set/testscript')
-rw-r--r--tests/type/set/testscript55
1 files changed, 55 insertions, 0 deletions
diff --git a/tests/type/set/testscript b/tests/type/set/testscript
new file mode 100644
index 0000000..aca4c2d
--- /dev/null
+++ b/tests/type/set/testscript
@@ -0,0 +1,55 @@
+# file : tests/type/set/testscript
+# license : MIT; see accompanying LICENSE file
+
+# See also tests in function/*/ (size()), type/json/ (json_set).
+
+.include ../../common.testscript
+
+: basics
+:
+$* <<EOI >>EOO
+s = [string_set] a b a
+print $s
+s += c b
+print $s
+s =+ d b
+print $s
+EOI
+a b
+a b c
+a b c d
+EOO
+
+: type
+:
+$* <<EOI >>EOO
+s = [string_set]
+print $type($s)
+EOI
+string_set
+EOO
+
+: subscript
+:
+$* <<EOI >>EOO
+s = [string_set] a b c
+print ($s[b])
+print ($s[z])
+EOI
+true
+false
+EOO
+
+: iteration
+:
+$* <<EOI >>EOO
+for s: [string_set] a b c
+ print $type($s) $s
+
+for s: [string_set, null]
+ fail bad
+EOI
+string a
+string b
+string c
+EOO