Added test case for parent_module()

brodykenrick-master
Marius Kintel 2013-10-08 23:41:53 -04:00
parent 0860dfda3e
commit 0f22d6e9ad
1 changed files with 26 additions and 0 deletions

View File

@ -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();