Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/d29666f681514f7554d9ca49e3d4bd42ff0d83b5 >--------------------------------------------------------------- commit d29666f681514f7554d9ca49e3d4bd42ff0d83b5 Author: Max Bolingbroke <[email protected]> Date: Fri Sep 23 16:24:39 2011 +0900 Fix #5436 by using 'recover' on handle EOF >--------------------------------------------------------------- tests/lib/IO/all.T | 1 + tests/lib/IO/decodingerror001.stdout | 10 +++++----- tests/lib/IO/decodingerror002.hs | 18 ++++++++++++++++++ tests/lib/IO/decodingerror002.in | 1 + tests/lib/IO/decodingerror002.stdout | 4 ++++ 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/tests/lib/IO/all.T b/tests/lib/IO/all.T index 8bd4643..4bb14e6 100644 --- a/tests/lib/IO/all.T +++ b/tests/lib/IO/all.T @@ -126,6 +126,7 @@ test('4855', normal, compile_and_run, ['']) test('hSetEncoding001',extra_run_opts('hSetEncoding001.in'), compile_and_run, ['']) test('decodingerror001',normal, compile_and_run, ['']) +test('decodingerror002',normal, compile_and_run, ['']) encoding001Encodings = ["utf8", "utf8_bom", "utf16", "utf16le", "utf16be", "utf32", "utf32le", "utf32be"] diff --git a/tests/lib/IO/decodingerror001.stdout b/tests/lib/IO/decodingerror001.stdout index 21e5208..24ca1a9 100644 --- a/tests/lib/IO/decodingerror001.stdout +++ b/tests/lib/IO/decodingerror001.stdout @@ -3,8 +3,8 @@ UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte s UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence) UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence) UTF8 error:Left decodingerror001.in1: hGetChar: invalid argument (invalid byte sequence) -UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding) -UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding) -UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding) -UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding) -UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence for this encoding) +UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence) +UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence) +UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence) +UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence) +UTF8 incomplete sequence at end:Left decodingerror001.in2: hGetChar: invalid argument (invalid byte sequence) diff --git a/tests/lib/IO/decodingerror002.hs b/tests/lib/IO/decodingerror002.hs new file mode 100644 index 0000000..5b7acaf --- /dev/null +++ b/tests/lib/IO/decodingerror002.hs @@ -0,0 +1,18 @@ +import Control.Monad +import System.IO +import System.IO.Error +import GHC.IO.Handle (hSetEncoding) + +main = alltests "decodingerror002.in" + +alltests file = mapM (test file) ["UTF8", + "UTF8//IGNORE", + "UTF8//TRANSLIT", + "UTF8//ROUNDTRIP"] + +test file enc_name = do + h <- openFile file ReadMode + enc <- mkTextEncoding enc_name + hSetEncoding h enc + e <- try $ forever $ hGetChar h >>= putChar + print (e :: Either IOError ()) diff --git a/tests/lib/IO/decodingerror002.in b/tests/lib/IO/decodingerror002.in new file mode 100644 index 0000000..195ee38 --- /dev/null +++ b/tests/lib/IO/decodingerror002.in @@ -0,0 +1 @@ +È \ No newline at end of file diff --git a/tests/lib/IO/decodingerror002.stdout b/tests/lib/IO/decodingerror002.stdout new file mode 100644 index 0000000..6950fa4 --- /dev/null +++ b/tests/lib/IO/decodingerror002.stdout @@ -0,0 +1,4 @@ +Left decodingerror002.in: hGetChar: invalid argument (invalid byte sequence) +Left decodingerror002.in: hGetChar: end of file +�Left decodingerror002.in: hGetChar: end of file +Left <stdout>: hPutChar: invalid argument (invalid character)
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
