mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-12-24 05:12:29 +03:00
Add a couple of interactive tests
This commit is contained in:
parent
881426e62a
commit
7a47c9ae0c
@ -4,13 +4,16 @@ Contributing to Idris 2
|
||||
Contributions are welcome! The most important things needed at this stage,
|
||||
beyond work on the language core, are (in no particular order):
|
||||
|
||||
* CI integration
|
||||
* Documentation string support (at the REPL and IDE mode)
|
||||
* CI integration.
|
||||
* Documentation string support (at the REPL and IDE mode).
|
||||
* A better REPL, including:
|
||||
- readline and tab completion
|
||||
- :search and :apropos
|
||||
- help commands
|
||||
* 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
|
||||
notably:
|
||||
|
@ -145,7 +145,7 @@ stMain opts
|
||||
replIDE {c} {u} {m}
|
||||
else do
|
||||
iputStrLn $ "Welcome to Idris 2 version " ++ version
|
||||
++ ". Please be gentle."
|
||||
++ ". Enjoy yourself!"
|
||||
repl {c} {u} {m}
|
||||
else
|
||||
-- exit with an error code if there was an error, otherwise
|
||||
|
@ -25,6 +25,7 @@ idrisTests : List String
|
||||
idrisTests
|
||||
= ["basic001",
|
||||
"coverage001", "coverage002",
|
||||
"interactive001", "interactive002",
|
||||
"import001", "import002",
|
||||
"record001", "record002"]
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
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> (interactive):1:28--1:51:When unifying Vect (S (S Z)) Nat and Vect (S Z) Nat
|
||||
Mismatch between:
|
||||
|
@ -1,5 +1,5 @@
|
||||
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:
|
||||
append (_ :: _) _
|
||||
Main> Main.lookup: All cases covered
|
||||
|
@ -1,5 +1,5 @@
|
||||
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.funny: All cases covered
|
||||
Main> Main.notFunny:
|
||||
|
@ -1,10 +1,10 @@
|
||||
1/3: Building Nat (Nat.idr)
|
||||
2/3: Building Mult (Mult.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> Bye for now!
|
||||
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> Bye for now!
|
||||
|
@ -4,5 +4,5 @@
|
||||
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
|
||||
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!
|
||||
|
7
tests/idris2/interactive001/LocType.idr
Normal file
7
tests/idris2/interactive001/LocType.idr
Normal 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
|
12
tests/idris2/interactive001/expected
Normal file
12
tests/idris2/interactive001/expected
Normal 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!
|
3
tests/idris2/interactive001/input
Normal file
3
tests/idris2/interactive001/input
Normal file
@ -0,0 +1,3 @@
|
||||
:typeat 1 7 Vect
|
||||
:typeat 7 36 xs
|
||||
:q
|
3
tests/idris2/interactive001/run
Executable file
3
tests/idris2/interactive001/run
Executable file
@ -0,0 +1,3 @@
|
||||
$1 LocType.idr < input
|
||||
|
||||
rm -rf build
|
19
tests/idris2/interactive002/IEdit.idr
Normal file
19
tests/idris2/interactive002/IEdit.idr
Normal 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
|
||||
|
14
tests/idris2/interactive002/expected
Normal file
14
tests/idris2/interactive002/expected
Normal 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!
|
6
tests/idris2/interactive002/input
Normal file
6
tests/idris2/interactive002/input
Normal 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
|
3
tests/idris2/interactive002/run
Executable file
3
tests/idris2/interactive002/run
Executable file
@ -0,0 +1,3 @@
|
||||
$1 IEdit.idr < input
|
||||
|
||||
rm -rf build
|
@ -1,5 +1,5 @@
|
||||
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> some_fn testPerson : Nat -> Nat
|
||||
|
@ -1,5 +1,5 @@
|
||||
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 12 10)
|
||||
Main> MkMyDPair (S (S (S (S (S (S Z)))))) [10, 1, 2, 3, 4, 5]
|
||||
|
Loading…
Reference in New Issue
Block a user