Tests
This commit is contained in:
parent
cae12ef4c0
commit
471de1c68a
1 changed files with 29 additions and 2 deletions
31
test/Spec.hs
31
test/Spec.hs
|
|
@ -1,3 +1,4 @@
|
||||||
|
{-# LANGUAGE MultilineStrings #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -Wno-orphans #-}
|
{-# OPTIONS_GHC -Wno-orphans #-}
|
||||||
|
|
||||||
|
|
@ -18,18 +19,20 @@ main = hspec $ do
|
||||||
describe "minimal" do
|
describe "minimal" do
|
||||||
it "handles unicode" unicode
|
it "handles unicode" unicode
|
||||||
it "escapes" escaping
|
it "escapes" escaping
|
||||||
|
it "images" images
|
||||||
it "maths" math
|
it "maths" math
|
||||||
|
it "numeric entity" numericEntity
|
||||||
|
it "monospace" monospace
|
||||||
|
it "code blocks" codeBlocks
|
||||||
it "anchors" anchor
|
it "anchors" anchor
|
||||||
it "space chars" space
|
it "space chars" space
|
||||||
it "bare string" someString
|
it "bare string" someString
|
||||||
it "emphasis" emphatic
|
it "emphasis" emphatic
|
||||||
it "monospace" monospace
|
|
||||||
it "labeled link" labeledLink
|
it "labeled link" labeledLink
|
||||||
it "markdown link" link
|
it "markdown link" link
|
||||||
it "bird tracks" birdTracks
|
it "bird tracks" birdTracks
|
||||||
it "module names" modules
|
it "module names" modules
|
||||||
it "quotes" quotes
|
it "quotes" quotes
|
||||||
it "numeric entity" numericEntity
|
|
||||||
it "ignores nesting" ignoreNesting
|
it "ignores nesting" ignoreNesting
|
||||||
|
|
||||||
describe "Parser" do
|
describe "Parser" do
|
||||||
|
|
@ -42,6 +45,18 @@ main = hspec $ do
|
||||||
-- Tests
|
-- Tests
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
images :: Expectation
|
||||||
|
images = do
|
||||||
|
"<<image.png>>"
|
||||||
|
`shouldLexTo` [ (1, 3, Picture "image.png" Nothing)
|
||||||
|
]
|
||||||
|
"<<image.png title text>>"
|
||||||
|
`shouldLexTo` [ (1, 3, Picture "image.png" (Just "title text"))
|
||||||
|
]
|
||||||
|
""
|
||||||
|
`shouldLexTo` [ (1, 3, Picture "image.png" (Just "alt text"))
|
||||||
|
]
|
||||||
|
|
||||||
modules :: Expectation
|
modules :: Expectation
|
||||||
modules = do
|
modules = do
|
||||||
"\"MyModule.Name\""
|
"\"MyModule.Name\""
|
||||||
|
|
@ -165,6 +180,18 @@ numericEntity = do
|
||||||
`shouldLexTo` [ (1, 1, NumericEntity 101)
|
`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 :: Expectation
|
||||||
monospace =
|
monospace =
|
||||||
"@mono@"
|
"@mono@"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue