summaryrefslogtreecommitdiff
path: root/testdata
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-06-13 14:29:39 (GMT)
committerMarius Kintel <marius@kintel.net>2013-06-13 14:29:39 (GMT)
commitb45a93aad28a6764aa9aa56d27ffb716353dc27c (patch)
tree747cffce89dab5a4038d2467dfe2fae339bdb5fe /testdata
parent2a8f188fca3476dd07222585237d3afbc2e7b6be (diff)
Related to #399, reverted assignment evaluation order to be the same as in 2013.01 as the new implementation broke existing scripts. Added some experimental commented out code, which can be used as reference in the future
Diffstat (limited to 'testdata')
-rw-r--r--testdata/scad/misc/value-reassignment-tests.scad4
-rw-r--r--testdata/scad/misc/value-reassignment-tests2.scad9
2 files changed, 10 insertions, 3 deletions
diff --git a/testdata/scad/misc/value-reassignment-tests.scad b/testdata/scad/misc/value-reassignment-tests.scad
index 4370c11..26afa03 100644
--- a/testdata/scad/misc/value-reassignment-tests.scad
+++ b/testdata/scad/misc/value-reassignment-tests.scad
@@ -4,6 +4,6 @@
myval = 2;
i = 2;
-myval = i * 2;
-echo(myval, i); // Should output 4, 2
+myval = i * 2; // This is not (yet) allowed as it will be evaluates in place of the first assignment
+echo(myval, i); // Should output undef, 2
diff --git a/testdata/scad/misc/value-reassignment-tests2.scad b/testdata/scad/misc/value-reassignment-tests2.scad
index 9d7cf50..29a2fb7 100644
--- a/testdata/scad/misc/value-reassignment-tests2.scad
+++ b/testdata/scad/misc/value-reassignment-tests2.scad
@@ -5,5 +5,12 @@
myval = 2;
i = myval;
myval = 3;
-echo(myval, i); // Should output 3, 2
+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