From 9a3d87ccd52fd567d85e70b74bef4db23201d639 Mon Sep 17 00:00:00 2001 From: Gracjan Polak Date: Wed, 13 Jan 2016 16:00:49 +0100 Subject: [PATCH] Add tests and fix for classify by first char --- haskell-lexeme.el | 2 +- tests/haskell-lexeme-tests.el | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/haskell-lexeme.el b/haskell-lexeme.el index 03957cafa..1de854fc9 100644 --- a/haskell-lexeme.el +++ b/haskell-lexeme.el @@ -206,7 +206,7 @@ of a token." ((or (equal char ?_) (member category '(Ll Lo))) 'varid) - ((and (>= char ?0) (<= char 9)) + ((and (>= char ?0) (<= char ?9)) 'number) ((member char '(?\] ?\[ ?\( ?\) ?\{ ?\} ?\` ?\, ?\;)) 'special)))) diff --git a/tests/haskell-lexeme-tests.el b/tests/haskell-lexeme-tests.el index 3b9efb6a9..0714bfadc 100644 --- a/tests/haskell-lexeme-tests.el +++ b/tests/haskell-lexeme-tests.el @@ -38,6 +38,16 @@ order." (goto-char (match-end 0))) (should (equal nil left-lexemes))))) +(ert-deftest haskell-lexeme-classify-chars-1 () + (should (equal 'varsym (haskell-lexeme-classify-by-first-char ?=))) + (should (equal 'conid (haskell-lexeme-classify-by-first-char ?L))) + (should (equal 'consym (haskell-lexeme-classify-by-first-char ?:))) + (should (equal 'varid (haskell-lexeme-classify-by-first-char ?_))) + (should (equal 'varid (haskell-lexeme-classify-by-first-char ?x))) + (should (equal 'char (haskell-lexeme-classify-by-first-char ?'))) + (should (equal 'string (haskell-lexeme-classify-by-first-char ?\"))) + (should (equal 'special (haskell-lexeme-classify-by-first-char ?\;))) + (should (equal 'number (haskell-lexeme-classify-by-first-char ?4)))) (ert-deftest haskell-lexeme-basic-tokens-1 () "Get some basic self delimiting tokens right"