diff --git a/test/Spec.hs b/test/Spec.hs index 2040e2f..c75e68a 100644 --- a/test/Spec.hs +++ b/test/Spec.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE MultilineStrings #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -Wno-orphans #-} @@ -18,18 +19,20 @@ main = hspec $ do describe "minimal" do it "handles unicode" unicode it "escapes" escaping + it "images" images it "maths" math + it "numeric entity" numericEntity + it "monospace" monospace + it "code blocks" codeBlocks it "anchors" anchor it "space chars" space it "bare string" someString it "emphasis" emphatic - it "monospace" monospace it "labeled link" labeledLink it "markdown link" link it "bird tracks" birdTracks it "module names" modules it "quotes" quotes - it "numeric entity" numericEntity it "ignores nesting" ignoreNesting describe "Parser" do @@ -42,6 +45,18 @@ main = hspec $ do -- Tests ------------ +images :: Expectation +images = do + "<>" + `shouldLexTo` [ (1, 3, Picture "image.png" Nothing) + ] + "<>" + `shouldLexTo` [ (1, 3, Picture "image.png" (Just "title text")) + ] + "![alt text](image.png)" + `shouldLexTo` [ (1, 3, Picture "image.png" (Just "alt text")) + ] + modules :: Expectation modules = do "\"MyModule.Name\"" @@ -165,6 +180,18 @@ numericEntity = do `shouldLexTo` [ (1, 1, NumericEntity 101) ] +codeBlocks :: Expectation +codeBlocks = + """ + @ + func call here + @ + """ + `shouldLexTo` [ (1, 1, MonospaceOpen) + , (1, 2, Token "\nfunc call here\n") + , (3, 1, MonospaceClose) + ] + monospace :: Expectation monospace = "@mono@"