]> gitweb @ CieloNegro.org - Rakka.git/blobdiff - tests/WikiParserTest.hs
Applied HLint
[Rakka.git] / tests / WikiParserTest.hs
index a7c5c70087ecf9c41918ac06fdd847f94e4829d0..856707244b527a24356e048bd1c43f0e5211e3a1 100644 (file)
@@ -29,337 +29,337 @@ parseWiki src = case parse (wikiPage cmdTypeOf) "" src of
 testData :: [Test]
 testData = [ (parseWiki ""
               ~?=
-              (Right []))
+              Right [])
 
            , (parseWiki "\n"
               ~?=
-              (Right []))
+              Right [])
 
            , (parseWiki "=heading="
               ~?=
-              (Right [ Heading 1 "heading" ]))
+              Right [ Heading 1 "heading" ])
 
            , (parseWiki "==      heading  ==  \n"
               ~?=
-              (Right [ Heading 2 "heading" ]))
+              Right [ Heading 2 "heading" ])
 
            , (parseWiki "===== hello world =====\n"
               ~?=
-              (Right [ Heading 5 "hello world" ]))
+              Right [ Heading 5 "hello world" ])
 
            , (parseWiki "a =not a heading="
               ~?=
-              (Right [ Paragraph [ Text "a =not a heading=" ]
-                     ]))
+              Right [ Paragraph [ Text "a =not a heading=" ]
+                    ])
 
            , (parseWiki "=h=\n\n=h="
               ~?=
-              (Right [ Heading 1 "h"
-                     , Heading 1 "h"
-                     ]))
+              Right [ Heading 1 "h"
+                    , Heading 1 "h"
+                    ])
            , (parseWiki "foo\nbar"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "\n"
-                                 , Text "bar"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "\n"
+                                , Text "bar"
+                                ]
+                    ])
            , (parseWiki "foo\nbar\n\nbaz\n"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "\n"
-                                 , Text "bar"
-                                 ]
-                     , Paragraph [ Text "baz"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "\n"
+                                , Text "bar"
+                                ]
+                    , Paragraph [ Text "baz"
+                                ]
+                    ])
 
            , (parseWiki "foo\n\n\nbar"
               ~?=
-              (Right [ Paragraph [ Text "foo" ]
-                     , Paragraph [ Text "bar" ]
-                     ]))
+              Right [ Paragraph [ Text "foo" ]
+                    , Paragraph [ Text "bar" ]
+                    ])
 
            , (parseWiki "foo\n=h="
               ~?=
-              (Right [ Paragraph [ Text "foo" ]
-                     , Heading 1 "h"
-                     ]))
+              Right [ Paragraph [ Text "foo" ]
+                    , Heading 1 "h"
+                    ])
 
            , (parseWiki "<!-- comment -->"
               ~?=
-              (Right []))
+              Right [])
 
            , (parseWiki "<!-- comment -->foo"
               ~?=
-              (Right [ Paragraph [ Text "foo" ]
-                     ]))
+              Right [ Paragraph [ Text "foo" ]
+                    ])
 
            , (parseWiki "bar<!-- comment -->"
               ~?=
-              (Right [ Paragraph [ Text "bar" ]
-                     ]))
+              Right [ Paragraph [ Text "bar" ]
+                    ])
 
            , (parseWiki "foo<!-- comment -->bar"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "bar"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "bar"
+                                ]
+                    ])
 
            , (parseWiki "<!-- comment -->=h="
               ~?=
-              (Right [ Heading 1 "h" ]))
+              Right [ Heading 1 "h" ])
 
            , (parseWiki "=h= <!---->"
               ~?=
-              (Right [ Heading 1 "h" ]))
+              Right [ Heading 1 "h" ])
 
            , (parseWiki "<!-- <!-- nested --> comment -->"
               ~?=
-              (Right []))
+              Right [])
 
            , (parseWiki "[[[Page]]]"
               ~?=
-              (Right [ Paragraph [ ObjectLink "Page" Nothing ] ]))
+              Right [ Paragraph [ ObjectLink "Page" Nothing ] ])
 
            , (parseWiki "[[[Page|foo]]]"
               ~?=
-              (Right [ Paragraph [ ObjectLink "Page" (Just "foo") ] ]))
+              Right [ Paragraph [ ObjectLink "Page" (Just "foo") ] ])
 
            , (parseWiki "[[Page]]"
               ~?= 
-              (Right [ Paragraph [ PageLink (Just "Page") Nothing Nothing ]
-                     ]))
+              Right [ Paragraph [ PageLink (Just "Page") Nothing Nothing ]
+                    ])
 
            , (parseWiki "[[Page|Link to \"Page\"]]"
               ~?=
-              (Right [ Paragraph [ PageLink (Just "Page") Nothing (Just "Link to \"Page\"") ]
-                     ]))
+              Right [ Paragraph [ PageLink (Just "Page") Nothing (Just "Link to \"Page\"") ]
+                    ])
 
            , (parseWiki "[[Page#foo]]"
               ~?= 
-              (Right [ Paragraph [ PageLink (Just "Page") (Just "foo") Nothing ]
-                     ]))
+              Right [ Paragraph [ PageLink (Just "Page") (Just "foo") Nothing ]
+                    ])
 
            , (parseWiki "[[#foo]]"
               ~?= 
-              (Right [ Paragraph [ PageLink Nothing (Just "foo") Nothing ]
-                     ]))
+              Right [ Paragraph [ PageLink Nothing (Just "foo") Nothing ]
+                    ])
 
            , (parseWiki "[[Page#foo|Link to \"Page#foo\"]]"
               ~?=
-              (Right [ Paragraph [ PageLink (Just "Page") (Just "foo") (Just "Link to \"Page#foo\"") ]
-                     ]))
+              Right [ Paragraph [ PageLink (Just "Page") (Just "foo") (Just "Link to \"Page#foo\"") ]
+                    ])
 
            , (parseWiki "foo [[Bar]] baz"
               ~?=
-              (Right [ Paragraph [ Text "foo "
-                                 , PageLink (Just "Bar") Nothing Nothing
-                                 , Text " baz"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo "
+                                , PageLink (Just "Bar") Nothing Nothing
+                                , Text " baz"
+                                ]
+                    ])
 
            , (parseWiki "[[Foo]]\n[[Bar]]"
               ~?= 
-              (Right [ Paragraph [ PageLink (Just "Foo") Nothing Nothing
-                                 , Text "\n"
-                                 , PageLink (Just "Bar") Nothing Nothing
-                                 ]
-                     ]))
+              Right [ Paragraph [ PageLink (Just "Foo") Nothing Nothing
+                                , Text "\n"
+                                , PageLink (Just "Bar") Nothing Nothing
+                                ]
+                    ])
 
            , (parseWiki " foo"
               ~?=
-              (Right [ Preformatted [ Text "foo" ] ]))
+              Right [ Preformatted [ Text "foo" ] ])
 
            , (parseWiki " foo\n  bar\n"
               ~?=
-              (Right [ Preformatted [ Text "foo"
-                                    , Text "\n"
-                                    , Text " bar"
-                                    ]
-                     ]))
+              Right [ Preformatted [ Text "foo"
+                                   , Text "\n"
+                                   , Text " bar"
+                                   ]
+                    ])
 
            , (parseWiki "foo\n bar\nbaz"
               ~?=
-              (Right [ Paragraph    [ Text "foo" ]
-                     , Preformatted [ Text "bar" ]
-                     , Paragraph    [ Text "baz" ]
-                     ]))
+              Right [ Paragraph    [ Text "foo" ]
+                    , Preformatted [ Text "bar" ]
+                    , Paragraph    [ Text "baz" ]
+                    ])
 
            , (parseWiki "----"
               ~?=
-              (Right [ HorizontalLine ]))
+              Right [ HorizontalLine ])
 
            , (parseWiki "\nfoo\nbar\n----\n"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "\n"
-                                 , Text "bar"
-                                 ]
-                     , HorizontalLine
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "\n"
+                                , Text "bar"
+                                ]
+                    , HorizontalLine
+                    ])
 
            , (parseWiki "a----b"
               ~?=
-              (Right [ Paragraph [ Text "a----b" ] ]))
+              Right [ Paragraph [ Text "a----b" ] ])
 
            , (parseWiki "* a"
               ~?=
-              (Right [ List Bullet [[Inline (Text "a")]] ]))
+              Right [ List Bullet [[Inline (Text "a")]] ])
 
            , (parseWiki "* a*"
               ~?=
-              (Right [ List Bullet [[Inline (Text "a*")]] ]))
+              Right [ List Bullet [[Inline (Text "a*")]] ])
 
            , (parseWiki "* a\n* b\n"
               ~?=
-              (Right [ List Bullet [ [Inline (Text "a")]
-                                   , [Inline (Text "b")]
-                                   ]
-                     ]))
+              Right [ List Bullet [ [Inline (Text "a")]
+                                  , [Inline (Text "b")]
+                                  ]
+                    ])
 
            , (parseWiki "*a\n*#b\n*#c\n"
               ~?=
-              (Right [ List Bullet [ [ Inline (Text "a")
-                                     , Block  (List Numbered [ [Inline (Text "b")]
-                                                             , [Inline (Text "c")]
-                                                             ])
-                                     ]
-                                   ]
-                     ]))
+              Right [ List Bullet [ [ Inline (Text "a")
+                                    , Block  (List Numbered [ [Inline (Text "b")]
+                                                            , [Inline (Text "c")]
+                                                            ])
+                                    ]
+                                  ]
+                    ])
 
            , (parseWiki "*a\n#b"
               ~?=
-              (Right [ List Bullet   [ [Inline (Text "a")] ]
-                     , List Numbered [ [Inline (Text "b")] ]
-                     ]))
+              Right [ List Bullet   [ [Inline (Text "a")] ]
+                    , List Numbered [ [Inline (Text "b")] ]
+                    ])
 
            , (parseWiki "*a<!-- comment -->"
               ~?=
-              (Right [ List Bullet [ [Inline (Text "a")] ] ]))
+              Right [ List Bullet [ [Inline (Text "a")] ] ])
 
            , (parseWiki "*a<!-- comment -->\n*b"
               ~?=
-              (Right [ List Bullet [ [Inline (Text "a")]
-                                   , [Inline (Text "b")]
-                                   ]
-                     ]))
+              Right [ List Bullet [ [Inline (Text "a")]
+                                  , [Inline (Text "b")]
+                                  ]
+                    ])
 
            , (parseWiki "foo:bar"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text ":bar"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text ":bar"
+                                ]
+                    ])
 
            , (parseWiki "; foo: bar"
               ~?=
-              (Right [ DefinitionList [Definition [Text "foo"] [Text "bar"]] ]))
+              Right [ DefinitionList [Definition [Text "foo"] [Text "bar"]] ])
 
            , (parseWiki "; foo: bar\n"
               ~?=
-              (Right [ DefinitionList [Definition [Text "foo"] [Text "bar"]] ]))
+              Right [ DefinitionList [Definition [Text "foo"] [Text "bar"]] ])
 
            , (parseWiki "; foo\n: bar\n; bar\n: baz\n: baz"
               ~?=
-              (Right [ DefinitionList [ Definition [Text "foo"] [ Text "bar" ]
-                                      , Definition [Text "bar"] [ Text "baz"
-                                                                , Text "\n"
-                                                                , Text "baz" ]
-                                      ]
-                     ]))
+              Right [ DefinitionList [ Definition [Text "foo"] [ Text "bar" ]
+                                     , Definition [Text "bar"] [ Text "baz"
+                                                               , Text "\n"
+                                                               , Text "baz" ]
+                                     ]
+                    ])
 
            , (parseWiki "<!nowiki[foo [[bar]] baz]>"
               ~?=
-              (Right [ Paragraph [ Text "foo [[bar]] baz" ] ]))
+              Right [ Paragraph [ Text "foo [[bar]] baz" ] ])
 
            , (parseWiki "<!verbatim[foo [[bar]] baz]>"
               ~?=
-              (Right [ Preformatted [ Text "foo [[bar]] baz" ] ]))
+              Right [ Preformatted [ Text "foo [[bar]] baz" ] ])
 
            , (parseWiki "<!verbatim[\nfoo [[bar]] baz\n]>"
               ~?=
-              (Right [ Preformatted [ Text "foo [[bar]] baz" ] ]))
+              Right [ Preformatted [ Text "foo [[bar]] baz" ] ])
 
            , (parseWiki "foo' bar"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "'"
-                                 , Text " bar" ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "'"
+                                , Text " bar" ]
+                    ])
 
            , (parseWiki "''foo''"
               ~?=
-              (Right [ Paragraph [ Italic [Text "foo"] ] ]))
+              Right [ Paragraph [ Italic [Text "foo"] ] ])
 
            , (parseWiki "'''foo'''"
               ~?=
-              (Right [ Paragraph [ Bold [Text "foo"] ] ]))
+              Right [ Paragraph [ Bold [Text "foo"] ] ])
 
            , (parseWiki "foo''''"
               ~?=
-              (Right [ Paragraph [ Text "foo"
-                                 , Text "'"
-                                 ]
-                     ]))
+              Right [ Paragraph [ Text "foo"
+                                , Text "'"
+                                ]
+                    ])
 
            , (parseWiki "'''''foo'''''"
               ~?=
-              (Right [ Paragraph [ Italic [Bold [Text "foo"]] ] ]))
+              Right [ Paragraph [ Italic [Bold [Text "foo"]] ] ])
 
            , (parseWiki "<br />"
               ~?=
-              (Right [ Paragraph [ InlineCmd (InlineCommand "br" [] []) ] ]))
+              Right [ Paragraph [ InlineCmd (InlineCommand "br" [] []) ] ])
 
            , (parseWiki "<br style=\"clear: both\"/>"
               ~?=
-              (Right [ Paragraph [ InlineCmd (InlineCommand "br" [("style", "clear: both")] []) ] ]))
+              Right [ Paragraph [ InlineCmd (InlineCommand "br" [("style", "clear: both")] []) ] ])
 
            , (parseWiki "<i><b>foo</b></i>"
               ~?=
-              (Right [ Paragraph [ InlineCmd (InlineCommand "i" []
-                                              [ InlineCmd (InlineCommand "b" [] [ Text "foo" ]) ]) ] ]))
+              Right [ Paragraph [ InlineCmd (InlineCommand "i" []
+                                             [ InlineCmd (InlineCommand "b" [] [ Text "foo" ]) ]) ] ])
 
            , (parseWiki "<i>\nfoo\n<!-- comment -->\nbar</i>"
               ~?=
-              (Right [ Paragraph [ InlineCmd (InlineCommand "i" []
-                                              [ Text "\n"
-                                              , Text "foo"
-                                              , Text "\n"
-                                              , Text "\n"
-                                              , Text "bar"
-                                              ]) ] ]))
+              Right [ Paragraph [ InlineCmd (InlineCommand "i" []
+                                             [ Text "\n"
+                                             , Text "foo"
+                                             , Text "\n"
+                                             , Text "\n"
+                                             , Text "bar"
+                                             ]) ] ])
 
            , (parseWiki "<div>foo</div>"
               ~?=
-              (Right [ BlockCmd (BlockCommand "div" []
-                                 [ Paragraph [Text "foo"] ]) ]))
+              Right [ BlockCmd (BlockCommand "div" []
+                                [ Paragraph [Text "foo"] ]) ])
 
            , (parseWiki "<div>\nbar\n</div>"
               ~?=
-              (Right [ BlockCmd (BlockCommand "div" []
-                                 [ Paragraph [Text "bar"] ]) ]))
+              Right [ BlockCmd (BlockCommand "div" []
+                                [ Paragraph [Text "bar"] ]) ])
 
            , (parseWiki "<div><!-- comment --></div>"
               ~?=
-              (Right [ BlockCmd (BlockCommand "div" [] []) ]))
+              Right [ BlockCmd (BlockCommand "div" [] []) ])
 
            , (parseWiki "foo<div id=\"bar\"/>"
               ~?=
-              (Right [ Paragraph [Text "foo"]
-                     , BlockCmd (BlockCommand "div" [("id", "bar")] [])
-                     ]))
+              Right [ Paragraph [Text "foo"]
+                    , BlockCmd (BlockCommand "div" [("id", "bar")] [])
+                    ])
 
            , (parseWiki "[http://example.org/]"
               ~?=
-              (Right [ Paragraph [ExternalLink (fromJust $ parseURI "http://example.org/") Nothing] ]))
+              Right [ Paragraph [ExternalLink (fromJust $ parseURI "http://example.org/") Nothing] ])
 
            , (parseWiki "[http://example.org/ example.org]"
               ~?=
-              (Right [ Paragraph [ExternalLink
-                                  (fromJust $ parseURI "http://example.org/")
-                                  (Just "example.org")
-                                 ]
-                     ]))
+              Right [ Paragraph [ExternalLink
+                                 (fromJust $ parseURI "http://example.org/")
+                                 (Just "example.org")
+                                ]
+                    ])
            ]