Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Nov 13, 2024
1 parent 5e5557d commit 2f10ba8
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test/Termination/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,15 @@ tests =
PosTest
"Ignore instance arguments"
$(mkRelDir ".")
$(mkRelFile "issue2414.juvix")
$(mkRelFile "issue2414.juvix"),
PosTest
"Nested local definitions"
$(mkRelDir ".")
$(mkRelFile "Nested1.juvix"),
PosTest
"Named arguments"
$(mkRelDir ".")
$(mkRelFile "Nested2.juvix")
]

testsWithKeyword :: [PosTest]
Expand Down
11 changes: 11 additions & 0 deletions tests/positive/Termination/Nested1.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Nested1;

import Stdlib.Data.List open;

go {A B} (f : A -> B) : List A -> List B
| nil := nil
| (elem :: next) :=
let
var1 := f elem;
var2 := go f next;
in var1 :: var2;
16 changes: 16 additions & 0 deletions tests/positive/Termination/Nested2.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module Nested2;

type MyList A :=
| myNil
| myCons@{
elem : A;
next : MyList A;
};

go {A B} (f : A -> B) : MyList A -> MyList B
| myNil := myNil
| myCons@{elem; next} :=
myCons@{
elem := f elem;
next := go f next;
};

0 comments on commit 2f10ba8

Please sign in to comment.