Skip to content

Commit

Permalink
Add test for #7522
Browse files Browse the repository at this point in the history
  • Loading branch information
batterseapower committed Apr 10, 2013
1 parent d714cc4 commit 1ac38ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/IO/all.T
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions 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
1 change: 1 addition & 0 deletions tests/IO/encoding003.stdout
@@ -0,0 +1 @@

0 comments on commit 1ac38ef

Please sign in to comment.