You are right, the bug was in the test framework of the build system.
local short_src = debug.getinfo( 1 ).short_src
local test_path = string.gsub( short_src, "main.lua$", "?.lua" )
local tests_path = string.gsub( short_src, "main.lua$", "tests/?.lua" )
local build_path = string.gsub( short_src, "test/main.lua$", "build/?.so" ) -- No substitution on Windows, a lua file was added to package.cpath.
-- Also the extension is wrong for Windows (although the build subdir
-- is not available in the setup for Visual Studio).
package.path = package.path .. ";".. test_path .. ";".. tests_path
package.cpath = package.cpath .. ";".. build_path
The bug is fixed by making the substitution a bit smarter.
local tests_path = string.gsub( short_src, "([\\/])main.lua$", "%1tests%1?.lua" )
local build_path = string.gsub( short_src, "test([\\/])main.lua$",
function( separator )
return separator == "/" and "build/?.so" or "build\\?.dll"
end )
So the first conclusion is that there was indeed a bug in the buildsystem.
The second one is that submodules are not used often as some of you in the thread suggested to used nested classes.
Finally, everyone have to write a hashing library at some point.
Thank you all.
-- Jasper