[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:51:51 UTC 2010


The following commit has been merged in the master branch:
commit fadfc9ffc85099271a33315bd5900483df9508aa
Author: John Goerzen <jgoerzen at complete.org>
Date:   Tue Dec 21 00:14:02 2004 +0100

    Fixed a bug in default readline code
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.7--patch-99)

diff --git a/ChangeLog b/ChangeLog
index c0e5c14..bea6e64 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
 #
 
+2004-12-20 17:14:02 GMT	John Goerzen <jgoerzen at complete.org>	patch-99
+
+    Summary:
+      Fixed a bug in default readline code
+    Revision:
+      missingh--head--0.7--patch-99
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/IO/HVIO.hs testsrc/HVIOtest.hs
+
+
 2004-12-20 17:01:25 GMT	John Goerzen <jgoerzen at complete.org>	patch-98
 
     Summary:
diff --git a/libsrc/MissingH/IO/HVIO.hs b/libsrc/MissingH/IO/HVIO.hs
index cb90883..d8a29a3 100644
--- a/libsrc/MissingH/IO/HVIO.hs
+++ b/libsrc/MissingH/IO/HVIO.hs
@@ -256,7 +256,10 @@ class (HVIOGeneric a) => HVIOReader a where
                                 else ioError e
                     in catch func handler
             in
-            do vGetChar h >>= \x -> loop [x]
+            do firstchar <- vGetChar h
+               case firstchar of
+                   '\n' -> return []
+                   x -> loop [x]
 
     vGetContents h =
         let loop = 
diff --git a/testsrc/HVIOtest.hs b/testsrc/HVIOtest.hs
index 702bcb8..c6fc89b 100644
--- a/testsrc/HVIOtest.hs
+++ b/testsrc/HVIOtest.hs
@@ -19,6 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 module HVIOtest(tests) where
 import HUnit
 import MissingH.IO.HVIO
+import Testutil
+import System.IO
+import System.IO.Error
+import Control.Exception
 
 ioeq :: (Show a, Eq a) => a -> IO a -> Assertion
 ioeq exp inp = do x <- inp
@@ -31,9 +35,27 @@ test_StreamReader =
         [
          f "" (\x -> do True `ioeq` vIsEOF x
                         True `ioeq` vIsOpen x
+                        assertRaises "eof error" (IOException $ mkIOError eofErrorType "" Nothing Nothing) (vGetChar x)
                         vClose x
                         False `ioeq` vIsOpen x
+                        
               )
+        ,f "abcd" (\x -> do False `ioeq` vIsEOF x
+                            True `ioeq` vIsOpen x
+                            'a' `ioeq` vGetChar x
+                            "bcd" `ioeq` vGetContents x
+                            vClose x
+               )
+        ,f "line1\nline2\n\n\nline5\nlastline"
+           (\x -> do False `ioeq` vIsEOF x
+                     "line1" `ioeq` vGetLine x
+                     "line2" `ioeq` vGetLine x
+                     "" `ioeq` vGetLine x
+                     "" `ioeq` vGetLine x
+                     "line5" `ioeq` vGetLine x
+                     "lastline" `ioeq` vGetLine x
+                     assertRaises "eof error" (IOException $ mkIOError eofErrorType "" Nothing Nothing) (vGetLine x)
+           )
         ]
 
 tests = TestList [TestLabel "streamReader" (TestList test_StreamReader)

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list