From 8079f130a7c2de5eb9d9872d4aa7eab545635fe3 Mon Sep 17 00:00:00 2001 From: Glenn Jackman Date: Sun, 22 Feb 2026 19:33:09 -0500 Subject: [PATCH] Correct the overall status if some tests errored --- bin/run.moon | 2 +- tests/example-partial-error/expected_results.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/run.moon b/bin/run.moon index a9418e9..f593b26 100755 --- a/bin/run.moon +++ b/bin/run.moon @@ -166,7 +166,7 @@ write_results = (slug, test_results, names, bodies, dir) -> for name in *names test = test_results[name] assert test, "no test result for #{name}" - status = 'fail' if test.status == 'fail' + status = 'fail' if test.status != 'pass' test.test_code = bodies[name] table.insert results.tests, test results.status = status diff --git a/tests/example-partial-error/expected_results.json b/tests/example-partial-error/expected_results.json index d885434..eb39137 100644 --- a/tests/example-partial-error/expected_results.json +++ b/tests/example-partial-error/expected_results.json @@ -1 +1 @@ -{"tests":[{"message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","status":"error","test_code":" result = hamming.distance '', ''\n assert.are.equal 0, result\n","name":"empty strands"},{"message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","status":"error","test_code":" result = hamming.distance 'A', 'A'\n assert.are.equal 0, result\n","name":"single letter identical strands"},{"message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","status":"error","test_code":" result = hamming.distance 'G', 'T'\n assert.are.equal 1, result\n","name":"single letter different strands"},{"message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","status":"error","test_code":" result = hamming.distance 'GGACTGAAATCTG', 'GGACTGAAATCTG'\n assert.are.equal 0, result\n","name":"long identical strands"},{"message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","status":"error","test_code":" result = hamming.distance 'GGACGGATTCTG', 'AGGACGGATTCT'\n assert.are.equal 9, result\n","name":"long different strands"},{"status":"pass","test_code":" f = -> hamming.distance 'AATG', 'AAA'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow first strand longer"},{"status":"pass","test_code":" f = -> hamming.distance 'ATA', 'AGTG'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow second strand longer"},{"status":"pass","test_code":" f = -> hamming.distance '', 'G'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow empty first strand"},{"status":"pass","test_code":" f = -> hamming.distance 'G', ''\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow empty second strand"}],"status":"pass","version":2} +{"status":"fail","tests":[{"status":"error","test_code":" result = hamming.distance '', ''\n assert.are.equal 0, result\n","message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","name":"empty strands"},{"status":"error","test_code":" result = hamming.distance 'A', 'A'\n assert.are.equal 0, result\n","message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","name":"single letter identical strands"},{"status":"error","test_code":" result = hamming.distance 'G', 'T'\n assert.are.equal 1, result\n","message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","name":"single letter different strands"},{"status":"error","test_code":" result = hamming.distance 'GGACTGAAATCTG', 'GGACTGAAATCTG'\n assert.are.equal 0, result\n","message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","name":"long identical strands"},{"status":"error","test_code":" result = hamming.distance 'GGACGGATTCTG', 'AGGACGGATTCT'\n assert.are.equal 9, result\n","message":"./example_partial_error.moon:5: attempt to call a number value (for iterator 'for iterator')","name":"long different strands"},{"status":"pass","test_code":" f = -> hamming.distance 'AATG', 'AAA'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow first strand longer"},{"status":"pass","test_code":" f = -> hamming.distance 'ATA', 'AGTG'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow second strand longer"},{"status":"pass","test_code":" f = -> hamming.distance '', 'G'\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow empty first strand"},{"status":"pass","test_code":" f = -> hamming.distance 'G', ''\n assert.has.error f, 'strands must be of equal length'\n","name":"disallow empty second strand"}],"version":2}