summaryrefslogtreecommitdiff
path: root/testdata/scad/misc/variable-scope-tests.scad
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2013-06-13 05:31:09 (GMT)
committerMarius Kintel <marius@kintel.net>2013-06-13 05:31:09 (GMT)
commit2a8f188fca3476dd07222585237d3afbc2e7b6be (patch)
treea74794929f2d825fc8fec5777c688e9d59b9eafb /testdata/scad/misc/variable-scope-tests.scad
parentbd0248e109f6a290570bca55949583ea80bdce38 (diff)
parente76a41a34672385eb0f8e69e95c932a565cc2bc2 (diff)
Merge branch 'master' of github.com:openscad/openscad
Diffstat (limited to 'testdata/scad/misc/variable-scope-tests.scad')
-rw-r--r--testdata/scad/misc/variable-scope-tests.scad13
1 files changed, 12 insertions, 1 deletions
diff --git a/testdata/scad/misc/variable-scope-tests.scad b/testdata/scad/misc/variable-scope-tests.scad
index 8426fbb..104d1a4 100644
--- a/testdata/scad/misc/variable-scope-tests.scad
+++ b/testdata/scad/misc/variable-scope-tests.scad
@@ -49,5 +49,16 @@ echo("undeclared variable can still be passed and used");
module undeclared_var() {
echo(d);
}
-
undeclared_var(d=6);
+
+echo("attempt to assign from a not-yet-defined variable which also exists globally");
+
+globalval = 1;
+// Test that b = a turns into b = 1, heeding the order of the assignments
+// See issue #399 for more discussion
+module global_lookup() {
+ b = globalval; // Should be assigned 1 since the local one isn't yet defined
+ globalval = 5; // Overrides the value for the local scope only
+ echo(globalval,b); // Should output 5, 1
+}
+global_lookup();
contact: Jan Huwald // Impressum