3rdparty/toluapp/src/tests/tmodule.lua
raw| 1 | -- test valid access |
| 2 | assert(A.a==1) |
| 3 | assert(A.B.b==2) |
| 4 | assert(A.B.C.c==3) |
| 5 | |
| 6 | -- test invalid access |
| 7 | assert(A.B.a==nil) -- no inheritance |
| 8 | assert(A.B.C.a==nil) |
| 9 | |
| 10 | assert(A.b==nil) -- no access the inner module |
| 11 | assert(A.c==nil) |
| 12 | assert(A.B.c==nil) |
| 13 | |
| 14 | -- test variables appended to existing modules |
| 15 | assert(A.d==4) |
| 16 | |
| 17 | print("Module test OK") |