Skip to content

Commit a2d3c2c

Browse files
authored
Merge pull request #5512 from unisonweb/inlining-regression-test
2 parents 8e32841 + 159c2b3 commit a2d3c2c

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,10 @@ jobs:
273273
${{env.transcripts}}
274274
# Fail if any transcripts cause git diffs.
275275
git diff --ignore-cr-at-eol --exit-code unison-src/transcripts
276+
- name: shell-based regression tests
277+
if: steps.cache-transcript-test-results.outputs.cache-hit != 'true' && runner.os == 'linux'
278+
run: |
279+
unison-src/tests/fix5507.sh ${{env.ucm}}
276280
- name: docs.to-html
277281
if: steps.cache-transcript-test-results.outputs.cache-hit != 'true'
278282
run: |

unison-src/tests/fix5507.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
```ucm :hide
2+
scratch/main> builtins.merge lib.builtin
3+
```
4+
5+
```unison :hide
6+
Nat.toBytesLittleEndian : Nat -> Bytes
7+
Nat.toBytesLittleEndian = encodeNat64le
8+
```
9+
10+
```ucm :hide
11+
scratch/main> add
12+
```
13+
14+
`Nat.toBytesLittleEndian` gets inlined, but it should still be found in the code cache when this is compiled and re-loaded.
15+
16+
```unison :hide
17+
main : '{IO} ()
18+
main = do
19+
_ = Nat.toBytesLittleEndian 3
20+
match Code.lookup (termLink Nat.toBytesLittleEndian) with
21+
Some _code -> ()
22+
None -> bug "code cache was empty"
23+
```
24+
25+
```ucm :hide
26+
scratch/main> add
27+
scratch/main> compile main fix5507
28+
```

unison-src/tests/fix5507.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env sh
2+
set -ex
3+
4+
# the first arg is the path to the unison executable
5+
if [ -z "$1" ]; then
6+
echo "Usage: $0 <path-to-ucm>"
7+
exit 1
8+
fi
9+
10+
# call unison with all its args quoted
11+
"$@" transcript unison-src/tests/fix5507.md \
12+
&& "$@" run.compiled fix5507.uc

0 commit comments

Comments
 (0)