[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 15:11:33 UTC 2010
The following commit has been merged in the master branch:
commit 07c54042cf3c79bd6929617ba20274807dfc6d8c
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Oct 17 20:40:33 2006 +0100
Fix a logic error in MemoryBuffer vPutStr, and added tests for it
Thanks to Bulat Ziganshin for finding this
diff --git a/MissingH/IO/HVIO.hs b/MissingH/IO/HVIO.hs
index 1aa6b3c..5373f57 100644
--- a/MissingH/IO/HVIO.hs
+++ b/MissingH/IO/HVIO.hs
@@ -540,7 +540,7 @@ instance HVIO MemoryBuffer where
vPutStr h s = do (pos, buf) <- vioc_get (vrv h)
let (pre, post) = splitAt pos buf
- let newbuf = pre ++ s ++ (drop (length buf) post)
+ let newbuf = pre ++ s ++ (drop (length s) post)
vioc_set (vrv h) (pos + (length s), newbuf)
vPutChar h c = vPutStr h [c]
vIsWritable _ = return True
diff --git a/testsrc/HVIOtest.hs b/testsrc/HVIOtest.hs
index 2cba92b..7d16177 100644
--- a/testsrc/HVIOtest.hs
+++ b/testsrc/HVIOtest.hs
@@ -47,11 +47,16 @@ test_MemoryBuffer =
"e1" `ioeq` vGetLine x
vSeek x SeekFromEnd (-3)
"e2" `ioeq` vGetLine x
+ vSeek x AbsoluteSeek 1
+ vPutStr x "IN"
+ vRewind x
+ "LINe1" `ioeq` vGetLine x
+ "Line2" `ioeq` vGetLine x
vSeek x SeekFromEnd 0
vPutChar x 'c'
assertRaises "eof error" (IOException $ mkIOError eofErrorType "" Nothing Nothing) (vGetLine x)
vRewind x
- "Line1\nLine2\nc" `ioeq` vGetContents x
+ "LINe1\nLine2\nc" `ioeq` vGetContents x
)
]
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list