Added maths bracketing
This commit is contained in:
parent
9efc312597
commit
7ef411b134
2 changed files with 48 additions and 12 deletions
22
test/Spec.hs
22
test/Spec.hs
|
|
@ -17,6 +17,8 @@ main = hspec $ do
|
|||
describe "Lexer" do
|
||||
describe "minimal" do
|
||||
it "handles unicode" unicode
|
||||
it "escapes" escaping
|
||||
it "maths" maths
|
||||
it "space chars" space
|
||||
it "bare string" someString
|
||||
it "emphasis" emphatic
|
||||
|
|
@ -35,6 +37,26 @@ main = hspec $ do
|
|||
-- Tests
|
||||
------------
|
||||
|
||||
maths :: IO ()
|
||||
maths = do
|
||||
"\\[some math\\]"
|
||||
`shouldLexTo` [ (1, 1, MathsBracketOpen)
|
||||
, (1, 2, Token "some math")
|
||||
, (1, 13, MathsBracketClose)
|
||||
]
|
||||
"\\(other maths\\)"
|
||||
`shouldLexTo` [ (1, 1, MathsParenOpen)
|
||||
, (1, 2, Token "other maths")
|
||||
, (1, 15, MathsParenClose)
|
||||
]
|
||||
|
||||
escaping :: Expectation
|
||||
escaping =
|
||||
"\\("
|
||||
`shouldLexTo` [ (1, 1, Escape)
|
||||
, (1, 2, Token "(")
|
||||
]
|
||||
|
||||
unicode :: Expectation
|
||||
unicode =
|
||||
"ドラゴンクエストの冒険者🐉"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue