mirror of
https://github.com/unisonweb/unison.git
synced 2024-08-15 13:30:27 +03:00
Fix up round-trip tests
This commit is contained in:
parent
c431d350d2
commit
69edceffdf
@ -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.
|
||||
|
||||
```ucm:hide
|
||||
.> builtins.mergeio
|
||||
scratch/a1> builtins.mergeio lib.builtins
|
||||
scratch/a2> builtins.mergeio lib.builtins
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> copy.namespace builtin a1.lib.builtin
|
||||
.> copy.namespace builtin a2.lib.builtin
|
||||
.> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
|
||||
.a1> add
|
||||
scratch/a1> load unison-src/transcripts-round-trip/reparses-with-same-hash.u
|
||||
scratch/a1> add
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -16,45 +15,40 @@ x = ()
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.a1> find
|
||||
scratch/a1> find
|
||||
```
|
||||
|
||||
So we can see the pretty-printed output:
|
||||
|
||||
```ucm
|
||||
.a1> edit 1-1000
|
||||
scratch/a1> edit 1-1000
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.a1> delete.namespace.force lib.builtin
|
||||
scratch/a1> delete.namespace.force lib.builtins
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.a2> load
|
||||
scratch/a2> load
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.a2> add
|
||||
.a2> delete.namespace.force lib.builtin
|
||||
scratch/a2> add
|
||||
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.
|
||||
|
||||
```ucm:error
|
||||
.> diff.namespace a1 a2
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> undo
|
||||
.> undo
|
||||
scratch/main> diff.namespace /a1:. /a2:.
|
||||
```
|
||||
|
||||
Now check that definitions in 'reparses.u' at least parse on round trip:
|
||||
|
||||
```ucm:hide
|
||||
.a3> copy.namespace .builtin lib.builtin
|
||||
.a3> load unison-src/transcripts-round-trip/reparses.u
|
||||
.a3> add
|
||||
scratch/a3> builtins.mergeio lib.builtins
|
||||
scratch/a3> load unison-src/transcripts-round-trip/reparses.u
|
||||
scratch/a3> add
|
||||
```
|
||||
|
||||
This just makes 'roundtrip.u' the latest scratch file.
|
||||
@ -64,37 +58,35 @@ x = ()
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.a3> find
|
||||
scratch/a3> find
|
||||
```
|
||||
|
||||
```ucm
|
||||
.a3> edit 1-5000
|
||||
scratch/a3> edit 1-5000
|
||||
```
|
||||
|
||||
```ucm:hide
|
||||
.> move.namespace a3 a3_old
|
||||
.a3> copy.namespace .builtin lib.builtin
|
||||
.a3> load
|
||||
.a3> add
|
||||
.a3> delete.namespace.force lib.builtin
|
||||
.a3_old> delete.namespace.force lib.builtin
|
||||
scratch/a3_new> builtins.mergeio lib.builtins
|
||||
scratch/a3_new> load
|
||||
scratch/a3_new> add
|
||||
scratch/a3> delete.namespace.force lib.builtins
|
||||
scratch/a3_new> delete.namespace.force lib.builtins
|
||||
```
|
||||
|
||||
These are currently all expected to have different hashes on round trip.
|
||||
|
||||
```ucm
|
||||
.> diff.namespace a3 a3_old
|
||||
scratch/main> diff.namespace /a3_new:. /a3:.
|
||||
```
|
||||
|
||||
## 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
|
||||
|
||||
```ucm:hide
|
||||
.> alias.term ##Nat.+ plus
|
||||
.> edit plus
|
||||
.> load
|
||||
.> undo
|
||||
```ucm
|
||||
scratch/regressions> alias.term ##Nat.+ plus
|
||||
scratch/regressions> edit plus
|
||||
scratch/regressions> load
|
||||
```
|
||||
|
@ -20,7 +20,7 @@ x = ()
|
||||
So we can see the pretty-printed output:
|
||||
|
||||
```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.
|
||||
|
||||
```ucm
|
||||
.> diff.namespace a1 a2
|
||||
scratch/main> diff.namespace /a1:. /a2:.
|
||||
|
||||
The namespaces are identical.
|
||||
|
||||
@ -785,7 +785,7 @@ x = ()
|
||||
```
|
||||
|
||||
```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.
|
||||
|
||||
```ucm
|
||||
.> diff.namespace a3 a3_old
|
||||
scratch/main> diff.namespace /a3_new:. /a3:.
|
||||
|
||||
Updates:
|
||||
|
||||
1. sloppyDocEval : Doc2
|
||||
1. sloppyDocEval : #ej86si0ur1
|
||||
↓
|
||||
2. sloppyDocEval : Doc2
|
||||
2. sloppyDocEval : #ej86si0ur1
|
||||
|
||||
```
|
||||
## 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
|
||||
|
||||
```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
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user