Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions test/blackbox-tests/test-cases/cram/partial-promotion-on-error.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Test that cram tests with unreachable commands can still partially promote
output from commands that executed successfully.

$ cat > dune-project <<EOF
> (lang dune 3.21)
> EOF

Create a test with some successful commands, then an exit, then unreachable
commands:

$ cat > test.t <<EOF
> $ echo "First command"
> $ echo "Second command"
> $ exit 1
> $ echo "This will never execute"
> $ echo "Neither will this"
> EOF

The test should fail but still capture output from executed commands:
$ dune runtest
File "test.t", line 1, characters 0-0:
Error: Files _build/default/test.t and _build/default/test.t.corrected
differ.
[1]
$ dune promote
Promoting _build/default/test.t.corrected to test.t.

After promotion, the test file should have output from successful commands and
UNREACHABLE markers for the rest:
$ cat test.t
$ echo "First command"
First command
$ echo "Second command"
Second command
$ exit 1
***** UNREACHABLE *****
$ echo "This will never execute"
***** UNREACHABLE *****
$ echo "Neither will this"
***** UNREACHABLE *****

Loading