summaryrefslogtreecommitdiff
path: root/testsuite/tests/programs/jq_readsPrec
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/programs/jq_readsPrec')
-rw-r--r--testsuite/tests/programs/jq_readsPrec/Main.hs20
-rw-r--r--testsuite/tests/programs/jq_readsPrec/Makefile3
-rw-r--r--testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdin1
-rw-r--r--testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdout1
-rw-r--r--testsuite/tests/programs/jq_readsPrec/test.T6
5 files changed, 31 insertions, 0 deletions
diff --git a/testsuite/tests/programs/jq_readsPrec/Main.hs b/testsuite/tests/programs/jq_readsPrec/Main.hs
new file mode 100644
index 0000000000..360a411ef0
--- /dev/null
+++ b/testsuite/tests/programs/jq_readsPrec/Main.hs
@@ -0,0 +1,20 @@
+module Main where
+
+data Vertex = V Int deriving (Read, Show)
+
+main = do
+ userInput <- getContents
+ (parseVertex.lines) userInput report
+
+report::Vertex -> IO ()
+report int = putStr (show int)
+
+parseVertex::[String] -> (Vertex -> IO ()) -> IO ()
+parseVertex inputLines cont
+ = case inputLines of
+ (l1:rest) -> case (reads l1) of
+ [(x,"")] -> cont x
+ other -> putStr
+ ((showString "Error - retype the edges\n". shows other) "")
+ _ -> putStr "No Vertex"
+
diff --git a/testsuite/tests/programs/jq_readsPrec/Makefile b/testsuite/tests/programs/jq_readsPrec/Makefile
new file mode 100644
index 0000000000..9101fbd40a
--- /dev/null
+++ b/testsuite/tests/programs/jq_readsPrec/Makefile
@@ -0,0 +1,3 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
diff --git a/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdin b/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdin
new file mode 100644
index 0000000000..8cc78bf4cd
--- /dev/null
+++ b/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdin
@@ -0,0 +1 @@
+(V 1)
diff --git a/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdout b/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdout
new file mode 100644
index 0000000000..725c38e559
--- /dev/null
+++ b/testsuite/tests/programs/jq_readsPrec/jq_readsPrec.stdout
@@ -0,0 +1 @@
+V 1 \ No newline at end of file
diff --git a/testsuite/tests/programs/jq_readsPrec/test.T b/testsuite/tests/programs/jq_readsPrec/test.T
new file mode 100644
index 0000000000..393f82c4b3
--- /dev/null
+++ b/testsuite/tests/programs/jq_readsPrec/test.T
@@ -0,0 +1,6 @@
+
+test('jq_readsPrec',
+ [skip_if_fast, extra_clean(['Main.hi', 'Main.o'])],
+ multimod_compile_and_run,
+ ['Main', ''])
+