diff --git a/tests/Main.hs b/tests/Main.hs index d7431a8..02350fd 100644 --- a/tests/Main.hs +++ b/tests/Main.hs @@ -39,3 +39,56 @@ headerParseSpec = do parseOnly pTitle "= This is another level 0 title =\n" `shouldBe` Right (0, "This is another level 0 title") + + it "parses a two-line level 0 title with a full-length underline" $ + parseOnly pTitle "This is a two-line level 0 title\n\ + \================================\n" + `shouldBe` + Right (0, "This is a two-line level 0 title") + + it "parses a two-line level 0 title with a minimal underline" $ + parseOnly pTitle "Another two-line level 0 title\n\ + \==\n" + `shouldBe` + Right (0, "Another two-line level 0 title") + + it "parses a one-line level 1 title" $ + parseOnly pTitle "== Level 1\n" `shouldBe` Right (1, "Level 1") + + it "parses a one-line level 1 title with right-delimiter" $ + parseOnly pTitle "== Level 1 ==\n" `shouldBe` Right (1, "Level 1") + + it "parses a one-line level 2 title" $ + parseOnly pTitle "=== Level 2\n" `shouldBe` Right (2, "Level 2") + + it "parses a one-line level 2 title with right-delimiter" $ + parseOnly pTitle "=== Level 2 ===\n" `shouldBe` Right (2, "Level 2") + + it "parses a one-line level 3 title" $ + parseOnly pTitle "==== Level 3\n" `shouldBe` Right (3, "Level 3") + + it "parses a one-line level 3 title with right-delimiter" $ + parseOnly pTitle "==== Level 3 ====\n" `shouldBe` Right (3, "Level 3") + + it "parses a one-line level 4 title" $ + parseOnly pTitle "===== Level 4\n" `shouldBe` Right (4, "Level 4") + + it "parses a one-line level 4 title with right-delimiter" $ + parseOnly pTitle "===== Level 4 =====\n" `shouldBe` Right (4, "Level 4") + + it "parses a two-line level 1 title" $ + parseOnly pTitle "A two-line level 1 title\n--\n" + `shouldBe` Right (1, "A two-line level 1 title") + + it "parses a two-line level 2 title" $ + parseOnly pTitle "A two-line level 2 title\n~~\n" + `shouldBe` Right (2, "A two-line level 2 title") + + it "parses a two-line level 3 title" $ + parseOnly pTitle "A two-line level 3 title\n^^\n" + `shouldBe` Right (3, "A two-line level 3 title") + + it "parses a two-line level 4 title" $ + parseOnly pTitle "A two-line level 4 title\n++\n" + `shouldBe` Right (4, "A two-line level 4 title") +