Add test for #7522
authorMax Bolingbroke <batterseapower@hotmail.com>
Wed, 10 Apr 2013 20:25:05 +0000 (21:25 +0100)
committerMax Bolingbroke <batterseapower@hotmail.com>
Wed, 10 Apr 2013 20:25:05 +0000 (21:25 +0100)
tests/IO/all.T
tests/IO/encoding003.hs [new file with mode: 0644]
tests/IO/encoding003.stdout [new file with mode: 0644]

index bb73e99..8272ef2 100644 (file)
@@ -144,6 +144,7 @@ test('encoding001',
      compile_and_run, [''])
 
 test('encoding002', normal, compile_and_run, [''])
+test('encoding003', normal, compile_and_run, [''])
 
 test('environment001',
      [when(msys(), expect_fail), # Doesn't work on MSYS; see #5599
diff --git a/tests/IO/encoding003.hs b/tests/IO/encoding003.hs
new file mode 100644 (file)
index 0000000..12ed28b
--- /dev/null
@@ -0,0 +1,23 @@
+import System.IO
+import System.Directory
+import Data.Char
+
+tempFile = "temp"
+
+create :: IO ()
+create = do
+    h <- openFile tempFile WriteMode
+    hSetEncoding h latin1
+    hPutStr h [chr 128]
+    hClose h
+
+main :: IO ()
+main = do
+    create
+
+    utf8Ignore <- mkTextEncoding "UTF8//IGNORE"
+    h <- openFile tempFile ReadMode
+    hSetEncoding h utf8Ignore
+    hGetContents h >>= putStrLn
+
+    removeFile tempFile
diff --git a/tests/IO/encoding003.stdout b/tests/IO/encoding003.stdout
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+