[commit: base] master: Add test for #7522 (1ac38ef)

Max Bolingbroke batterseapower at hotmail.com
Wed Apr 10 22:24:59 CEST 2013


Repository : ssh://darcs.haskell.org//srv/darcs/packages/base

On branch  : master

https://github.com/ghc/packages-base/commit/1ac38ef6e9decc3f4763848f3d43c0cc68d1d390

>---------------------------------------------------------------

commit 1ac38ef6e9decc3f4763848f3d43c0cc68d1d390
Author: Max Bolingbroke <batterseapower at hotmail.com>
Date:   Wed Apr 10 21:25:05 2013 +0100

    Add test for #7522

>---------------------------------------------------------------

 tests/IO/all.T              |    1 +
 tests/IO/encoding003.hs     |   23 +++++++++++++++++++++++
 tests/IO/encoding003.stdout |    1 +
 3 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/tests/IO/all.T b/tests/IO/all.T
index bb73e99..8272ef2 100644
--- a/tests/IO/all.T
+++ b/tests/IO/all.T
@@ -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
index 0000000..12ed28b
--- /dev/null
+++ b/tests/IO/encoding003.hs
@@ -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
index 0000000..8b13789
--- /dev/null
+++ b/tests/IO/encoding003.stdout
@@ -0,0 +1 @@
+





More information about the ghc-commits mailing list