Skip to content

Commit

Permalink
Add regression test for haskell#227
Browse files Browse the repository at this point in the history
  • Loading branch information
bgamari authored and kuk0 committed Sep 26, 2018
1 parent 2535ed3 commit 395a9b4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/Tests/Regressions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module Tests.Regressions
) where

import Control.Exception (SomeException, handle)
import Data.Char (isLetter)
import System.IO
import Test.HUnit (assertBool, assertEqual, assertFailure)
import qualified Data.ByteString as B
Expand Down Expand Up @@ -82,6 +83,12 @@ t197 =
cond = length fltr
fltr = filter (== ',') x

t227 :: IO ()
t227 =
assertEqual "take (-3) shouldn't crash with overflow"
(T.length $ T.filter isLetter $ T.take (-3) "Hello! How are you doing today?")
0

tests :: F.Test
tests = F.testGroup "Regressions"
[ F.testCase "hGetContents_crash" hGetContents_crash
Expand All @@ -90,4 +97,5 @@ tests = F.testGroup "Regressions"
, F.testCase "replicate_crash" replicate_crash
, F.testCase "utf8_decode_unsafe" utf8_decode_unsafe
, F.testCase "t197" t197
, F.testCase "t227" t227
]

0 comments on commit 395a9b4

Please sign in to comment.