Skip to content

Commit

Permalink
Make test framework list out failed tests to use in filter (#10241)
Browse files Browse the repository at this point in the history
* List out failed tests

* Code review changes
  • Loading branch information
AdRiley authored Jun 11, 2024
1 parent c4b0ca8 commit 783276c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions distribution/lib/Standard/Test/0.0.0-dev/src/Suite.enso
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,26 @@ type Suite

all_results = all_results_bldr.to_vector
succ_tests = all_results.filter (r-> r.is_success) . length
failed_tests = all_results.filter (r-> r.is_fail) . length
failed_tests = all_results.filter (r-> r.is_fail)
failed_tests_number = failed_tests.length
failed_tests_names = failed_tests.map (t-> t.spec_name) . distinct . take 10 . join "|"
skipped_tests = all_results.filter (r-> r.is_pending) . length
pending_groups = matching_specs.filter (p-> p.first.is_pending) . length
case should_exit of
True ->
IO.println ""
IO.println <| succ_tests.to_text + " tests succeeded."
IO.println <| failed_tests.to_text + " tests failed."
IO.println <| failed_tests_number.to_text + " tests failed."
IO.println <| skipped_tests.to_text + " tests skipped."
IO.println <| pending_groups.to_text + " groups skipped."
IO.println ""
exit_code = if failed_tests > 0 then 1 else 0
IO.println <| "Failed tests: '" + failed_tests_names + "'"
if failed_tests_number > 10 then IO.println "(Displaying only first 10 failed tests)"
IO.println ""
exit_code = if failed_tests_number > 0 then 1 else 0
System.exit exit_code
False ->
failed_tests == 0
failed_tests_number == 0

## Gets the names of all the groups in this suite.
group_names self =
Expand Down

0 comments on commit 783276c

Please sign in to comment.