Skip to content

Commit 9a3d87c

Browse files
committed
Add tests and fix for classify by first char
1 parent 0dcf996 commit 9a3d87c

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

haskell-lexeme.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ of a token."
206206
((or (equal char ?_)
207207
(member category '(Ll Lo)))
208208
'varid)
209-
((and (>= char ?0) (<= char 9))
209+
((and (>= char ?0) (<= char ?9))
210210
'number)
211211
((member char '(?\] ?\[ ?\( ?\) ?\{ ?\} ?\` ?\, ?\;))
212212
'special))))

tests/haskell-lexeme-tests.el

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,16 @@ order."
3838
(goto-char (match-end 0)))
3939
(should (equal nil left-lexemes)))))
4040

41+
(ert-deftest haskell-lexeme-classify-chars-1 ()
42+
(should (equal 'varsym (haskell-lexeme-classify-by-first-char ?=)))
43+
(should (equal 'conid (haskell-lexeme-classify-by-first-char ?L)))
44+
(should (equal 'consym (haskell-lexeme-classify-by-first-char ?:)))
45+
(should (equal 'varid (haskell-lexeme-classify-by-first-char ?_)))
46+
(should (equal 'varid (haskell-lexeme-classify-by-first-char ?x)))
47+
(should (equal 'char (haskell-lexeme-classify-by-first-char ?')))
48+
(should (equal 'string (haskell-lexeme-classify-by-first-char ?\")))
49+
(should (equal 'special (haskell-lexeme-classify-by-first-char ?\;)))
50+
(should (equal 'number (haskell-lexeme-classify-by-first-char ?4))))
4151

4252
(ert-deftest haskell-lexeme-basic-tokens-1 ()
4353
"Get some basic self delimiting tokens right"

0 commit comments

Comments
 (0)