Skip to content

Commit

Permalink
read LICENSE instead of README.md in tests
Browse files Browse the repository at this point in the history
the README is more likely to change and break tests than the LICENSE
file.
  • Loading branch information
enricozb committed Aug 5, 2024
1 parent 9c58be2 commit 6506a98
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 49 deletions.
4 changes: 2 additions & 2 deletions examples/demo_io/main.bend
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def unwrap(res):
return res.val

def open():
return call("OPEN", ("./README.md", "r"))
return call("OPEN", ("./LICENSE", "r"))

def read(f):
return call("READ", (f, 30))
return call("READ", (f, 47))

def print(bytes):
with IO:
Expand Down
26 changes: 12 additions & 14 deletions examples/demo_io/main.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,22 @@
& @IO/bind ~ (h ((((i i) (k l)) l) m))
& @close ~ (g h)

@open = q
& @call ~ (d ((o p) q))
@open = o
& @call ~ (d ((m n) o))
& @String/Cons ~ (79 (c d))
& @String/Cons ~ (80 (b c))
& @String/Cons ~ (69 (a b))
& @String/Cons ~ (78 (@String/Nil a))
& @String/Cons ~ (46 (n o))
& @String/Cons ~ (47 (m n))
& @String/Cons ~ (82 (l m))
& @String/Cons ~ (69 (k l))
& @String/Cons ~ (65 (j k))
& @String/Cons ~ (68 (i j))
& @String/Cons ~ (77 (h i))
& @String/Cons ~ (46 (l m))
& @String/Cons ~ (47 (k l))
& @String/Cons ~ (76 (j k))
& @String/Cons ~ (73 (i j))
& @String/Cons ~ (67 (h i))
& @String/Cons ~ (69 (g h))
& @String/Cons ~ (46 (f g))
& @String/Cons ~ (109 (e f))
& @String/Cons ~ (100 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil p))
& @String/Cons ~ (78 (f g))
& @String/Cons ~ (83 (e f))
& @String/Cons ~ (69 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil n))

@print = (f h)
& @IO/bind ~ (g (@print__C3 h))
Expand Down Expand Up @@ -100,7 +98,7 @@
@print__C3 = ((@print__C2 (@IO/wrap a)) a)

@read = (e f)
& @call ~ (d ((e 30) f))
& @call ~ (d ((e 47) f))
& @String/Cons ~ (82 (c d))
& @String/Cons ~ (69 (b c))
& @String/Cons ~ (65 (a b))
Expand Down
4 changes: 2 additions & 2 deletions tests/programs/io/basic.bend
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def unwrap(res):
return res.val

def open():
return call("OPEN", ("./README.md", "r"))
return call("OPEN", ("./LICENSE", "r"))

def read(f):
return call("READ", (f, 30))
return call("READ", (f, 47))

def print(bytes):
with IO:
Expand Down
26 changes: 12 additions & 14 deletions tests/programs/io/basic.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,22 @@
& @IO/bind ~ (h ((((i i) (k l)) l) m))
& @close ~ (g h)

@open = q
& @call ~ (d ((o p) q))
@open = o
& @call ~ (d ((m n) o))
& @String/Cons ~ (79 (c d))
& @String/Cons ~ (80 (b c))
& @String/Cons ~ (69 (a b))
& @String/Cons ~ (78 (@String/Nil a))
& @String/Cons ~ (46 (n o))
& @String/Cons ~ (47 (m n))
& @String/Cons ~ (82 (l m))
& @String/Cons ~ (69 (k l))
& @String/Cons ~ (65 (j k))
& @String/Cons ~ (68 (i j))
& @String/Cons ~ (77 (h i))
& @String/Cons ~ (46 (l m))
& @String/Cons ~ (47 (k l))
& @String/Cons ~ (76 (j k))
& @String/Cons ~ (73 (i j))
& @String/Cons ~ (67 (h i))
& @String/Cons ~ (69 (g h))
& @String/Cons ~ (46 (f g))
& @String/Cons ~ (109 (e f))
& @String/Cons ~ (100 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil p))
& @String/Cons ~ (78 (f g))
& @String/Cons ~ (83 (e f))
& @String/Cons ~ (69 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil n))

@print = (f h)
& @IO/bind ~ (g (@print__C3 h))
Expand Down Expand Up @@ -100,7 +98,7 @@
@print__C3 = ((@print__C2 (@IO/wrap a)) a)

@read = (e f)
& @call ~ (d ((e 30) f))
& @call ~ (d ((e 47) f))
& @String/Cons ~ (82 (c d))
& @String/Cons ~ (69 (b c))
& @String/Cons ~ (65 (a b))
Expand Down
2 changes: 1 addition & 1 deletion tests/programs/io/open1.bend
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ test-io = 1

def main():
with IO:
f <- call("OPEN", ("./README.md", "r"))
f <- call("OPEN", ("./LICENSE", "r"))

return wrap(f)
26 changes: 12 additions & 14 deletions tests/programs/io/open1.hvm
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,23 @@
@call__C0 = a
& @IO/Done ~ (@IO/MAGIC a)

@main = u
& @IO/bind ~ (q ((((r r) (@IO/wrap t)) t) u))
& @call ~ (d ((o p) q))
@main = s
& @IO/bind ~ (o ((((p p) (@IO/wrap r)) r) s))
& @call ~ (d ((m n) o))
& @String/Cons ~ (79 (c d))
& @String/Cons ~ (80 (b c))
& @String/Cons ~ (69 (a b))
& @String/Cons ~ (78 (@String/Nil a))
& @String/Cons ~ (46 (n o))
& @String/Cons ~ (47 (m n))
& @String/Cons ~ (82 (l m))
& @String/Cons ~ (69 (k l))
& @String/Cons ~ (65 (j k))
& @String/Cons ~ (68 (i j))
& @String/Cons ~ (77 (h i))
& @String/Cons ~ (46 (l m))
& @String/Cons ~ (47 (k l))
& @String/Cons ~ (76 (j k))
& @String/Cons ~ (73 (i j))
& @String/Cons ~ (67 (h i))
& @String/Cons ~ (69 (g h))
& @String/Cons ~ (46 (f g))
& @String/Cons ~ (109 (e f))
& @String/Cons ~ (100 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil p))
& @String/Cons ~ (78 (f g))
& @String/Cons ~ (83 (e f))
& @String/Cons ~ (69 (@String/Nil e))
& @String/Cons ~ (114 (@String/Nil n))

@test-io = 1

Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/run__io_file@demo_io__main.hvm.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: tests/run.rs
expression: c_output
input_file: examples/demo_io/main.hvm
---
Higher-order Virtual Machine 2
Apache License
Result: ((@IO/Done/tag (@IO/MAGIC (((0 (* x0)) x0) x1))) x1)
2 changes: 1 addition & 1 deletion tests/snapshots/run__io_file@io__basic.hvm.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source: tests/run.rs
expression: c_output
input_file: tests/programs/io/basic.hvm
---
Higher-order Virtual Machine 2
Apache License
Result: ((@IO/Done/tag (@IO/MAGIC (((0 (* x0)) x0) x1))) x1)

0 comments on commit 6506a98

Please sign in to comment.