summaryrefslogtreecommitdiff
path: root/testsuite/tests/ghc-regress/lib
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2011-06-10 21:09:55 +0100
committerIan Lynagh <igloo@earth.li>2011-06-10 21:09:55 +0100
commit93d413331c561a481bdf63d37d529d67bada17fd (patch)
treeebf11162d21969f09c75fe7cfe7d328eb9b48ebc /testsuite/tests/ghc-regress/lib
parent39f4bc6936bbaac26704ae52469e65af8e8512b1 (diff)
downloadhaskell-93d413331c561a481bdf63d37d529d67bada17fd.tar.gz
Add some ASCII output to 3307
Diffstat (limited to 'testsuite/tests/ghc-regress/lib')
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/3307.hs11
-rw-r--r--testsuite/tests/ghc-regress/lib/IO/3307.stdout4
2 files changed, 13 insertions, 2 deletions
diff --git a/testsuite/tests/ghc-regress/lib/IO/3307.hs b/testsuite/tests/ghc-regress/lib/IO/3307.hs
index 6e9cc8fdf2..a75f3f2b42 100644
--- a/testsuite/tests/ghc-regress/lib/IO/3307.hs
+++ b/testsuite/tests/ghc-regress/lib/IO/3307.hs
@@ -15,24 +15,31 @@ main = do
-- 1) A file name arriving via an argument
putStrLn "Test 1"
[file] <- getArgs
+ print $ map ord file
readFile file >>= putStr
-- 2) A file name arriving via getDirectoryContents
putStrLn "Test 2"
[file] <- fmap (filter ("chinese-file-" `isPrefixOf`)) $ getDirectoryContents "."
+ print $ map ord file
readFile file >>= putStr
-- 3) A file name occurring literally in the program
-- This will only work if we are in the UTF-8 locale since the file is created
-- on disk with a UTF-8 file name.
putStrLn "Test 3"
- readFile "chinese-file-小说" >>= putStr
+ let file = "chinese-file-小说"
+ print $ map ord file
+ readFile file >>= putStr
-- 4) A file name arriving via another file.
-- In this case we have to override the default encoding
-- so we get surrogate bytes for non-decodable namse.
putStrLn "Test 4"
- (readFileAs fileSystemEncoding "chinese-name" >>= (readFile . dropTrailingSpace)) >>= putStr
+ str <- readFileAs fileSystemEncoding "chinese-name"
+ let file = dropTrailingSpace str
+ print $ map ord file
+ readFile file >>= putStr
readFileAs :: TextEncoding -> FilePath -> IO String
readFileAs enc fp = do
diff --git a/testsuite/tests/ghc-regress/lib/IO/3307.stdout b/testsuite/tests/ghc-regress/lib/IO/3307.stdout
index da8b2f90e6..8b26b5ff1d 100644
--- a/testsuite/tests/ghc-regress/lib/IO/3307.stdout
+++ b/testsuite/tests/ghc-regress/lib/IO/3307.stdout
@@ -1,8 +1,12 @@
Test 1
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
Ni hao
Test 2
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
Ni hao
Test 3
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
Ni hao
Test 4
+[99,104,105,110,101,115,101,45,102,105,108,101,45,23567,35828]
Ni hao