微调test模块
This commit is contained in:
@@ -9,7 +9,8 @@ TABLE= require'Zframework.tableExtend'
|
|||||||
STRING= require'Zframework.stringExtend'
|
STRING= require'Zframework.stringExtend'
|
||||||
PROFILE= require'Zframework.profile'
|
PROFILE= require'Zframework.profile'
|
||||||
JSON= require'Zframework.json'
|
JSON= require'Zframework.json'
|
||||||
TESTING= require'Zframework.testing'
|
TEST= require'Zframework.test'
|
||||||
|
|
||||||
do--Add pcall & MES for JSON lib
|
do--Add pcall & MES for JSON lib
|
||||||
local encode,decode=JSON.encode,JSON.decode
|
local encode,decode=JSON.encode,JSON.decode
|
||||||
JSON.encode=function(val)
|
JSON.encode=function(val)
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
--Utils for testing
|
local TEST={}
|
||||||
local testing={}
|
|
||||||
|
|
||||||
--Wait for the scene swapping animation to finish
|
--Wait for the scene swapping animation to finish
|
||||||
function testing.switchSCN()
|
function TEST.switchSCN()
|
||||||
while SCN.swapping do YIELD()end
|
while SCN.swapping do YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
function testing.sleep(frames)
|
function TEST.wait(frames)
|
||||||
for _=1,frames do YIELD()end
|
for _=1,frames do YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
return testing
|
return TEST
|
||||||
19
main.lua
19
main.lua
@@ -590,25 +590,24 @@ for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end
|
|||||||
|
|
||||||
if TABLE.find(arg,'--test')then
|
if TABLE.find(arg,'--test')then
|
||||||
TASK.new(function()
|
TASK.new(function()
|
||||||
local switchSCN,sleep=TESTING.switchSCN,TESTING.sleep
|
|
||||||
while not LOADED do YIELD()end
|
while not LOADED do YIELD()end
|
||||||
|
|
||||||
print("\27[92m\27[1mAutomatic Test Started\27[0m")
|
LOG("\27[92m\27[1mAutomatic Test Started\27[0m")
|
||||||
BGM.setVol(0)SFX.setVol(0)
|
BGM.setVol(0)SFX.setVol(0)
|
||||||
love.keypressed('space')
|
love.keypressed('space')
|
||||||
switchSCN()
|
TEST.switchSCN()
|
||||||
|
|
||||||
for k,mode in next,MODES do
|
for k,mode in next,MODES do
|
||||||
if k~='netBattle'then
|
if k~='netBattle'then
|
||||||
print("Scanning mode: "..mode.name)
|
LOG("Scanning mode: "..mode.name)
|
||||||
loadGame(mode.name,true)
|
loadGame(mode.name,true)
|
||||||
switchSCN()
|
TEST.switchSCN()
|
||||||
SCN.back()
|
SCN.back()
|
||||||
switchSCN()
|
TEST.switchSCN()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
print("\27[92m\27[1mAutomatic Test Passed :)\27[0m")
|
LOG("\27[92m\27[1mAutomatic Test Passed :)\27[0m")
|
||||||
sleep(60)
|
TEST.wait(60)
|
||||||
love.event.quit(0)
|
love.event.quit(0)
|
||||||
end)
|
end)
|
||||||
TASK.new(function()
|
TASK.new(function()
|
||||||
@@ -616,8 +615,8 @@ if TABLE.find(arg,'--test')then
|
|||||||
YIELD()
|
YIELD()
|
||||||
if ERRDATA[1]then break end
|
if ERRDATA[1]then break end
|
||||||
end
|
end
|
||||||
print("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(ERRDATA[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(ERRDATA[1].mes,"\n").."\27[91m\nAborting\27[0m")
|
||||||
TESTING.sleep(60)
|
TEST.wait(60)
|
||||||
love.event.quit(1)
|
love.event.quit(1)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user