Commit e74c002
committed
feat: add
Introduce a top-level command for unit-testing pretty-printer output
from inside `.ec` files:
expect "op foo : int = 1." by print op foo.
The expected string is compared (after `String.trim` on both sides)
against the captured output of the inner `print` command. On mismatch,
raise an `hierror` with the expected and actual blocks; this fails the
enclosing script in the standard way and is picked up by `scripts/testing/runtest`.
Multi-line expected literals are supported out of the box because the
existing STRING lexer rule already accepts embedded newlines.
Also adds tests/expect.ec covering nullary/parametric ops, record
types, axioms, and leading/trailing whitespace tolerance.expect "..." by print ... command1 parent 736f20d commit e74c002
4 files changed
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
400 | 416 | | |
401 | 417 | | |
402 | 418 | | |
| |||
782 | 798 | | |
783 | 799 | | |
784 | 800 | | |
| 801 | + | |
785 | 802 | | |
786 | 803 | | |
787 | 804 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3950 | 3950 | | |
3951 | 3951 | | |
3952 | 3952 | | |
| 3953 | + | |
| 3954 | + | |
3953 | 3955 | | |
3954 | 3956 | | |
3955 | 3957 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1351 | 1351 | | |
1352 | 1352 | | |
1353 | 1353 | | |
| 1354 | + | |
1354 | 1355 | | |
1355 | 1356 | | |
1356 | 1357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
0 commit comments