branch: externals/bnf-mode
commit d50ded2d2125f3085ce70a1e52459e29cf327314
Author: Serghei Iakovlev <[email protected]>
Commit: Serghei Iakovlev <[email protected]>
Amended tests
---
Makefile | 2 +-
test/bnf-mode-font-test.el | 30 +++++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index c9976cd..3750c2c 100644
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,7 @@
SHELL := $(shell which bash)
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
-EMACS = emacs
+EMACS := emacs
CASK = cask
EMACSFLAGS ?=
TESTFLAGS ?=
diff --git a/test/bnf-mode-font-test.el b/test/bnf-mode-font-test.el
index a0b3805..e099d26 100644
--- a/test/bnf-mode-font-test.el
+++ b/test/bnf-mode-font-test.el
@@ -49,10 +49,38 @@ buffer."
;;;; Font locking
-(ert-deftest bnf-mode-syntax-table/fontify-dq-string ()
+(ert-deftest bnf-mode-syntax-table/fontify-strings ()
:tags '(fontification syntax-table)
(should (eq (bnf-test-face-at 11 "<foo> ::= \"bar\"")
'font-lock-string-face)))
+(ert-deftest bnf-mode-syntax-table/fontify-line-comment ()
+ :tags '(fontification syntax-table)
+ (bnf-test-with-temp-buffer "; A
+
+<stm> ::= <decl> ; foo"
+ (should (eq (bnf-test-face-at 1)
'font-lock-comment-face))
+ (should (eq (bnf-test-face-at 3)
'font-lock-comment-face))
+ (should-not (bnf-test-face-at 5))
+ (should (eq (bnf-test-face-at 24)
'font-lock-comment-face))))
+
+(ert-deftest bnf-mode-syntax-table/fontify-nonterminals ()
+ :tags '(fontification syntax-table)
+ (bnf-test-with-temp-buffer "<stm> ::= <decl>"
+ ;; angle bracket
+ (should-not (bnf-test-face-at 1))
+ ;; "stm"
+ (should (eq (bnf-test-face-at 2)
'font-lock-function-name-face))
+ (should (eq (bnf-test-face-at 4)
'font-lock-function-name-face))
+ ;; angle bracket
+ (should-not (bnf-test-face-at 5))
+ ;; "may expand into" symbol
+ (should-not (eq (bnf-test-face-at 7)
'font-lock-function-name-face))
+ ;; angle bracket
+ (should-not (bnf-test-face-at 11))
+ ;; "dec" symbol
+ (should-not (eq (bnf-test-face-at 12)
'font-lock-function-name-face))
+ (should-not (eq (bnf-test-face-at 15)
'font-lock-function-name-face))))
+
(provide 'bnf-mode-font-test)
;;; bnf-mode-font-test.el ends here