on master help sign in
A test for lines/unlines.
commit1479cb6c535fb00105f56040d2b22fbbd7aa1411 authorSteven Shaw <steven@steshaw.org> dateThu 21 Jul 2016, 06:00 (10 years ago) parent2d99594
3 files changed+31
test/prelude001/expected+10 test/prelude001/prelude001.idr+17 test/prelude001/run+4
test/prelude001/expectednew file+10
@@ -0,0 +1,10 @@
1+True
2+True
3+True
4+True
5+True
6+True
7+True
8+True
9+True
10+True
test/prelude001/prelude001.idrnew file+17
@@ -0,0 +1,17 @@
1+module Main
2+
3+main : IO ()
4+main = do
5+ printLn $ lines "" == []
6+ -- `lines` seems to ignore too many trailing newlines.
7+ printLn $ lines "\n" == [] -- FIXME: Should be [""].
8+ printLn $ lines "\n\n" == [] -- FIXME: Should be ["", ""].
9+ printLn $ lines "\n\n\n" == [] -- FIXME: Should be ["", "", ""].
10+ printLn $ lines "1\n2\n3" == ["1", "2", "3"]
11+ printLn $ lines "1\n2\n3\n" == ["1", "2", "3"]
12+ printLn $ unlines [] == ""
13+ -- `unlines` works as advertised doesn't follow Haskell here.
14+ -- When files are written using unlines, vim complains of "noeoln".
15+ printLn $ unlines ["1"] == "1" -- FIXME: Should be "1\n"
16+ printLn $ unlines ["1", "2"] == "1\n2" -- FIXME: Should be "1\n2\n"
17+ printLn $ unlines ["1", "2", "3"] == "1\n2\n3" -- FIXME: Should be "1\n2\n3\n"
test/prelude001/runnew file+4
@@ -0,0 +1,4 @@
1+#!/usr/bin/env bash
2+${IDRIS:-idris} $@ prelude001.idr -o prelude001
3+./prelude001
4+rm -f prelude001 *.ibc