fixed tests

This commit is contained in:
Pagwin 2025-12-11 21:43:27 -05:00
parent ad337e7897
commit 8c8457e431
No known key found for this signature in database
GPG key ID: 81137023740CA260

View file

@ -53,7 +53,6 @@ generic_parse inp = lift $ timeout 1000000 $ evaluate $ parse (Markdown.document
all_compiles :: Property all_compiles :: Property
all_compiles = property $ do all_compiles = property $ do
xs <- forAll $ Gen.text (Range.linear 0 10) Gen.ascii xs <- forAll $ Gen.text (Range.linear 0 10) Gen.ascii
annotate $ T.unpack xs
parsed <- generic_parse xs parsed <- generic_parse xs
case parsed of case parsed of
Nothing -> fail $ "Hit Timeout" Nothing -> fail $ "Hit Timeout"
@ -115,7 +114,6 @@ code_block = property $ do
language <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha language <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha
code <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha code <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha
let input = "```" <> language <> "\n" <> code <> "\n```" let input = "```" <> language <> "\n" <> code <> "\n```"
annotate $ "Input: " <> T.unpack input
parsed <- generic_parse input parsed <- generic_parse input
case parsed of case parsed of
@ -129,7 +127,6 @@ code_block_hanging = property $ do
language <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha language <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha
code <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha code <- forAll $ Gen.text (Range.linear 1 10) Gen.alpha
let input = "```" <> language <> "\n" <> code <> "```" let input = "```" <> language <> "\n" <> code <> "```"
annotate $ "Input: " <> T.unpack input
parsed <- generic_parse input parsed <- generic_parse input
case parsed of case parsed of
@ -164,7 +161,7 @@ unordered_list = property $ do
case parsed of case parsed of
Nothing -> fail $ "Hit Timeout" Nothing -> fail $ "Hit Timeout"
(Just (Right (Doc [List (L {list_type = Unordered, items = [LI {content = [Text text_1], children = []}, LI {content = [Text text_2], children = []}]})]))) -> success (Just (Right (Doc [List (L {list_type = Unordered, items = [LI {content = [Text text_1], child = Nothing}, LI {content = [Text text_2], child = Nothing}]})]))) -> success
(Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree (Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree
(Just (Left e)) -> fail $ errorBundlePretty e (Just (Left e)) -> fail $ errorBundlePretty e
@ -181,7 +178,7 @@ header_after_unordered_list = property $ do
case parsed of case parsed of
Nothing -> fail $ "Hit Timeout" Nothing -> fail $ "Hit Timeout"
(Just (Right (Doc [List (L {list_type = Unordered, items = [LI {content = [Text bullet_text], children = []}]}), Heading (H {level = header_level, text = [Text header_text]})]))) -> success (Just (Right (Doc [List (L {list_type = Unordered, items = [LI {content = [Text bullet_text], child = Nothing}]}), Heading (H {level = header_level, text = [Text header_text]})]))) -> success
(Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree (Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree
(Just (Left e)) -> fail $ errorBundlePretty e (Just (Left e)) -> fail $ errorBundlePretty e
@ -197,7 +194,7 @@ ordered_list = property $ do
case parsed of case parsed of
Nothing -> fail $ "Hit Timeout" Nothing -> fail $ "Hit Timeout"
(Just (Right (Doc [List (L {list_type = Ordered, items = [LI {content = [Text item_1], children = []}, LI {content = [Text item_2], children = []}, LI {content = [Text item_3], children = []}]})]))) -> success (Just (Right (Doc [List (L {list_type = Ordered, items = [LI {content = [Text item_1], child = Nothing}, LI {content = [Text item_2], child = Nothing}, LI {content = [Text item_3], child = Nothing}]})]))) -> success
(Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree (Just (Right tree)) -> fail $ "Incorrect syntax tree: " <> show tree
(Just (Left e)) -> fail $ errorBundlePretty e (Just (Left e)) -> fail $ errorBundlePretty e
@ -215,9 +212,9 @@ multiple_ordered_lists = property $ do
( Just ( Just
( Right ( Right
( Doc ( Doc
[ List (L {list_type = Ordered, items = [LI {content = [Text item_1], children = []}]}), [ List (L {list_type = Ordered, items = [LI {content = [Text item_1], child = Nothing}]}),
List (L {list_type = Ordered, items = [LI {content = [Text item_2], children = []}]}), List (L {list_type = Ordered, items = [LI {content = [Text item_2], child = Nothing}]}),
List (L {list_type = Ordered, items = [LI {content = [Text item_3], children = []}]}) List (L {list_type = Ordered, items = [LI {content = [Text item_3], child = Nothing}]})
] ]
) )
) )
@ -242,7 +239,7 @@ nested_unordered_list = property $ do
( Just ( Just
( Right ( Right
( Doc ( Doc
[ List (L {list_type = Unordered, items = [LI {content = [Text item_1], children = [L {list_type = Unordered, items = [LI {content = [Text item_2], children = []}]}]}, LI {content = [Text item_3], children = []}]}) [ List (L {list_type = Unordered, items = [LI {content = [Text item_1], child = Just (L {list_type = Unordered, items = [LI {content = [Text item_2], child = Nothing}]})}, LI {content = [Text item_3], child = Nothing}]})
] ]
) )
) )
@ -276,9 +273,9 @@ header_then_ordered_list = property $ do
( L ( L
{ list_type = Ordered, { list_type = Ordered,
items = items =
[ LI {content = [Text item_1], children = []}, [ LI {content = [Text item_1], child = Nothing},
LI {content = [Text item_2], children = []}, LI {content = [Text item_2], child = Nothing},
LI {content = [Text item_3], children = []} LI {content = [Text item_3], child = Nothing}
] ]
} }
) )