on master help sign in
Interpreter tests (#3747)

* Test I/O and file operations.

commit515ac42bfbbffffa8a10eb376ea61e89b38c5a4a authorChris Ford <christophertford@gmail.com> dateTue 18 Apr 2017, 07:54 (9 years ago) parent502ad1f
10 files changed+32
test/TestData.hs+3 test/interpret001/double-echo.idr+6 test/interpret001/expected+2 test/interpret001/input+2 test/interpret001/run+3 test/interpret002/expected+4 test/interpret002/file-error.idr+6 test/interpret002/input+2 test/interpret002/readable.txt+1 test/interpret002/run+3
test/TestData.hs+3
@@ -162,6 +162,9 @@ testFamiliesData = [
162162-- ( 5, ANY ),
163163 ( 6, ANY ),
164164 ( 7, ANY )]),
165+ ("interpret", "Interpret",
166+ [ ( 1, ANY ),
167+ ( 2, ANY )]),
165168 ("io", "IO monad",
166169 [ ( 1, C_CG ),
167170 ( 2, ANY ),
test/interpret001/double-echo.idrnew file+6
@@ -0,0 +1,6 @@
1+module Main
2+
3+main : IO ()
4+main = do l <- getLine
5+ let ll = l ++ l
6+ putStrLn ll
test/interpret001/expectednew file+2
@@ -0,0 +1,2 @@
1+testtest
2+MkIO (\w => prim_io_pure ()) : IO' (MkFFI C_Types String String) ()
test/interpret001/inputnew file+2
@@ -0,0 +1,2 @@
1+:x main
2+test
test/interpret001/runnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ --quiet --port none --nocolour double-echo.idr < input
3+rm -f *.ibc
test/interpret002/expectednew file+4
@@ -0,0 +1,4 @@
1+File Not Found
2+MkIO (\w => prim_io_pure ()) : IO' (MkFFI C_Types String String) ()
3+"readable"
4+MkIO (\w => prim_io_pure ()) : IO' (MkFFI C_Types String String) ()
test/interpret002/file-error.idrnew file+6
@@ -0,0 +1,6 @@
1+module Main
2+
3+echo : String -> IO ()
4+echo name = do Right contents <- readFile name
5+ | Left error => printLn error
6+ printLn contents
test/interpret002/inputnew file+2
@@ -0,0 +1,2 @@
1+:x echo "not a file"
2+:x echo "readable.txt"
test/interpret002/readable.txtnew file+1
@@ -0,0 +1 @@
1+readable
test/interpret002/runnew file+3
@@ -0,0 +1,3 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ --quiet --port none --nocolour file-error.idr < input
3+rm -f *.ibc