Parse links, module names
This commit is contained in:
parent
7d4cab4857
commit
82dcb6913e
2 changed files with 90 additions and 17 deletions
31
test/Spec.hs
31
test/Spec.hs
|
|
@ -24,7 +24,9 @@ main = hspec $ do
|
|||
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 "ignores nesting" ignoreNesting
|
||||
|
||||
|
|
@ -38,6 +40,31 @@ main = hspec $ do
|
|||
-- Tests
|
||||
------------
|
||||
|
||||
modules :: Expectation
|
||||
modules = do
|
||||
"\"MyModule.Name\""
|
||||
`shouldLexTo` [ (1, 1, Module)
|
||||
, (1, 2, Token "MyModule.Name")
|
||||
]
|
||||
|
||||
"\"OtherModule.Name#myAnchor\""
|
||||
`shouldLexTo` [ (1, 1, Module)
|
||||
, (1, 2, Token "OtherModule.Name")
|
||||
, (1, 18, Anchor)
|
||||
, (1, 19, Token "myAnchor")
|
||||
]
|
||||
|
||||
link :: Expectation
|
||||
link =
|
||||
"[link to](http://some.website)"
|
||||
`shouldLexTo` [ (1, 1, BracketOpen)
|
||||
, (1, 2, Token "link to")
|
||||
, (1, 9, BracketClose)
|
||||
, (1, 10, ParenOpen)
|
||||
, (1, 11, Token "http://some.website")
|
||||
, (1, 30, ParenClose)
|
||||
]
|
||||
|
||||
labeledLink :: Expectation
|
||||
labeledLink =
|
||||
"<[link here](http://to.here) label>"
|
||||
|
|
@ -48,8 +75,8 @@ labeledLink =
|
|||
, (1, 13, ParenOpen)
|
||||
, (1, 14, Token "http://to.here")
|
||||
, (1, 28, ParenClose)
|
||||
, (1, 29, Space)
|
||||
, (1, 30, Token "label>")
|
||||
, (1, 29, Token " label")
|
||||
, (1, 35, LabeledLinkClose)
|
||||
]
|
||||
|
||||
maths :: IO ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue