Skip to content

Commit dd9c1a4

Browse files
committed
test(cram): partial promotions when script exits
Signed-off-by: Ali Caglayan <[email protected]>
1 parent 84e0722 commit dd9c1a4

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Test that cram tests with unreachable commands can still partially promote
2+
output from commands that executed successfully.
3+
4+
$ cat > dune-project <<EOF
5+
> (lang dune 3.21)
6+
> EOF
7+
8+
Create a test with some successful commands, then an exit, then unreachable
9+
commands:
10+
11+
$ cat > test.t <<EOF
12+
> $ echo "First command"
13+
> $ echo "Second command"
14+
> $ exit 1
15+
> $ echo "This will never execute"
16+
> $ echo "Neither will this"
17+
> EOF
18+
19+
The test should fail but still capture output from executed commands:
20+
$ dune runtest
21+
File "test.t", line 1, characters 0-0:
22+
Error: Files _build/default/test.t and _build/default/test.t.corrected
23+
differ.
24+
[1]
25+
$ dune promote
26+
Promoting _build/default/test.t.corrected to test.t.
27+
28+
After promotion, the test file should have output from successful commands and
29+
UNREACHABLE markers for the rest:
30+
$ cat test.t
31+
$ echo "First command"
32+
First command
33+
$ echo "Second command"
34+
Second command
35+
$ exit 1
36+
***** UNREACHABLE *****
37+
$ echo "This will never execute"
38+
***** UNREACHABLE *****
39+
$ echo "Neither will this"
40+
***** UNREACHABLE *****
41+

0 commit comments

Comments
 (0)