Fix up round-trip tests

This commit is contained in:
Chris Penner 2024-07-05 18:02:05 -07:00
parent c431d350d2
commit 69edceffdf
2 changed files with 59 additions and 42 deletions

View File

@ -1,14 +1,13 @@
This transcript verifies that the pretty-printer produces code that can be successfully parsed, for a variety of examples. Terms or types that fail to round-trip can be added to either `reparses-with-same-hash.u` or `reparses.u` as regression tests. This transcript verifies that the pretty-printer produces code that can be successfully parsed, for a variety of examples. Terms or types that fail to round-trip can be added to either `reparses-with-same-hash.u` or `reparses.u` as regression tests.
```ucm:hide ```ucm:hide
.> builtins.mergeio scratch/a1> builtins.mergeio lib.builtins
scratch/a2> builtins.mergeio lib.builtins
``` ```
```ucm:hide ```ucm:hide
.> copy.namespace builtin a1.lib.builtin scratch/a1> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
.> copy.namespace builtin a2.lib.builtin scratch/a1> add
.> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
.a1> add
``` ```
```unison ```unison
@ -16,45 +15,40 @@ x = ()
``` ```
```ucm:hide ```ucm:hide
.a1> find scratch/a1> find
``` ```
So we can see the pretty-printed output: So we can see the pretty-printed output:
```ucm ```ucm
.a1> edit 1-1000 scratch/a1> edit 1-1000
``` ```
```ucm:hide ```ucm:hide
.a1> delete.namespace.force lib.builtin scratch/a1> delete.namespace.force lib.builtins
``` ```
```ucm:hide ```ucm:hide
.a2> load scratch/a2> load
``` ```
```ucm:hide ```ucm:hide
.a2> add scratch/a2> add
.a2> delete.namespace.force lib.builtin scratch/a2> delete.namespace.force lib.builtins
``` ```
This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ. This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ.
```ucm:error ```ucm:error
.> diff.namespace a1 a2 scratch/main> diff.namespace /a1:. /a2:.
```
```ucm:hide
.> undo
.> undo
``` ```
Now check that definitions in 'reparses.u' at least parse on round trip: Now check that definitions in 'reparses.u' at least parse on round trip:
```ucm:hide ```ucm:hide
.a3> copy.namespace .builtin lib.builtin scratch/a3> builtins.mergeio lib.builtins
.a3> load unison-src/transcripts-round-trip/reparses.u scratch/a3> load unison-src/transcripts-round-trip/reparses.u
.a3> add scratch/a3> add
``` ```
This just makes 'roundtrip.u' the latest scratch file. This just makes 'roundtrip.u' the latest scratch file.
@ -64,37 +58,35 @@ x = ()
``` ```
```ucm:hide ```ucm:hide
.a3> find scratch/a3> find
``` ```
```ucm ```ucm
.a3> edit 1-5000 scratch/a3> edit 1-5000
``` ```
```ucm:hide ```ucm:hide
.> move.namespace a3 a3_old scratch/a3_new> builtins.mergeio lib.builtins
.a3> copy.namespace .builtin lib.builtin scratch/a3_new> load
.a3> load scratch/a3_new> add
.a3> add scratch/a3> delete.namespace.force lib.builtins
.a3> delete.namespace.force lib.builtin scratch/a3_new> delete.namespace.force lib.builtins
.a3_old> delete.namespace.force lib.builtin
``` ```
These are currently all expected to have different hashes on round trip. These are currently all expected to have different hashes on round trip.
```ucm ```ucm
.> diff.namespace a3 a3_old scratch/main> diff.namespace /a3_new:. /a3:.
``` ```
## Other regression tests not covered by above ## Other regression tests not covered by above
### Comment out builtins in the edit command ### Builtins should appear commended out in the edit command
Regression test for https://github.com/unisonweb/unison/pull/3548 Regression test for https://github.com/unisonweb/unison/pull/3548
```ucm:hide ```ucm
.> alias.term ##Nat.+ plus scratch/regressions> alias.term ##Nat.+ plus
.> edit plus scratch/regressions> edit plus
.> load scratch/regressions> load
.> undo
``` ```

View File

@ -20,7 +20,7 @@ x = ()
So we can see the pretty-printed output: So we can see the pretty-printed output:
```ucm ```ucm
.a1> edit 1-1000 scratch/a1> edit 1-1000
☝️ ☝️
@ -771,7 +771,7 @@ a |> f = f a
This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ. This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ.
```ucm ```ucm
.> diff.namespace a1 a2 scratch/main> diff.namespace /a1:. /a2:.
The namespaces are identical. The namespaces are identical.
@ -785,7 +785,7 @@ x = ()
``` ```
```ucm ```ucm
.a3> edit 1-5000 scratch/a3> edit 1-5000
☝️ ☝️
@ -820,18 +820,43 @@ sloppyDocEval =
These are currently all expected to have different hashes on round trip. These are currently all expected to have different hashes on round trip.
```ucm ```ucm
.> diff.namespace a3 a3_old scratch/main> diff.namespace /a3_new:. /a3:.
Updates: Updates:
1. sloppyDocEval : Doc2 1. sloppyDocEval : #ej86si0ur1
2. sloppyDocEval : Doc2 2. sloppyDocEval : #ej86si0ur1
``` ```
## Other regression tests not covered by above ## Other regression tests not covered by above
### Comment out builtins in the edit command ### Builtins should appear commended out in the edit command
Regression test for https://github.com/unisonweb/unison/pull/3548 Regression test for https://github.com/unisonweb/unison/pull/3548
```ucm
scratch/regressions> alias.term ##Nat.+ plus
Done.
scratch/regressions> edit plus
☝️
I added 1 definitions to the top of scratch.u
You can edit them there, then run `update` to replace the
definitions currently in this namespace.
scratch/regressions> load
Loading changes detected in scratch.u.
I loaded scratch.u and didn't find anything.
```
```unison:added-by-ucm scratch.u
-- builtin plus : ##Nat -> ##Nat -> ##Nat
```