Skip to content

Commit acfdb6a

Browse files
committed
Add regression test for #227
1 parent 78f39d8 commit acfdb6a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

tests/Tests/Regressions.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ module Tests.Regressions
77
) where
88

99
import Control.Exception (SomeException, handle)
10+
import Data.Char (isLetter)
1011
import System.IO
1112
import Test.HUnit (assertBool, assertEqual, assertFailure)
1213
import qualified Data.ByteString as B
@@ -82,6 +83,12 @@ t197 =
8283
cond = length fltr
8384
fltr = filter (== ',') x
8485

86+
t227 :: IO ()
87+
t227 =
88+
assertEqual "take (-3) shouldn't crash with overflow"
89+
(T.length $ T.filter isLetter $ T.take (-3) "Hello! How are you doing today?")
90+
0
91+
8592
tests :: F.Test
8693
tests = F.testGroup "Regressions"
8794
[ F.testCase "hGetContents_crash" hGetContents_crash
@@ -90,4 +97,5 @@ tests = F.testGroup "Regressions"
9097
, F.testCase "replicate_crash" replicate_crash
9198
, F.testCase "utf8_decode_unsafe" utf8_decode_unsafe
9299
, F.testCase "t197" t197
100+
, F.testCase "t227" t227
93101
]

0 commit comments

Comments
 (0)