unison/unison-src/transcripts-round-trip/main.md

1.8 KiB

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.

.> builtins.mergeio
.> 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
x = ()
.a1> find

So we can see the pretty-printed output:

.a1> edit 1-1000
.a1> delete.namespace.force lib.builtin
.a2> load
.a2> add
.a2> delete.namespace.force lib.builtin

This diff should be empty if the two namespaces are equivalent. If it's nonempty, the diff will show us the hashes that differ.

.> diff.namespace a1 a2
.> undo
.> undo

Now check that definitions in 'reparses.u' at least parse on round trip:

.a3> copy.namespace .builtin lib.builtin
.a3> load unison-src/transcripts-round-trip/reparses.u
.a3> add

This just makes 'roundtrip.u' the latest scratch file.

x = ()
.a3> find
.a3> edit 1-5000
.> 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

These are currently all expected to have different hashes on round trip.

.> diff.namespace a3 a3_old

Other regression tests not covered by above

Comment out builtins in the edit command

Regression test for https://github.com/unisonweb/unison/pull/3548

.> alias.term ##Nat.+ plus
.> edit plus
.> load
.> undo