on master help sign in
Add a test for interactive features of REPL
commit3dfae1864f39d0c15ff6e4199d061d0a9a061fb2 authorEdwin Brady <ecb10@st-andrews.ac.uk> dateWed 30 Oct 2013, 08:32 (13 years ago) parent5b10b97
5 files changed+53−1
src/Idris/REPL.hs+1−1 test/test032/expected+12 test/test032/input+5 test/test032/run+3 test/test032/test032.idr+32
src/Idris/REPL.hs+1−1
@@ -546,7 +546,7 @@ process h fn (CaseSplitAt updatefile l n)
546546 do let fb = fn ++ "~" -- make a backup!
547547 runIO $ writeFile fb (unlines before ++ new ++ unlines later)
548548 runIO $ copyFile fb fn
549− else do ihputStrLn h (show res)
549+ else -- do ihputStrLn h (show res)
550550 ihputStrLn h new
551551process h fn (AddClauseFrom updatefile l n)
552552 = do src <- runIO $ readFile fn
test/test032/expectednew file+12
@@ -0,0 +1,12 @@
1+Type checking ./test032.idr
2+isElem x [] = ?isElem_rhs_1
3+isElem x (_ :: _) = ?isElem_rhs_3
4+
5+ localZipWith f (_ :: _) ys = ?localZipWith_rhs_1
6+ localZipWith f (_ :: _) ys = ?localZipWith_rhs_2
7+
8+f x :: (map f xs)
9+isElem2 x (y :: ys) with (_)
10+ isElem2 x (y :: ys) | with_pat = ?isElem2_rhs
11+ isElem3 x (x :: ys) | (Yes refl) = ?isElem3_rhs_3
12+
test/test032/inputnew file+5
@@ -0,0 +1,5 @@
1+:cs 11 xs
2+:cs 17 xs
3+:ps 21 maprhs
4+:mw 25 isElem2
5+:cs 30 p
test/test032/runnew file+3
@@ -0,0 +1,3 @@
1+#!/bin/bash
2+idris --quiet test032.idr < input
3+rm -f *.ibc
test/test032/test032.idrnew file+32
@@ -0,0 +1,32 @@
1+module elem
2+
3+import Decidable.Equality
4+
5+using (xs : List a)
6+ data Elem : a -> List a -> Type where
7+ Here : Elem x (x :: xs)
8+ There : Elem x xs -> Elem x (y :: xs)
9+
10+isElem : (x : Nat) -> (xs : List Nat) -> Maybe (Elem x xs)
11+isElem x xs = ?isElem_rhs
12+
13+vadd : Num a => Vect n a -> Vect n a -> Vect n a
14+vadd xs ys = localZipWith (+) xs ys where
15+ localZipWith : (a -> b -> c) -> Vect n a -> Vect n b -> Vect n c
16+ localZipWith f [] [] = []
17+ localZipWith f (_ :: _) ys = ?localZipWith_rhs
18+
19+map : (a -> b) -> Vect n a -> Vect n b
20+map f [] = []
21+map f (x :: xs) = ?maprhs
22+
23+isElem2 : (x : Nat) -> (xs : List Nat) -> Maybe (Elem x xs)
24+isElem2 x [] = Nothing
25+isElem2 x (y :: ys) = ?isElem_rhs_2
26+
27+isElem3 : (x : Nat) -> (xs : List Nat) -> Maybe (Elem x xs)
28+isElem3 x [] = Nothing
29+isElem3 x (y :: ys) with (decEq x y)
30+ isElem3 x (y :: ys) | (Yes p) = ?isElem3_rhs_1
31+ isElem3 x (y :: ys) | (No _) = ?isElem3_rhs_2
32+