From 0f22d6e9ad562e87ae484a82df56ddee30e87343 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 8 Oct 2013 23:41:53 -0400 Subject: Added test case for parent_module() 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(); -- cgit v0.10.1