diff --git a/.busted b/.busted new file mode 100644 index 0000000..e9f33e0 --- /dev/null +++ b/.busted @@ -0,0 +1,11 @@ +return { + _all = { + }, + default = { + verbose = true, + lpath = "Parser/?.lua;Utils/?.lua;Locale/?.lua", + ROOT = {"."}, + recursive = true, + pattern = "_spec.lua", + }, +} \ No newline at end of file diff --git a/Locale/en_spec.lua b/Locale/en_spec.lua new file mode 100644 index 0000000..b34f77d --- /dev/null +++ b/Locale/en_spec.lua @@ -0,0 +1,31 @@ +describe("pre test", function() + it("should be able to load en", function() + stub(_G, "L") + assert.is.truthy(require('en')) + end) + it("should load constants", function() + assert.is.truthy(require('Enums')) + end) +end) + +describe("en tests", function() + setup(function () + require('en') + require('Enums') + end) + describe("parsing tests", function() + it("should read consts", function() + assert.are.same({"Death","Death"},L["Death"]) + end) + it("should parse basic hit", function() + -- body + input = "Gandalf scored a hit on Balrog for 10 damage to Balrog%." + eventType, initiatorName, targetName, skillName, amount, avoidType, critType, dmgType = L["Parse"](input) + assert.is.equal(event_type.DMG_DEALT,eventType) + assert.is.equal("Gandalf",initiatorName) + assert.is.equal("Balrog", targetName) + assert.is.equal(L["DirectDamage"], skillName) + assert.is.equal(10, amount) + end) + end) +end) \ No newline at end of file diff --git a/Parser/Parser_spec.lua b/Parser/Parser_spec.lua new file mode 100644 index 0000000..d428611 --- /dev/null +++ b/Parser/Parser_spec.lua @@ -0,0 +1,15 @@ +describe("pre test", function() + it("should be able to load Parser", function() + stub(_G, "L") + stub(_G, "Misc") + stub(_G.Misc, "AddCallback") + stub(_G, "Turbine") + stub(_G.Turbine, "UI") + stub(_G.Turbine.UI, "Control", {parserControl = {}}) + + assert.is.truthy(require('Parser')) + end) + it("should load constants", function() + assert.is.truthy(require('Enums')) + end) +end) \ No newline at end of file