Commit 5505d877 authored by batterseapower's avatar batterseapower
Browse files

Fix 3307 on Windows

parent 3167d74f
......@@ -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
......@@ -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-小说
......@@ -119,8 +119,7 @@ test('concio002', reqlib('process'), compile_and_run, [''])
test('2122', extra_clean(['2122-test']), compile_and_run, [''])
[extra_clean(['chinese-file-小说', 'chinese-name']),
if_platform('i386-unknown-mingw32', expect_broken(5253))],
[extra_clean(['chinese-file-小说', 'chinese-name'])],
['$MAKE -s --no-print-directory 3307-test'])
test('4855', normal, compile_and_run, [''])
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment