-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
module Compilation where | ||
|
||
import Base | ||
import Compilation.Negative qualified as N | ||
import Compilation.Positive qualified as P | ||
|
||
allTests :: TestTree | ||
allTests = testGroup "Juvix compilation pipeline tests" [P.allTests] | ||
allTests = testGroup "Juvix compilation pipeline tests" [P.allTests, N.allTests] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module Compilation.Negative where | ||
|
||
import Base | ||
import Compilation.Base | ||
|
||
data NegTest = NegTest | ||
{ _name :: String, | ||
_relDir :: Path Rel Dir, | ||
_file :: Path Rel File | ||
} | ||
|
||
root :: Path Abs Dir | ||
root = relToProject $(mkRelDir "tests/Compilation/negative") | ||
|
||
testDescr :: NegTest -> TestDescr | ||
testDescr NegTest {..} = | ||
let tRoot = root <//> _relDir | ||
file' = tRoot <//> _file | ||
in TestDescr | ||
{ _testName = _name, | ||
_testRoot = tRoot, | ||
_testAssertion = Steps $ compileErrorAssertion file' | ||
} | ||
|
||
allTests :: TestTree | ||
allTests = | ||
testGroup | ||
"Juvix compilation pipeline negative tests" | ||
(map (mkTest . testDescr) tests) | ||
|
||
tests :: [NegTest] | ||
tests = | ||
[ NegTest | ||
"Pattern matching coverage" | ||
$(mkRelDir ".") | ||
$(mkRelFile "test001.juvix") | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
-- pattern matching coverage | ||
module test001; | ||
|
||
open import Stdlib.Prelude; | ||
|
||
f : List Nat -> List Nat -> Nat; | ||
f (x :: xs) (y :: ys) := x + y; | ||
f _ (_ :: (z :: zs)) := z; | ||
f _ nil := 0; | ||
|
||
main : Nat; | ||
main := f (1 :: nil) (2 :: nil); | ||
|
||
end; |