Added expression eval; adjusted birdtrack, added sol combinator.
This commit is contained in:
parent
449b7c8ca7
commit
f5a9dec3d6
3 changed files with 100 additions and 8 deletions
38
test/Spec.hs
38
test/Spec.hs
|
|
@ -18,7 +18,7 @@ main = hspec $ do
|
|||
describe "minimal" do
|
||||
it "handles unicode" unicode
|
||||
it "escapes" escaping
|
||||
it "maths" math
|
||||
it "maths" maths
|
||||
it "anchors" anchor
|
||||
it "space chars" space
|
||||
it "bare string" someString
|
||||
|
|
@ -29,6 +29,7 @@ main = hspec $ do
|
|||
it "bird tracks" birdTracks
|
||||
it "module names" modules
|
||||
it "quotes" quotes
|
||||
it "expressions" expressions
|
||||
it "numeric entity" numericEntity
|
||||
it "ignores nesting" ignoreNesting
|
||||
|
||||
|
|
@ -91,8 +92,8 @@ anchor =
|
|||
`shouldLexTo` [ (1, 1, Anchor "myAnchor")
|
||||
]
|
||||
|
||||
math :: IO ()
|
||||
math = do
|
||||
maths :: IO ()
|
||||
maths = do
|
||||
"\\[some math\\]"
|
||||
`shouldLexTo` [ (1, 1, MathMultilineOpen)
|
||||
, (1, 3, Token "some math")
|
||||
|
|
@ -128,10 +129,35 @@ ignoreNesting =
|
|||
]
|
||||
|
||||
birdTracks :: Expectation
|
||||
birdTracks =
|
||||
">> code"
|
||||
birdTracks = do
|
||||
"> code line"
|
||||
`shouldLexTo` [ (1, 1, BirdTrack)
|
||||
, (1, 4, Token "code")
|
||||
, (1, 3, Token "code line")
|
||||
]
|
||||
" > not code"
|
||||
`shouldLexTo` [ (1, 1, Space)
|
||||
, (1, 2, Token ">")
|
||||
, (1, 3, Space)
|
||||
, (1, 4, Token "not")
|
||||
, (1, 7, Space)
|
||||
, (1, 8, Token "code")
|
||||
]
|
||||
|
||||
expressions :: Expectation
|
||||
expressions = do
|
||||
">>> eval this"
|
||||
`shouldLexTo` [ (1, 1, Expression)
|
||||
, (1, 5, Token "eval this")
|
||||
]
|
||||
" >>> not eval this"
|
||||
`shouldLexTo` [ (1, 1, Space)
|
||||
, (1, 2, Token ">>>")
|
||||
, (1, 5, Space)
|
||||
, (1, 6, Token "not")
|
||||
, (1, 9, Space)
|
||||
, (1, 10, Token "eval")
|
||||
, (1, 14, Space)
|
||||
, (1, 15, Token "this")
|
||||
]
|
||||
|
||||
quotes :: Expectation
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue