Testing by Assertions
Test Summary
Summarize a small group of checks.
result summary
A simple summary reports how many checks passed and whether the group should be treated as successful.
Test Summary
test_summary.lua
Replay: real traced execution (multi-file project)
local failed = 1
local total = 3
local passed = total - failed
local status = "failed"
if failed == 0 then
status = "passed"
end
print("passed=" .. passed)
print("failed=" .. failed)
print("status=" .. status)
local failed = 0
local total = 3
local passed = total - failed
local status = "failed"
if failed == 0 then
status = "passed"
end
print("passed=" .. passed)
print("failed=" .. failed)
print("status=" .. status)
local failed = 2
local total = 3
local passed = total - failed
local status = "failed"
if failed == 0 then
status = "passed"
end
print("passed=" .. passed)
print("failed=" .. failed)
print("status=" .. status)
failed ← 1, total ← 3, passed ← 2, status ← failed
1local failed→ 1 = 1 --@failed=0, 22local total→ 3 = 33local passed→ 2 = total3 - failed14local status→ failed = "failed"5if failed == 0 then6 status = "passed"7end8print("passed=" .. passed2)9print("failed=" .. failed1)10print("status=" .. statusfailed)outputpassed=2 failed=1 status=failed
failed ← 0, total ← 3, passed ← 3, status ← failed
1local failed→ 0 = 02local total→ 3 = 33local passed→ 3 = total3 - failed04local status→ failed = "failed"5if failed == 0 thenstatus ← passed
4local status = "failed"5if failed0 == 0 then6 status→ passed = "passed"7endprint("passed=" .. passed)
7end8print("passed=" .. passed3)9print("failed=" .. failed0)10print("status=" .. statuspassed)outputpassed=3 failed=0 status=passed
failed ← 2, total ← 3, passed ← 1, status ← failed
1local failed→ 2 = 22local total→ 3 = 33local passed→ 1 = total3 - failed24local status→ failed = "failed"5if failed == 0 then6 status = "passed"7end8print("passed=" .. passed1)9print("failed=" .. failed2)10print("status=" .. statusfailed)outputpassed=1 failed=2 status=failed