From f68facbe0e48a4df6164f1680484a1a7b49e10e2 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 1 Nov 2021 03:41:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A3=80=E6=B5=8B=E5=88=B0=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=9C=89--test=E6=97=B6=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=84=9A=E6=9C=AC=EF=BC=88=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A=E6=B5=8B=E8=AF=95=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Trebor Huang <41145779+Trebor-Huang@users.noreply.github.com> --- main.lua | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index c2f5ba91..50ec6a62 100644 --- a/main.lua +++ b/main.lua @@ -580,4 +580,35 @@ table.insert(_LOADTIMELIST_,("Initialize Data: %.3fs"):format(TIME()-_LOADTIME_) for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end -for k,v in next,MODES do print(k,v)end \ No newline at end of file +if TABLE.find(arg,'--test')then + TASK.new(function() + while not LOADED do YIELD()end + + print("\27[92m\27[1mAutomatic Test Started\27[0m") + BGM.setVol(0)SFX.setVol(0) + love.keypressed('space') + while SCN.swapping do YIELD()end + + for k,mode in next,MODES do + if k~='netBattle'then + print("Scanning mode: "..mode.name) + loadGame(mode.name.."a",true) + while SCN.swapping do YIELD()end + SCN.back() + while SCN.swapping do YIELD()end + end + end + print("\27[92m\27[1mAutomatic Test Passed :)\27[0m") + for _=1,60 do YIELD()end + love.event.quit(0) + end) + TASK.new(function() + while true do + YIELD() + if ERRDATA[1]then break 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") + for _=1,60 do YIELD()end + love.event.quit(1) + end) +end