summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/misc/string-indexing.scad17
1 files changed, 17 insertions, 0 deletions
diff --git a/testdata/scad/misc/string-indexing.scad b/testdata/scad/misc/string-indexing.scad
new file mode 100644
index 0000000..3dc31c9
--- /dev/null
+++ b/testdata/scad/misc/string-indexing.scad
@@ -0,0 +1,17 @@
+test = "test";
+
+// Correct usage cases
+for(i = [0:len(test)-1]) {
+ echo(test[i]);
+}
+
+// Out of bounds
+echo(test[-1]);
+echo(test[len(test)]);
+
+// Invalid index type
+echo(test["test"]);
+echo(test[true]);
+echo(test[false]);
+echo(test[[0]]);
+echo(test[1.7]); \ No newline at end of file
contact: Jan Huwald // Impressum