Add a couple of interactive tests

This commit is contained in:
Edwin Brady 2019-06-24 15:16:49 +01:00
parent 881426e62a
commit 7a47c9ae0c
18 changed files with 82 additions and 11 deletions

View File

@ -4,13 +4,16 @@ Contributing to Idris 2
Contributions are welcome! The most important things needed at this stage, Contributions are welcome! The most important things needed at this stage,
beyond work on the language core, are (in no particular order): beyond work on the language core, are (in no particular order):
* CI integration * CI integration.
* Documentation string support (at the REPL and IDE mode) * Documentation string support (at the REPL and IDE mode).
* A better REPL, including: * A better REPL, including:
- readline and tab completion - readline and tab completion
- :search and :apropos - :search and :apropos
- help commands - help commands
* Further library support (please add initially into contrib/) * Further library support (please add initially into contrib/)
* Partial evaluation, especially for specialisation of interface
implementations.
* An alternative, high performance, back end. OCaml seems worth a try.
Some language extensions from Idris 1 have not yet been implemented. Most Some language extensions from Idris 1 have not yet been implemented. Most
notably: notably:

View File

@ -145,7 +145,7 @@ stMain opts
replIDE {c} {u} {m} replIDE {c} {u} {m}
else do else do
iputStrLn $ "Welcome to Idris 2 version " ++ version iputStrLn $ "Welcome to Idris 2 version " ++ version
++ ". Please be gentle." ++ ". Enjoy yourself!"
repl {c} {u} {m} repl {c} {u} {m}
else else
-- exit with an error code if there was an error, otherwise -- exit with an error code if there was an error, otherwise

View File

@ -25,6 +25,7 @@ idrisTests : List String
idrisTests idrisTests
= ["basic001", = ["basic001",
"coverage001", "coverage002", "coverage001", "coverage002",
"interactive001", "interactive002",
"import001", "import002", "import001", "import002",
"record001", "record002"] "record001", "record002"]

View File

@ -1,5 +1,5 @@
1/1: Building Vect (Vect.idr) 1/1: Building Vect (Vect.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> Main> Cons (S Z) (Cons (S (S Z)) []) : Vect (S (S Z)) Nat Main> Main> Cons (S Z) (Cons (S (S Z)) []) : Vect (S (S Z)) Nat
Main> (interactive):1:28--1:51:When unifying Vect (S (S Z)) Nat and Vect (S Z) Nat Main> (interactive):1:28--1:51:When unifying Vect (S (S Z)) Nat and Vect (S Z) Nat
Mismatch between: Mismatch between:

View File

@ -1,5 +1,5 @@
1/1: Building Vect (Vect.idr) 1/1: Building Vect (Vect.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> Main.append: Main> Main.append:
append (_ :: _) _ append (_ :: _) _
Main> Main.lookup: All cases covered Main> Main.lookup: All cases covered

View File

@ -1,5 +1,5 @@
1/1: Building Vect (Vect.idr) 1/1: Building Vect (Vect.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> Main.append: All cases covered Main> Main.append: All cases covered
Main> Main.funny: All cases covered Main> Main.funny: All cases covered
Main> Main.notFunny: Main> Main.notFunny:

View File

@ -1,10 +1,10 @@
1/3: Building Nat (Nat.idr) 1/3: Building Nat (Nat.idr)
2/3: Building Mult (Mult.idr) 2/3: Building Mult (Mult.idr)
3/3: Building Test (Test.idr) 3/3: Building Test (Test.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z))))))))))))))))) Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z)))))))))))))))))
Test> Bye for now! Test> Bye for now!
2/3: Building Mult (Mult.idr) 2/3: Building Mult (Mult.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z))))))))))))))))) Test> S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S (S Z)))))))))))))))))
Test> Bye for now! Test> Bye for now!

View File

@ -4,5 +4,5 @@
Test.idr:5:9--5:13:While processing type of Test.thing at Test.idr:5:1--6:1: Test.idr:5:9--5:13:While processing type of Test.thing at Test.idr:5:1--6:1:
Name Nat.Nat is inaccessible since Nat is not explicitly imported Name Nat.Nat is inaccessible since Nat is not explicitly imported
Test.idr:6:1--8:1:No type declaration for Test.thing Test.idr:6:1--8:1:No type declaration for Test.thing
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Test> Bye for now! Test> Bye for now!

View File

@ -0,0 +1,7 @@
data Vect : Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
append : Vect n a -> Vect m a -> Vect (n + m) a
append [] ys = ys
append (x :: xs) ys = x :: append xs ys

View File

@ -0,0 +1,12 @@
1/1: Building LocType (LocType.idr)
Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> Main.Vect : Nat -> Type -> Type
Main> 0 m : Nat
0 a : Type
0 k : Nat
xs : Vect k a
x : a
ys : Vect m a
-------------------------------------
xs : Vect k a
Main> Bye for now!

View File

@ -0,0 +1,3 @@
:typeat 1 7 Vect
:typeat 7 36 xs
:q

View File

@ -0,0 +1,3 @@
$1 LocType.idr < input
rm -rf build

View File

@ -0,0 +1,19 @@
data Vect : Nat -> Type -> Type where
Nil : Vect Z a
(::) : a -> Vect k a -> Vect (S k) a
%name Vect xs, ys, zs
append : Vect n a -> Vect m a -> Vect (n + m) a
append {n} xs ys = ?foo
vadd : Num a => Vect n a -> Vect n a -> Vect n a
vadd [] ys = ?bar
vadd (x :: xs) ys = ?baz
suc : (x : Nat) -> (y : Nat) -> x = y -> S x = S y
suc x y prf = ?quux
suc' : x = y -> S x = S y
suc' {x} {y} prf = ?quux

View File

@ -0,0 +1,14 @@
1/1: Building IEdit (IEdit.idr)
Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> append {n = Z} [] ys = ?foo_1
append {n = (S k)} (x :: xs) ys = ?foo_2
Main> vadd [] [] = ?bar_1
Main> vadd (x :: xs) (y :: ys) = ?baz_1
Main> suc x x Refl = ?quux_1
Main> suc' {x = y} {y = y} Refl = ?quux_1
Main> Bye for now!

View File

@ -0,0 +1,6 @@
:cs 8 12 xs
:cs 11 9 ys
:cs 12 16 ys
:cs 15 10 prf
:cs 18 14 prf
:q

View File

@ -0,0 +1,3 @@
$1 IEdit.idr < input
rm -rf build

View File

@ -1,5 +1,5 @@
1/1: Building Record (Record.idr) 1/1: Building Record (Record.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> [1, 2, 3, 4, 5] Main> [1, 2, 3, 4, 5]
Main> [1, 2, 3, 4, 5] Main> [1, 2, 3, 4, 5]
Main> some_fn testPerson : Nat -> Nat Main> some_fn testPerson : Nat -> Nat

View File

@ -1,5 +1,5 @@
1/1: Building Record (Record.idr) 1/1: Building Record (Record.idr)
Welcome to Idris 2 version 0.0. Please be gentle. Welcome to Idris 2 version 0.0. Enjoy yourself!
Main> MkPerson "Fred" 1337 10 (MkStats 11 10) Main> MkPerson "Fred" 1337 10 (MkStats 11 10)
Main> MkPerson "Fred" 1337 10 (MkStats 12 10) Main> MkPerson "Fred" 1337 10 (MkStats 12 10)
Main> MkMyDPair (S (S (S (S (S (S Z)))))) [10, 1, 2, 3, 4, 5] Main> MkMyDPair (S (S (S (S (S (S Z)))))) [10, 1, 2, 3, 4, 5]