Below is the file 'tests/t_lua_includedir.at' from this revision. You can also download the file.
AT_SETUP([include() and includedir() lua functions])
MONOTONE_SETUP
AT_CHECK(mkdir gongolo)
AT_DATA(include.lua, [include("../gongolo/aaa.rc")
])
AT_DATA(includedir.lua, [includedir("../gongolo")
])
# write two files and check that they will be invoked in alphabetic order
AT_DATA(gongolo/aaa.rc, [function paraponzi()
io.write("BOOGA BOOGA")
end
paraponzi()
])
AT_DATA(gongolo/bbb.zz, [function labellagigogin()
io.write("CICCA CICCA")
end
labellagigogin()
])
# setup a wrk dir
AT_CHECK(MONOTONE setup alt_wrk, [], [ignore], [ignore])
# include directly a single file
AT_CHECK(cd alt_wrk && MONOTONE --root=. --rcfile=../include.lua status, [], [stdout], [ignore])
AT_CHECK(grep -q "BOOGA BOOGA" stdout)
# include dirs
AT_CHECK(cd alt_wrk && MONOTONE --root=. --rcfile=../includedir.lua status, [], [stdout], [ignore])
AT_CHECK(grep -q "BOOGA BOOGACICCA CICCA" stdout)
# write a third file: should be read beetween the two previous ones
AT_DATA(gongolo/aba.rc, [function notwowithoutthree()
io.write("hu hu")
end
notwowithoutthree()
])
AT_CHECK(cd alt_wrk && MONOTONE --root=. --rcfile=../includedir.lua status, [], [stdout], [ignore])
AT_CHECK(grep -q "BOOGA BOOGAhu huCICCA CICCA" stdout)
AT_CLEANUP