Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test TemplateHaskell + isValidUtf8 #602

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion tests/IsValidUtf8.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TemplateHaskell #-}

module IsValidUtf8 (testSuite) where

Expand All @@ -9,6 +10,7 @@ import qualified Data.ByteString as B
import Data.Char (chr, ord)
import Data.Word (Word8)
import Control.Monad (guard)
import qualified Language.Haskell.TH.Syntax as TH
import Numeric (showHex)
import GHC.Exts (fromList, fromListN, toList)
import Test.QuickCheck (Property, forAll, (===), forAllShrinkShow)
Expand All @@ -24,7 +26,8 @@ testSuite = testGroup "UTF-8 validation" [
adjustOption (max testCount) . testProperty "Invalid UTF-8 ByteString" $ goInvalidBS,
adjustOption (max testCount) . testProperty "Valid UTF-8 ShortByteString" $ goValidSBS,
adjustOption (max testCount) . testProperty "Invalid UTF-8 ShortByteString" $ goInvalidSBS,
testGroup "Regressions" checkRegressions
testGroup "Regressions" checkRegressions,
testProperty "TemplateHaskell" $(TH.lift $ B.isValidUtf8 $ B.pack [65])
]
where
goValidBS :: ValidUtf8 -> Bool
Expand Down
Loading