Skip to content

Commit

Permalink
export_spec
Browse files Browse the repository at this point in the history
  • Loading branch information
ferronn-dev committed May 23, 2022
1 parent 2447ff2 commit d3fae26
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions spec/export_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
describe('export', function()
it('works', function()
local globalenv = {
C_Console = {
GetAllCommands = function()
return 'commands'
end,
},
CreateFrame = function()
return {
RegisterEvent = function() end,
SetScript = function(_, _, script)
script()
end,
}
end,
GetBuildInfo = function()
return 1, 2, 3, 4
end,
LibStub = function()
return {
CompressDeflate = function(_, arg)
return arg
end,
}
end,
}
globalenv._G = globalenv
local addonenv = {
flatdump = function()
return 'flatdump'
end,
pprint = function(arg)
return arg
end,
}
setfenv(loadfile('src/export.lua'), globalenv)('moo', addonenv)
local expected = {
BuildInfo = { 1, 2, 3, 4 },
ConsoleCommands = 'commands',
Data = 'flatdump',
}
assert.same(expected, globalenv.TheFlatDumper)
end)
end)

0 comments on commit d3fae26

Please sign in to comment.