Skip to content

Commit

Permalink
Merge pull request #178 from cgay/dev
Browse files Browse the repository at this point in the history
Revert "Remove the --report-file option"
  • Loading branch information
cgay authored Feb 26, 2024
2 parents 5a779d9 + 99ff00f commit 0576057
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
22 changes: 17 additions & 5 deletions command-line.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ define function parse-args
" the suite is ordered with other tests/suites at the same level and"
" then when that suite runs its components are ordered separately."
" [%default%]"));
// TODO(cgay): I adopted the convention of using ./_test in test-temp-directory()
// and we could use it here as the default location of the report file.
add-option(parser,
make(<parameter-option>,
names: "report-file",
variable: "FILE",
help: "File in which to store the report."));
add-option(parser,
make(<repeated-parameter-option>,
names: "load",
Expand Down Expand Up @@ -261,13 +268,18 @@ define function run-or-list-tests
0
else
// Run the requested tests.
let pathname = get-option-value(parser, "report-file");
let result = run-tests(runner, start-suite);
report-function(result, *standard-output*);
if (result.result-status == $passed)
0
if (pathname)
fs/with-open-file(stream = pathname, direction: #"output", if-exists: #"replace")
report-function(result, stream);
end;
// Always display the summary on the console.
print-summary-report(result, *standard-output*);
else
1
end
report-function(result, *standard-output*);
end;
if (result.result-status == $passed) 0 else 1 end
end
end function;

Expand Down
6 changes: 4 additions & 2 deletions documentation/source/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,10 @@ xxx-test-suite-app.lid`` and run with ``xxx-test-suite-app --help``.
Reports
=======

The ``--report`` option can be used to generate a full report of test run
results. These are the available report types:
The ``--report`` and ``--report-file`` options can be used to write a full
report of test run results so that those results can be compared with
subsequent test runs, for example to find regressions. These are the available
report types:

failures (the default)
Prints out only the list of failures and a summary, in readable text format.
Expand Down

0 comments on commit 0576057

Please sign in to comment.