Closed Ismoh closed 2 years ago
In the code shown, you are doing directly the call to fu.GetRelativeDirectoryAndFilesOfSave06()
and get the error immediatly. To work with luaunit, you must not do the call yourself, but just pass the function to call. LuaUnit will call it in an environment where it can catch the error.
So; this should be :
function TestFileUtil:testGetRelativeDirectoryAndFilesOfSave06()
lu.assertError(fu.GetRelativeDirectoryAndFilesOfSave06)
lu.assertErrorMsgContains("Unix system are not supported yet", fu.GetRelativeDirectoryAndFilesOfSave06)
end
Ah, this makes completly sense 😆 Thanks for your fast reply and help! I will change it tomorrow. Can be closed! 😎
Hey, I am new to Lua and LuaUnit. I am not sure, if I do anything wrong, but the assertion of errors does not work for me.
The error itself:
https://github.com/Ismoh/NoitaMP/blob/b52f1b7e0e2f50df53d90eda569f055616201df7/noita-mp/files/scripts/util/file_util.lua#L99
The test file and functions:
https://github.com/Ismoh/NoitaMP/blob/b52f1b7e0e2f50df53d90eda569f055616201df7/.testing/tests/file_util_test.lua#L65-L68
The test output:
I expected the test to succeed with "Ok". Am I wrong?