devkapilbansal
Newcomer
Greetings Everyone,
I am trying to mock `io` library for testing. I make two tables definining package.loaded.io as some table.
The tables look like this:
Then I use luaunit to tests some of the files. The problem I am facing is that the io defined in TestNeighbor is getting used by the TestNetJSON. I tried other ways too like setting package.loaded.io to nil etc. But, nothing seems to work.
What should I do in this case??
I am trying to mock `io` library for testing. I make two tables definining package.loaded.io as some table.
The tables look like this:
TestNeighbor={
setUp=function()
local env=require('main_env')
package.loaded.io=env.io
end,
tearDown=function()
end
}
TestNetJSON={
setUp=function()
local env=require('basic_env')
package.loaded.io=env.io
end,
tearDown=function()
end
}
Then I use luaunit to tests some of the files. The problem I am facing is that the io defined in TestNeighbor is getting used by the TestNetJSON. I tried other ways too like setting package.loaded.io to nil etc. But, nothing seems to work.
What should I do in this case??
Last edited: