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 #-}
|
||||
{-# 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
|
||||
"<<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 = 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@"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue