From dc928b641aa265e6a7cb3774dfe01171f3780b40 Mon Sep 17 00:00:00 2001 From: Jan Mas Rovira Date: Thu, 28 Nov 2024 19:37:20 +0100 Subject: [PATCH] add test --- test/Compilation/Positive.hs | 7 +++- tests/Compilation/positive/out/test088.out | 4 +++ tests/Compilation/positive/test088.juvix | 39 ++++++++++++++++++++++ 3 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 tests/Compilation/positive/out/test088.out create mode 100644 tests/Compilation/positive/test088.juvix diff --git a/test/Compilation/Positive.hs b/test/Compilation/Positive.hs index 1fbdc9d630..cdfd8ad9b6 100644 --- a/test/Compilation/Positive.hs +++ b/test/Compilation/Positive.hs @@ -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") ] diff --git a/tests/Compilation/positive/out/test088.out b/tests/Compilation/positive/out/test088.out new file mode 100644 index 0000000000..261015086a --- /dev/null +++ b/tests/Compilation/positive/out/test088.out @@ -0,0 +1,4 @@ +0 0 0 +6 0 0 +0 0 8 +6 7 8 diff --git a/tests/Compilation/positive/test088.juvix b/tests/Compilation/positive/test088.juvix new file mode 100644 index 0000000000..3b3e7024db --- /dev/null +++ b/tests/Compilation/positive/test088.juvix @@ -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});