Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
janmasrovira committed Nov 29, 2024
1 parent 0e28ccf commit 110b7d6
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/Compilation/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -510,5 +510,10 @@ tests =
"Test087: Deriving Ord"
$(mkRelDir ".")
$(mkRelFile "test087.juvix")
$(mkRelFile "out/test087.out")
$(mkRelFile "out/test087.out"),
posTest
"Test088: Record update pun"
$(mkRelDir ".")
$(mkRelFile "test088.juvix")
$(mkRelFile "out/test088.out")
]
4 changes: 4 additions & 0 deletions tests/Compilation/positive/out/test088.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
0 0 0
6 0 0
0 0 8
6 7 8
39 changes: 39 additions & 0 deletions tests/Compilation/positive/test088.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
-- Record update pun
module test088;

import Stdlib.Prelude open;
import Stdlib.System.IO open;

type R :=
mkR@{
a : Nat;
b : Nat;
c : Nat;
};

instance
RShowI : Show R :=
mkShow@{
show (r : R) : String :=
Show.show (R.a r)
++str " "
++str Show.show (R.b r)
++str " "
++str Show.show (R.c r);
};

main : IO :=
let
z :=
mkR@{
a := 0;
b := 0;
c := 0;
};
a := 6;
b := 7;
c := 8;
in printLn z
>>> printLn (z @R{a})
>>> printLn (z @R{c})
>>> printLn (z @R{a; b; c});

0 comments on commit 110b7d6

Please sign in to comment.