summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2012-03-01 13:57:54 +0000
committerIan Lynagh <igloo@earth.li>2012-03-01 13:57:54 +0000
commitfbfa8f482e9751c125886c86f91eefc6b83ffcb9 (patch)
tree67ffbb14a62492ac052500b4fe4a65c9dac4f740
parent1752a9b3f6b2bb48fb945dc0fda52c016e0e694a (diff)
downloadhaskell-fbfa8f482e9751c125886c86f91eefc6b83ffcb9.tar.gz
Add a test for reading Doubles
-rw-r--r--libraries/base/tests/all.T1
-rw-r--r--libraries/base/tests/readDouble001.hs11
-rw-r--r--libraries/base/tests/readDouble001.stdout6
3 files changed, 18 insertions, 0 deletions
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index 4b7d9053d5..7addfd18db 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -18,6 +18,7 @@ test('unicode002',
[''])
test('data-fixed-show-read', normal, compile_and_run, [''])
test('showDouble', normal, compile_and_run, [''])
+test('readDouble001', normal, compile_and_run, [''])
test('hash001', normal, compile_and_run, [''])
test('lex001', normal, compile_and_run, [''])
test('take001', extra_run_opts('1'), compile_and_run, [''])
diff --git a/libraries/base/tests/readDouble001.hs b/libraries/base/tests/readDouble001.hs
new file mode 100644
index 0000000000..f111ac5a54
--- /dev/null
+++ b/libraries/base/tests/readDouble001.hs
@@ -0,0 +1,11 @@
+
+main :: IO ()
+main = do f "Infinity"
+ f "-Infinity"
+ f " - Infinity "
+ f "NaN"
+ f "-NaN"
+ f " - NaN "
+
+f :: String -> IO ()
+f str = print (reads str :: [(Double, String)])
diff --git a/libraries/base/tests/readDouble001.stdout b/libraries/base/tests/readDouble001.stdout
new file mode 100644
index 0000000000..ddbbe1e88b
--- /dev/null
+++ b/libraries/base/tests/readDouble001.stdout
@@ -0,0 +1,6 @@
+[(Infinity,"")]
+[(-Infinity,"")]
+[(-Infinity," ")]
+[(NaN,"")]
+[(NaN,"")]
+[(NaN," ")]