summaryrefslogtreecommitdiff
path: root/testdata/scad/misc/value-reassignment-tests2.scad
diff options
context:
space:
mode:
Diffstat (limited to 'testdata/scad/misc/value-reassignment-tests2.scad')
-rw-r--r--testdata/scad/misc/value-reassignment-tests2.scad16
1 files changed, 16 insertions, 0 deletions
diff --git a/testdata/scad/misc/value-reassignment-tests2.scad b/testdata/scad/misc/value-reassignment-tests2.scad
new file mode 100644
index 0000000..29a2fb7
--- /dev/null
+++ b/testdata/scad/misc/value-reassignment-tests2.scad
@@ -0,0 +1,16 @@
+// Test reassignment where another variable has used the previous
+// value before the reassignment. This could get messed up if order of
+// assignment evaluation changes
+
+myval = 2;
+i = myval;
+myval = 3;
+echo(myval, i); // Should output 3, 3
+
+// NB! This feels wrong, but it's a simulation of what happens
+// when overriding a variable on the cmd-line: openscad -Dmyval=3 myfile.scad
+// Since the intention is to override a top-level variable, the evaluation of the
+// new expression must be done in the same place as the old.
+// This is currently solved by appending the text given to the -D parameter to the end
+// of the main file.
+
contact: Jan Huwald // Impressum