[ test ] add test for defaulting peculiarity (#376)

This commit is contained in:
G. Allais 2020-05-16 00:43:17 +01:00 committed by GitHub
parent 6f4a36e84b
commit 306aea32b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 1 deletions

View File

@ -34,7 +34,7 @@ idrisTests
"basic021", "basic022", "basic023", "basic024", "basic025",
"basic026", "basic027", "basic028", "basic029", "basic030",
"basic031", "basic032", "basic033", "basic034", "basic035",
"basic036", "basic037", "basic038", "basic039",
"basic036", "basic037", "basic038", "basic039", "basic040",
-- Coverage checking
"coverage001", "coverage002", "coverage003", "coverage004",
"coverage005", "coverage006",

View File

@ -0,0 +1,21 @@
module Default
happyPairs : List (Nat, Char)
happyPairs = map (uncurry $ \ c, n => (n, c)) [('a', 1)]
-- In Idris1 `sadPairs` is rejected with the following error:
-- |
-- 10 | sadPairs = map (\ (c, n) => (n, c)) [('a', 1)]
-- | ~~
-- When checking right hand side of Default.case block in sadPairs at Default.idr:10:19-24 with expected type
-- (Nat, Char)
-- When checking argument a to constructor Builtins.MkPair:
-- Type mismatch between
-- Integer (Type of n)
-- and
-- Nat (Expected type)
sadPairs : List (Nat, Char)
sadPairs = map (\ (c, n) => (n, c)) [('a', 1)]

View File

@ -0,0 +1,2 @@
1/1: Building Default (Default.idr)
Default> Bye for now!

3
tests/idris2/basic040/run Executable file
View File

@ -0,0 +1,3 @@
echo ":q" | $1 --no-banner Default.idr
rm -rf build