]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - test/WikiParserTest.hs
implemented listing
[Rakka.git] / test / WikiParserTest.hs
index 8585019f288e8b7fd866d2e55f422963dd2fcb7f..7e18741b11761c01013f6fa0ba8687572889fd16 100644 (file)
@@ -148,4 +148,71 @@ testData = [ (parseWiki ""
                                  , PageLink (Just "Bar") Nothing Nothing
                                  ]
                      ]))
+
+           , (parseWiki " foo"
+              ~?=
+              (Right [ LeadingSpaced [ Text "foo" ] ]))
+
+           , (parseWiki " foo\n  bar\n"
+              ~?=
+              (Right [ LeadingSpaced [ Text "foo"
+                                     , Text "\n"
+                                     , Text " bar"
+                                     ]
+                     ]))
+
+           , (parseWiki "foo\n bar\nbaz"
+              ~?=
+              (Right [ Paragraph     [ Text "foo" ]
+                     , LeadingSpaced [ Text "bar" ]
+                     , Paragraph     [ Text "baz" ]
+                     ]))
+
+           , (parseWiki "----"
+              ~?=
+              (Right [ HorizontalLine ]))
+
+           , (parseWiki "\nfoo\nbar\n----\n"
+              ~?=
+              (Right [ Paragraph [ Text "foo"
+                                 , Text "\n"
+                                 , Text "bar"
+                                 ]
+                     , HorizontalLine
+                     ]))
+
+           , (parseWiki "a----b"
+              ~?=
+              (Right [ Paragraph [ Text "a----b" ] ]))
+
+           , (parseWiki "* a"
+              ~?=
+              (Right [ List (ListElement Bullet [[Right (Text "a")]]) ]))
+
+           , (parseWiki "* a*"
+              ~?=
+              (Right [ List (ListElement Bullet [[Right (Text "a*")]]) ]))
+
+           , (parseWiki "* a\n* b\n"
+              ~?=
+              (Right [ List (ListElement Bullet [ [Right (Text "a")]
+                                                , [Right (Text "b")]
+                                                ])
+                     ]))
+
+           , (parseWiki "*a\n*#b\n*#c\n"
+              ~?=
+              (Right [ List (ListElement Bullet [ [ Right (Text "a")
+                                                  , Left (ListElement Numbered [ [Right (Text "b")]
+                                                                               , [Right (Text "c")]
+                                                                               ])
+                                                  ]
+                                                ])
+                     ]))
+
+           , (parseWiki "*a\n#b"
+              ~?=
+              (Right [ List (ListElement Bullet   [ [Right (Text "a")] ])
+                     , List (ListElement Numbered [ [Right (Text "b")] ])
+                     ]))
            ]