Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add shell-based regression-tests #5512

Merged
merged 2 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ jobs:
${{env.transcripts}}
# Fail if any transcripts cause git diffs.
git diff --ignore-cr-at-eol --exit-code unison-src/transcripts
- name: shell-based regression tests
if: steps.cache-transcript-test-results.outputs.cache-hit != 'true' && runner.os == 'linux'
run: |
unison-src/tests/fix5507.sh ${{env.ucm}}
- name: docs.to-html
if: steps.cache-transcript-test-results.outputs.cache-hit != 'true'
run: |
Expand Down
28 changes: 28 additions & 0 deletions unison-src/tests/fix5507.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
```ucm :hide
scratch/main> builtins.merge lib.builtin
```

```unison :hide
Nat.toBytesLittleEndian : Nat -> Bytes
Nat.toBytesLittleEndian = encodeNat64le
```

```ucm :hide
scratch/main> add
```

`Nat.toBytesLittleEndian` gets inlined, but it should still be found in the code cache when this is compiled and re-loaded.

```unison :hide
main : '{IO} ()
main = do
_ = Nat.toBytesLittleEndian 3
match Code.lookup (termLink Nat.toBytesLittleEndian) with
Some _code -> ()
None -> bug "code cache was empty"
```

```ucm :hide
scratch/main> add
scratch/main> compile main fix5507
```
12 changes: 12 additions & 0 deletions unison-src/tests/fix5507.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh
set -ex

# the first arg is the path to the unison executable
if [ -z "$1" ]; then
echo "Usage: $0 <path-to-ucm>"
exit 1
fi

# call unison with all its args quoted
"$@" transcript unison-src/tests/fix5507.md \
&& "$@" run.compiled fix5507.uc
Loading