Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/766819d08f3a254c1f4e2f6f746a0e57a4d9bf81 >--------------------------------------------------------------- commit 766819d08f3a254c1f4e2f6f746a0e57a4d9bf81 Author: Ian Lynagh <[email protected]> Date: Fri Jun 10 21:09:55 2011 +0100 Add some ASCII output to 3307 >--------------------------------------------------------------- tests/ghc-regress/lib/IO/3307.hs | 11 +++++++++-- tests/ghc-regress/lib/IO/3307.stdout | 4 ++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/tests/ghc-regress/lib/IO/3307.hs b/tests/ghc-regress/lib/IO/3307.hs index 6e9cc8f..a75f3f2 100644 --- a/tests/ghc-regress/lib/IO/3307.hs +++ b/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/tests/ghc-regress/lib/IO/3307.stdout b/tests/ghc-regress/lib/IO/3307.stdout index da8b2f9..8b26b5f 100644 --- a/tests/ghc-regress/lib/IO/3307.stdout +++ b/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
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
