Skip to content

Commit 684bd3a

Browse files
authored
indent space -> tab (#8058)
1 parent 6beae65 commit 684bd3a

10 files changed

+2110
-2110
lines changed

spec/GenerateBuilds.lua

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
local function fetchBuilds(path, buildList)
2-
buildList = buildList or {}
3-
for file in lfs.dir(path) do
4-
if file ~= "." and file ~= ".." then
5-
local f = path..'/'..file
6-
local attr = lfs.attributes (f)
7-
assert(type(attr) == "table")
8-
if attr.mode == "directory" then
9-
fetchBuilds(f, buildList)
10-
else
11-
if file:match("^.+(%..+)$") == ".xml" then
12-
local fileHnd, errMsg = io.open(f, "r")
13-
if not fileHnd then
14-
return nil, errMsg
15-
end
16-
local fileText = fileHnd:read("*a")
17-
fileHnd:close()
18-
buildList[f] = fileText
19-
end
20-
end
21-
end
22-
end
23-
return buildList
2+
buildList = buildList or {}
3+
for file in lfs.dir(path) do
4+
if file ~= "." and file ~= ".." then
5+
local f = path..'/'..file
6+
local attr = lfs.attributes (f)
7+
assert(type(attr) == "table")
8+
if attr.mode == "directory" then
9+
fetchBuilds(f, buildList)
10+
else
11+
if file:match("^.+(%..+)$") == ".xml" then
12+
local fileHnd, errMsg = io.open(f, "r")
13+
if not fileHnd then
14+
return nil, errMsg
15+
end
16+
local fileText = fileHnd:read("*a")
17+
fileHnd:close()
18+
buildList[f] = fileText
19+
end
20+
end
21+
end
22+
end
23+
return buildList
2424
end
2525

2626
function buildTable(tableName, values, string)
27-
string = string or ""
28-
string = string .. tableName .. " = {"
29-
for key, value in pairs(values) do
30-
if type(value) == "table" then
31-
buildTable(key, value, string)
32-
elseif type(value) == "boolean" then
33-
string = string .. "[\"" .. key .. "\"] = " .. (value and "true" or "false") .. ",\n"
34-
elseif type(value) == "string" then
35-
string = string .. "[\"" .. key .. "\"] = \"" .. value .. "\",\n"
36-
else
37-
string = string .. "[\"" .. key .. "\"] = " .. round(value, 4) .. ",\n"
38-
end
39-
end
40-
string = string .. "}\n"
41-
return string
27+
string = string or ""
28+
string = string .. tableName .. " = {"
29+
for key, value in pairs(values) do
30+
if type(value) == "table" then
31+
buildTable(key, value, string)
32+
elseif type(value) == "boolean" then
33+
string = string .. "[\"" .. key .. "\"] = " .. (value and "true" or "false") .. ",\n"
34+
elseif type(value) == "string" then
35+
string = string .. "[\"" .. key .. "\"] = \"" .. value .. "\",\n"
36+
else
37+
string = string .. "[\"" .. key .. "\"] = " .. round(value, 4) .. ",\n"
38+
end
39+
end
40+
string = string .. "}\n"
41+
return string
4242
end
4343

4444
local buildList = fetchBuilds("../spec/TestBuilds")
4545
for filename, testBuild in pairs(buildList) do
46-
loadBuildFromXML(testBuild)
47-
local fileHnd, errMsg = io.open(filename:gsub("^(.+)%..+$", "%1.lua"), "w+")
48-
fileHnd:write("return {\n xml = [[")
49-
fileHnd:write(testBuild)
50-
fileHnd:write("]],\n ")
51-
fileHnd:write(buildTable("output", build.calcsTab.mainOutput) .. "\n}")
52-
fileHnd:close()
46+
loadBuildFromXML(testBuild)
47+
local fileHnd, errMsg = io.open(filename:gsub("^(.+)%..+$", "%1.lua"), "w+")
48+
fileHnd:write("return {\n xml = [[")
49+
fileHnd:write(testBuild)
50+
fileHnd:write("]],\n ")
51+
fileHnd:write(buildTable("output", build.calcsTab.mainOutput) .. "\n}")
52+
fileHnd:close()
5353
end

spec/System/TestAilments_spec.lua

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
describe("TestAilments", function()
2-
before_each(function()
3-
newBuild()
4-
end)
2+
before_each(function()
3+
newBuild()
4+
end)
55

6-
teardown(function()
7-
-- newBuild() takes care of resetting everything in setup()
8-
end)
6+
teardown(function()
7+
-- newBuild() takes care of resetting everything in setup()
8+
end)
99

10-
it("maximum shock value", function()
11-
-- Shock Nova
12-
build.skillsTab:PasteSocketGroup("Slot: Weapon 1\nShock Nova 4/0 Default 1\n")
13-
runCallback("OnFrame")
14-
assert.are.equals(round(50 + 10), build.calcsTab.mainOutput.MaximumShock)
10+
it("maximum shock value", function()
11+
-- Shock Nova
12+
build.skillsTab:PasteSocketGroup("Slot: Weapon 1\nShock Nova 4/0 Default 1\n")
13+
runCallback("OnFrame")
14+
assert.are.equals(round(50 + 10), build.calcsTab.mainOutput.MaximumShock)
1515

16-
-- Voltaxic Rift
17-
build.itemsTab:CreateDisplayItemFromRaw("New Item\nAssassin Bow\n+40% to Maximum Effect of Shock")
18-
build.itemsTab:AddDisplayItem()
19-
runCallback("OnFrame")
20-
assert.are.equals(round(50 + 10 + 40), build.calcsTab.mainOutput.MaximumShock)
21-
end)
16+
-- Voltaxic Rift
17+
build.itemsTab:CreateDisplayItemFromRaw("New Item\nAssassin Bow\n+40% to Maximum Effect of Shock")
18+
build.itemsTab:AddDisplayItem()
19+
runCallback("OnFrame")
20+
assert.are.equals(round(50 + 10 + 40), build.calcsTab.mainOutput.MaximumShock)
21+
end)
2222

2323
it("bleed is buffed by bleed chance", function()
2424
build.itemsTab:CreateDisplayItemFromRaw("New Item\nKarui Chopper")
2525
build.itemsTab:AddDisplayItem()
2626
build.skillsTab:PasteSocketGroup("Slot: Weapon 1\nHeavy Strike 1/0 Default 1\n")
2727
build.configTab.input.customMods = "\z
28-
attacks have 10% chance to cause bleeding\n\z
29-
"
28+
attacks have 10% chance to cause bleeding\n\z
29+
"
3030
build.configTab:BuildModList()
3131
runCallback("OnFrame")
3232
local badDps = build.calcsTab.mainOutput.BleedDPS
3333

3434
build.configTab.input.customMods = "\z
35-
attacks have 100% chance to cause bleeding\n\z
36-
"
35+
attacks have 100% chance to cause bleeding\n\z
36+
"
3737
build.configTab:BuildModList()
3838
runCallback("OnFrame")
3939
local goodDps = build.calcsTab.mainOutput.BleedDPS

spec/System/TestAttacks_spec.lua

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
describe("TestAttacks", function()
2-
before_each(function()
3-
newBuild()
4-
end)
2+
before_each(function()
3+
newBuild()
4+
end)
55

6-
teardown(function()
7-
-- newBuild() takes care of resetting everything in setup()
8-
end)
6+
teardown(function()
7+
-- newBuild() takes care of resetting everything in setup()
8+
end)
99

10-
it("creates an item and has the correct crit chance", function()
11-
assert.are.equals(build.calcsTab.mainOutput.CritChance, 0)
12-
build.itemsTab:CreateDisplayItemFromRaw("New Item\nMaraketh Bow\nCrafted: true\nPrefix: None\nPrefix: None\nPrefix: None\nSuffix: None\nSuffix: None\nSuffix: None\nQuality: 20\nSockets: G-G-G-G-G-G\nLevelReq: 71\nImplicits: 1\n{tags:speed}10% increased Movement Speed")
13-
build.itemsTab:AddDisplayItem()
14-
runCallback("OnFrame")
15-
assert.are.equals(build.calcsTab.mainOutput.CritChance, 5.5 * build.calcsTab.mainOutput.HitChance / 100)
16-
end)
10+
it("creates an item and has the correct crit chance", function()
11+
assert.are.equals(build.calcsTab.mainOutput.CritChance, 0)
12+
build.itemsTab:CreateDisplayItemFromRaw("New Item\nMaraketh Bow\nCrafted: true\nPrefix: None\nPrefix: None\nPrefix: None\nSuffix: None\nSuffix: None\nSuffix: None\nQuality: 20\nSockets: G-G-G-G-G-G\nLevelReq: 71\nImplicits: 1\n{tags:speed}10% increased Movement Speed")
13+
build.itemsTab:AddDisplayItem()
14+
runCallback("OnFrame")
15+
assert.are.equals(build.calcsTab.mainOutput.CritChance, 5.5 * build.calcsTab.mainOutput.HitChance / 100)
16+
end)
1717

18-
it("creates an item and has the correct crit multi", function()
19-
assert.are.equals(1.5, build.calcsTab.mainOutput.CritMultiplier)
20-
build.itemsTab:CreateDisplayItemFromRaw("New Item\nAssassin Bow\nCrafted: true\nPrefix: None\nPrefix: None\nPrefix: None\nSuffix: None\nSuffix: None\nSuffix: None\nQuality: 20\nSockets: G-G-G-G-G-G\nLevelReq: 62\nImplicits: 1\n{tags:damage,critical}{range:0.5}+(15-25)% to Global Critical Strike Multiplier")
21-
build.itemsTab:AddDisplayItem()
22-
runCallback("OnFrame")
23-
assert.are.equals(1.5 + 0.2, build.calcsTab.mainOutput.CritMultiplier)
24-
end)
18+
it("creates an item and has the correct crit multi", function()
19+
assert.are.equals(1.5, build.calcsTab.mainOutput.CritMultiplier)
20+
build.itemsTab:CreateDisplayItemFromRaw("New Item\nAssassin Bow\nCrafted: true\nPrefix: None\nPrefix: None\nPrefix: None\nSuffix: None\nSuffix: None\nSuffix: None\nQuality: 20\nSockets: G-G-G-G-G-G\nLevelReq: 62\nImplicits: 1\n{tags:damage,critical}{range:0.5}+(15-25)% to Global Critical Strike Multiplier")
21+
build.itemsTab:AddDisplayItem()
22+
runCallback("OnFrame")
23+
assert.are.equals(1.5 + 0.2, build.calcsTab.mainOutput.CritMultiplier)
24+
end)
2525

26-
it("correctly converts spell damage per stat to attack damage", function()
27-
assert.are.equals(0, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
28-
build.itemsTab:CreateDisplayItemFromRaw([[
29-
New Item
30-
Coral Amulet
31-
10% increased attack damage
32-
10% increased spell damage
33-
1% increased spell damage per 10 intelligence
34-
]])
35-
build.itemsTab:AddDisplayItem()
36-
runCallback("OnFrame")
37-
assert.are.equals(10, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
38-
-- Scion starts with 20 Intelligence
39-
assert.are.equals(12, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Spell }, "Damage"))
26+
it("correctly converts spell damage per stat to attack damage", function()
27+
assert.are.equals(0, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
28+
build.itemsTab:CreateDisplayItemFromRaw([[
29+
New Item
30+
Coral Amulet
31+
10% increased attack damage
32+
10% increased spell damage
33+
1% increased spell damage per 10 intelligence
34+
]])
35+
build.itemsTab:AddDisplayItem()
36+
runCallback("OnFrame")
37+
assert.are.equals(10, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
38+
-- Scion starts with 20 Intelligence
39+
assert.are.equals(12, build.calcsTab.mainEnv.player.modDB:Sum("INC", { flags = ModFlag.Spell }, "Damage"))
4040

41-
build.itemsTab:CreateDisplayItemFromRaw([[
42-
New Item
43-
Coral Ring
44-
increases and reductions to spell damage also apply to attacks
45-
]])
46-
build.itemsTab:AddDisplayItem()
47-
runCallback("OnFrame")
48-
assert.are.equals(22, build.calcsTab.mainEnv.player.mainSkill.skillModList:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
41+
build.itemsTab:CreateDisplayItemFromRaw([[
42+
New Item
43+
Coral Ring
44+
increases and reductions to spell damage also apply to attacks
45+
]])
46+
build.itemsTab:AddDisplayItem()
47+
runCallback("OnFrame")
48+
assert.are.equals(22, build.calcsTab.mainEnv.player.mainSkill.skillModList:Sum("INC", { flags = ModFlag.Attack }, "Damage"))
4949

50-
end)
50+
end)
5151
end)

spec/System/TestBuilds_spec.lua

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
local function fetchBuilds(path, buildList)
2-
buildList = buildList or {}
3-
for file in lfs.dir(path) do
4-
if file ~= "." and file ~= ".." then
5-
local f = path..'/'..file
6-
local attr = lfs.attributes (f)
7-
assert(type(attr) == "table")
8-
if attr.mode == "directory" then
9-
fetchBuilds(f, buildList)
10-
elseif file:match("^.+(%..+)$") == ".lua" then
11-
buildList[file] = LoadModule(f)
12-
end
13-
end
14-
end
15-
return buildList
2+
buildList = buildList or {}
3+
for file in lfs.dir(path) do
4+
if file ~= "." and file ~= ".." then
5+
local f = path..'/'..file
6+
local attr = lfs.attributes (f)
7+
assert(type(attr) == "table")
8+
if attr.mode == "directory" then
9+
fetchBuilds(f, buildList)
10+
elseif file:match("^.+(%..+)$") == ".lua" then
11+
buildList[file] = LoadModule(f)
12+
end
13+
end
14+
end
15+
return buildList
1616
end
1717

1818
expose("test all builds #builds", function()
19-
local buildList = fetchBuilds("../spec/TestBuilds")
20-
for buildName, testBuild in pairs(buildList) do
21-
loadBuildFromXML(testBuild.xml, buildName)
22-
testBuild.result = {}
23-
for key, value in pairs(testBuild.output) do
24-
-- Have to assign it to a temporary table here, as the tests will run later, when the 'build' isn't changing
25-
testBuild.result[key] = build.calcsTab.mainOutput[key]
26-
it("on build: " .. buildName .. ", key: " .. key, function()
27-
if type(value) == "number" and type(testBuild.result[key]) == "number" then
28-
assert.are.same(round(value, 4), round(testBuild.result[key] or 0, 4))
29-
else
30-
assert.are.same(value, testBuild.result[key])
31-
end
32-
end)
33-
end
34-
end
19+
local buildList = fetchBuilds("../spec/TestBuilds")
20+
for buildName, testBuild in pairs(buildList) do
21+
loadBuildFromXML(testBuild.xml, buildName)
22+
testBuild.result = {}
23+
for key, value in pairs(testBuild.output) do
24+
-- Have to assign it to a temporary table here, as the tests will run later, when the 'build' isn't changing
25+
testBuild.result[key] = build.calcsTab.mainOutput[key]
26+
it("on build: " .. buildName .. ", key: " .. key, function()
27+
if type(value) == "number" and type(testBuild.result[key]) == "number" then
28+
assert.are.same(round(value, 4), round(testBuild.result[key] or 0, 4))
29+
else
30+
assert.are.same(value, testBuild.result[key])
31+
end
32+
end)
33+
end
34+
end
3535
end)

0 commit comments

Comments
 (0)