From 28976a0b51d851b8f5d1da01e629a106f439d573 Mon Sep 17 00:00:00 2001 From: Bodigrim Date: Sun, 23 Jul 2023 23:47:32 +0100 Subject: [PATCH] Test TemplateHaskell + isValidUtf8 --- tests/IsValidUtf8.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/IsValidUtf8.hs b/tests/IsValidUtf8.hs index 7901a2d58..fb6a56bb1 100644 --- a/tests/IsValidUtf8.hs +++ b/tests/IsValidUtf8.hs @@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TemplateHaskell #-} module IsValidUtf8 (testSuite) where @@ -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) @@ -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