From 61899e64b17feb28d28ecb2985888c0de00040fe Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 13 Nov 2012 16:20:34 +0100 Subject: [PATCH] Switch Attoparsec/unicode test from QC to HUnit This is not a quickcheck property, since it doesn't have any variable/arbitrary inputs. So let's make it a test case, and shorten a bit the name. Also, sorry for not catching this in the review. Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michele Tartara <mtartara@google.com> --- htest/Test/Ganeti/Attoparsec.hs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/htest/Test/Ganeti/Attoparsec.hs b/htest/Test/Ganeti/Attoparsec.hs index 20aab6e60..a91835768 100644 --- a/htest/Test/Ganeti/Attoparsec.hs +++ b/htest/Test/Ganeti/Attoparsec.hs @@ -25,10 +25,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA module Test.Ganeti.Attoparsec (testAttoparsec) where -import Test.QuickCheck +import Test.HUnit import Test.Ganeti.TestHelper -import Test.Ganeti.TestCommon import qualified Data.Attoparsec.Text as A import Data.Attoparsec.Text (Parser) @@ -55,12 +54,15 @@ simpleParser = do -- | Tests whether a Unicode string is still Unicode after being -- parsed. -prop_parserSupportsUnicode :: Property -prop_parserSupportsUnicode = case A.parseOnly simpleParser text of - Right (name, value) -> (name ==? part1) .&&. (value ==? part2) - Left msg -> failTest $ "Failed to parse: " ++ msg +case_unicodeParsing :: Assertion +case_unicodeParsing = + case A.parseOnly simpleParser text of + Right (name, value) -> do + assertEqual "name part" part1 name + assertEqual "value part" part2 value + Left msg -> assertFailure $ "Failed to parse: " ++ msg where text = Data.Text.pack $ part1 ++ " = \t" ++ part2 testSuite "Attoparsec" - [ 'prop_parserSupportsUnicode + [ 'case_unicodeParsing ] -- GitLab