diff options
author | Marius Kintel <marius@kintel.net> | 2013-10-09 03:41:53 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2013-10-09 03:41:53 (GMT) |
commit | 0f22d6e9ad562e87ae484a82df56ddee30e87343 (patch) | |
tree | ceab9a1c2eb2e6cb0e5ca99b214eaa84d20b00ff /testdata | |
parent | 0860dfda3e497ea91a694716d54c89bfc734f2f1 (diff) |
Added test case for parent_module()
Diffstat (limited to 'testdata')
-rw-r--r-- | testdata/scad/misc/parent_module-tests.scad | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/testdata/scad/misc/parent_module-tests.scad b/testdata/scad/misc/parent_module-tests.scad new file mode 100644 index 0000000..3777645 --- /dev/null +++ b/testdata/scad/misc/parent_module-tests.scad @@ -0,0 +1,26 @@ +/* + $parent_modules should return the number of module in the module + instantiation stack. The stack is independent on where the modules + are defined. It's where they're instantiated that counts. + + parent_module(N) returns the Nth module name in the stack +*/ +module print(name) { + echo("name: ", name); + for (i=[1:$parent_modules-1]) echo(parent_module(i)); +} + +module yyy() { + print("yyy"); +} + +module test() { + module xxx() { + print("xxx"); + yyy(); + } + print("test"); + xxx(); +} + +test(); |