diff options
author | Max Bolingbroke <batterseapower@hotmail.com> | 2011-06-24 15:01:43 +0100 |
---|---|---|
committer | Max Bolingbroke <batterseapower@hotmail.com> | 2011-06-24 15:04:52 +0100 |
commit | 5505d8770e743d0630d05dd60e27feaa061c7a4c (patch) | |
tree | e366fd6dfef458d45ebadee1a9dae4b0e7bec95d /testsuite/tests/ghc-regress | |
parent | 3167d74f4d1a8418333d7c2469f38b7e1d12bbd1 (diff) | |
download | haskell-5505d8770e743d0630d05dd60e27feaa061c7a4c.tar.gz |
Fix 3307 on Windows
Diffstat (limited to 'testsuite/tests/ghc-regress')
-rw-r--r-- | testsuite/tests/ghc-regress/lib/IO/3307.hs | 11 | ||||
-rw-r--r-- | testsuite/tests/ghc-regress/lib/IO/Makefile | 4 | ||||
-rw-r--r-- | testsuite/tests/ghc-regress/lib/IO/all.T | 3 |
3 files changed, 9 insertions, 9 deletions
diff --git a/testsuite/tests/ghc-regress/lib/IO/3307.hs b/testsuite/tests/ghc-regress/lib/IO/3307.hs index a75f3f2b42..fb1a360ea2 100644 --- a/testsuite/tests/ghc-regress/lib/IO/3307.hs +++ b/testsuite/tests/ghc-regress/lib/IO/3307.hs @@ -25,18 +25,19 @@ main = do 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. + -- The file is created with a UTF-8 file name as well, so this will only work in Windows or a + -- UTF-8 locale, or this string will be encoded in some non-UTF-8 way and won't match. putStrLn "Test 3" 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. + -- Again, the file is created with UTF-8 contents, so we read it in that encoding. + -- Once again, on non-Windows this may fail in a non-UTF-8 locale because we could encode the valid + -- filename string into a useless non-UTF-8 byte sequence. putStrLn "Test 4" - str <- readFileAs fileSystemEncoding "chinese-name" + str <- readFileAs utf8 "chinese-name" let file = dropTrailingSpace str print $ map ord file readFile file >>= putStr diff --git a/testsuite/tests/ghc-regress/lib/IO/Makefile b/testsuite/tests/ghc-regress/lib/IO/Makefile index 548b3c5b15..cc9d060c31 100644 --- a/testsuite/tests/ghc-regress/lib/IO/Makefile +++ b/testsuite/tests/ghc-regress/lib/IO/Makefile @@ -43,6 +43,6 @@ environment001-test: "$(TEST_HC)" --make -fforce-recomp -v0 3307.hs -o 3307 echo Ni hao > chinese-file-小说 echo chinese-file-小说 > chinese-name - # The tests are run in a UTF-8 locale. We would test another one - # (like Big5) but GHC developers probably won't have it on their machines. + # The tests are run in whatever the default locale is. This is almost always UTF-8, + # but in cmd on Windows it will be the non-Unicode CP850 locale. ./3307 chinese-file-小说 diff --git a/testsuite/tests/ghc-regress/lib/IO/all.T b/testsuite/tests/ghc-regress/lib/IO/all.T index 2d9393c6fc..cf557a6b96 100644 --- a/testsuite/tests/ghc-regress/lib/IO/all.T +++ b/testsuite/tests/ghc-regress/lib/IO/all.T @@ -119,8 +119,7 @@ test('concio002', reqlib('process'), compile_and_run, ['']) test('2122', extra_clean(['2122-test']), compile_and_run, ['']) test('3307', - [extra_clean(['chinese-file-小说', 'chinese-name']), - if_platform('i386-unknown-mingw32', expect_broken(5253))], + [extra_clean(['chinese-file-小说', 'chinese-name'])], run_command, ['$MAKE -s --no-print-directory 3307-test']) test('4855', normal, compile_and_run, ['']) |