diff --git a/CHANGELOG.md b/CHANGELOG.md index f782e356..e0934273 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ * [#429](https://github.com/clojure-emacs/clojure-mode/issues/429): Fix a bug causing last occurrence of expression sometimes is not replaced when using `move-to-let`. * [#423](https://github.com/clojure-emacs/clojure-mode/issues/423): Make `clojure-match-next-def` more robust against zero-arity def-like forms. * [#451](https://github.com/clojure-emacs/clojure-mode/issues/451): Make project root directory calculation customized by `clojure-project-root-function`. +* Stop distinctive font-locking of java interop methods & constants: There is no semantic distinction between interop methods, constants and global vars in clojure. +* Fix namespace font-locking: namespaces may also contain non alphanumeric chars. + ## 5.6.1 (2016-12-21) diff --git a/clojure-mode.el b/clojure-mode.el index 3bc00995..073e2879 100644 --- a/clojure-mode.el +++ b/clojure-mode.el @@ -92,11 +92,6 @@ "Face used to font-lock Clojure character literals." :package-version '(clojure-mode . "3.0.0")) -(defface clojure-interop-method-face - '((t (:inherit font-lock-preprocessor-face))) - "Face used to font-lock interop method names (camelCase)." - :package-version '(clojure-mode . "3.0.0")) - (defcustom clojure-indent-style :always-align "Indentation style to use for function forms and macro forms. There are two cases of interest configured by this variable. @@ -848,29 +843,45 @@ any number of matches of `clojure--sym-forbidden-rest-chars'.")) 0 font-lock-constant-face) ;; Character literals - \1, \a, \newline, \u0000 ("\\\\\\([[:punct:]]\\|[a-z0-9]+\\>\\)" 0 'clojure-character-face) - ;; foo/ Foo/ @Foo/ /FooBar - (,(concat "\\(?:\\<:?\\|\\.\\)@?\\(" clojure--sym-regexp "\\)\\(/\\)") - (1 font-lock-type-face) (2 'default)) - ;; Constant values (keywords), including as metadata e.g. ^:static - ("\\<^?\\(:\\(\\sw\\|\\s_\\)+\\(\\>\\|\\_>\\)\\)" 1 'clojure-keyword-face append) - ;; Java interop highlighting - ;; CONST SOME_CONST (optionally prefixed by /) - ("\\(?:\\<\\|/\\)\\([A-Z]+\\|\\([A-Z]+_[A-Z1-9_]+\\)\\)\\>" 1 font-lock-constant-face) - ;; .foo .barBaz .qux01 .-flibble .-flibbleWobble - ("\\<\\.-?[a-z][a-zA-Z0-9]*\\>" 0 'clojure-interop-method-face) - ;; Foo Bar$Baz Qux_ World_OpenUDP Foo. Babylon15. - ("\\(?:\\<\\|\\.\\|/\\|#?^\\)\\([A-Z][a-zA-Z0-9_]*[a-zA-Z0-9$_]+\\.?\\>\\)" 1 font-lock-type-face) - ;; foo.bar.baz - ("\\<^?\\([a-z][a-z0-9_-]+\\.\\([a-z][a-z0-9_-]*\\.?\\)+\\)" 1 font-lock-type-face) - ;; (ns namespace) - special handling for single segment namespaces + + ;; namespace definitions: (ns foo.bar) (,(concat "(\\[ \r\n\t]*" ;; Possibly metadata "\\(?:\\^?{[^}]+}[ \r\n\t]*\\)*" ;; namespace - "\\([a-z0-9-]+\\)") - (1 font-lock-type-face nil t)) - ;; fooBar - ("\\(?:\\<\\|/\\)\\([a-z]+[A-Z]+[a-zA-Z0-9$]*\\>\\)" 1 'clojure-interop-method-face) + "\\(" clojure--sym-regexp "\\)") + (1 font-lock-type-face)) + + ;; TODO dedupe the code for matching of keywords, type-hints and unmatched symbols + + ;; keywords: {:oneword/veryCom|pLex.stu-ff 0} + (,(concat "\\(:\\)\\(" clojure--sym-regexp "\\)\\(/\\)\\(" clojure--sym-regexp "\\)") + (1 'clojure-keyword-face) + (2 font-lock-type-face) + (3 'default) + (4 'clojure-keyword-face)) + (,(concat "\\(:\\)\\(" clojure--sym-regexp "\\)") + (1 'clojure-keyword-face) + (2 'clojure-keyword-face)) + + ;; type-hints: #^oneword + (,(concat "\\(#^\\)\\(" clojure--sym-regexp "\\)\\(/\\)\\(" clojure--sym-regexp "\\)") + (1 'default) + (2 font-lock-type-face) + (3 'default) + (4 'default)) + (,(concat "\\(#^\\)\\(" clojure--sym-regexp "\\)") + (1 'default) + (2 font-lock-type-face)) + + ;; clojure symbols not matched by the previous regexps + (,(concat "\\(" clojure--sym-regexp "\\)\\(/\\)\\(" clojure--sym-regexp "\\)") + (1 font-lock-type-face) + (2 'default) + (3 'default)) + (,(concat "\\(" clojure--sym-regexp "\\)") + (1 'default)) + ;; #_ and (comment ...) macros. (clojure--search-comment-macro 1 font-lock-comment-face t) ;; Highlight `code` marks, just like `elisp'. diff --git a/test.clj b/test.clj index 2a0fca09..50679e0b 100644 --- a/test.clj +++ b/test.clj @@ -1,9 +1,43 @@ ;;; font locking (ns clojure-mode.demo - (:require [clojure.something] - [something.s])) + (:require + [oneword] + [seg.mnt] + [mxdCase] + [CmlCase] + [veryCom|pLex.stu-ff])) + +(defn foo [x] x) +;; try to byte-recompile the clojure-mode.el when the face of 'fn' is 't' +(fn foo [x] x) + +#_ +;; the myfn sexp should have a comment face +(mysfn 101 + foo + + 0 0i) + +;; examples of valid namespace definitions +(comment + (ns .validns) + (ns =validns) + (ns .ValidNs=<>?+|?*.) + (ns ValidNs<>?+|?*.b*ar.ba*z) + (ns other.valid.ns) + (ns oneword) + (ns one.X) + (ns foo.bar) + (ns Foo.bar) + (ns Foo.Bar) + (ns foo.Bar) + (ns Foo-bar) + (ns Foo-Bar) + (ns foo-Bar)) (comment ;; for indentation + 'some/symbol + (with-hi heya somebuddy) @@ -19,11 +53,137 @@ ;; character literals [\a \newline \u0032 \/ \+ \,, \;] -;; namespaced/static calls/references -(core.foo-baz/bar) -@foo-bar/bar -(FooBar/bar) -(some.package.FooBar/baz) +;; TODO change font-face for sexps starting with @,# +(comment ;; examples + + SCREAMING_UPPER_CASE + veryCom|pLex.stu-ff/.SCREAMING_UPPER_CASE + + oneword + @oneword + #oneword + #^oneword ;; type-hint + .oneword + (oneword) + (oneword/oneword) + (oneword/seg.mnt) + (oneword/CmlCase) + (oneword/mxdCase) + (oneword/veryCom|pLex.stu-ff) + (oneword/.veryCom|pLex.stu-ff) + + seg.mnt + @seg.mnt + #seg.mnt + #^seg.mnt ;; type-hint + .seg.mnt + (seg.mnt) + (seg.mnt/oneword) + (seg.mnt/seg.mnt) + (seg.mnt/CmlCase) + (seg.mnt/mxdCase) + (seg.mnt/veryCom|pLex.stu-ff) + (seg.mnt/.veryCom|pLex.stu-ff) + + CmlCase + @CmlCase + #CmlCase + #^CmlCase ;; type-hint + .CmlCase + (CmlCase) + (CmlCase/oneword) + (CmlCase/seg.mnt) + (CmlCase/CmlCase) + (CmlCase/mxdCase) + (CmlCase/veryCom|pLex.stu-ff) + (CmlCase/.veryCom|pLex.stu-ff) + + mxdCase + @mxdCase + #mxdCase + #^mxdCase ;; type-hint + .mxdCase + (mxdCase) + (mxdCase/oneword) + (mxdCase/seg.mnt) + (mxdCase/CmlCase) + (mxdCase/mxdCase) + (mxdCase/veryCom|pLex.stu-ff) + (mxdCase/.veryCom|pLex.stu-ff) + + veryCom|pLex.stu-ff + @veryCom|pLex.stu-ff + #veryCom|pLex.stu-ff + #^veryCom|pLex.stu-ff ;; type-hint + .veryCom|pLex.stu-ff + (veryCom|pLex.stu-ff) + (veryCom|pLex.stu-ff/oneword) + (veryCom|pLex.stu-ff/seg.mnt) + (veryCom|pLex.stu-ff/CmlCase) + (veryCom|pLex.stu-ff/mxdCase) + (veryCom|pLex.stu-ff/veryCom|pLex.stu-ff) + (veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff) + + :oneword + {:oneword 0} + ;; {:@oneword 0} ; not allowed + {:#oneword 0} + {:.oneword 0} + {:oneword/oneword 0} + {:oneword/seg.mnt 0} + {:oneword/CmlCase 0} + {:oneword/mxdCase 0} + {:oneword/veryCom|pLex.stu-ff 0} + {:oneword/.veryCom|pLex.stu-ff 0} + + {:seg.mnt 0} + ;; {:@seg.mnt 0} ; not allowed + {:#seg.mnt 0} + {:.seg.mnt 0} + {:seg.mnt/oneword 0} + {:seg.mnt/seg.mnt 0} + {:seg.mnt/CmlCase 0} + {:seg.mnt/mxdCase 0} + {:seg.mnt/veryCom|pLex.stu-ff 0} + {:seg.mnt/.veryCom|pLex.stu-ff 0} + + :CmlCase + {:CmlCase 0} + ;; {:@CmlCase 0} ; not allowed + {:#CmlCase 0} + {:.CmlCase 0} + {:CmlCase/oneword 0} + {:CmlCase/seg.mnt 0} + {:CmlCase/CmlCase 0} + {:CmlCase/mxdCase 0} + {:CmlCase/veryCom|pLex.stu-ff 0} + {:CmlCase/.veryCom|pLex.stu-ff 0} + + :mxdCase + {:mxdCase 0} + ;; {:@mxdCase 0} ; not allowed + {:#mxdCase 0} + {:.mxdCase 0} + {:mxdCase/oneword 0} + {:mxdCase/seg.mnt 0} + {:mxdCase/CmlCase 0} + {:mxdCase/mxdCase 0} + {:mxdCase/veryCom|pLex.stu-ff 0} + {:mxdCase/.veryCom|pLex.stu-ff 0} + + :veryCom|pLex.stu-ff + {:veryCom|pLex.stu-ff 0} + ;; {:@veryCom|pLex.stu-ff 0} ; not allowed + {:#veryCom|pLex.stu-ff 0} + {:.veryCom|pLex.stu-ff 0} + {:veryCom|pLex.stu-ff 0} + {:veryCom|pLex.stu-ff/oneword 0} + {:veryCom|pLex.stu-ff/seg.mnt 0} + {:veryCom|pLex.stu-ff/CmlCase 0} + {:veryCom|pLex.stu-ff/mxdCase 0} + {:veryCom|pLex.stu-ff/veryCom|pLex.stu-ff 0} + {:veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff 0} + ) ;; metadata doesn't break docstrings (defn max diff --git a/test/clojure-mode-font-lock-test.el b/test/clojure-mode-font-lock-test.el index 9716d159..6e36ebdb 100644 --- a/test/clojure-mode-font-lock-test.el +++ b/test/clojure-mode-font-lock-test.el @@ -1,4 +1,5 @@ -;;; clojure-mode-font-lock-test.el --- Clojure Mode: Font lock test suite -*- lexical-binding: t; -*- +;;; clojure-mode-font-lock-test.el --- Clojure Mode: Font lock test suite +;; -*- lexical-binding: t; -*- ;; Copyright (C) 2014-2018 Bozhidar Batsov @@ -43,7 +44,8 @@ (defun clojure-get-face-at-range (start end) (let ((start-face (get-text-property start 'face)) - (all-faces (cl-loop for i from start to end collect (get-text-property i 'face)))) + (all-faces (cl-loop for i from start to end collect (get-text-property + i 'face)))) (if (cl-every (lambda (face) (eq face start-face)) all-faces) start-face 'various-faces))) @@ -78,122 +80,555 @@ POS." ;;;; Font locking -(ert-deftest clojure-mode-syntax-table/fontify-clojure-keyword () - :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 2 11 "{:something 20}") '(clojure-keyword-face)))) - (ert-deftest clojure-mode-syntax-table/stuff-in-backticks () :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 1 2 "\"`#'s/trim`\"") font-lock-string-face)) - (should (equal (clojure-test-face-at 3 10 "\"`#'s/trim`\"") '(font-lock-constant-face font-lock-string-face))) - (should (equal (clojure-test-face-at 11 12 "\"`#'s/trim`\"") font-lock-string-face)) - (should (equal (clojure-test-face-at 1 1 ";`#'s/trim`") font-lock-comment-delimiter-face)) - (should (equal (clojure-test-face-at 2 2 ";`#'s/trim`") font-lock-comment-face)) - (should (equal (clojure-test-face-at 3 10 ";`#'s/trim`") '(font-lock-constant-face font-lock-comment-face))) - (should (equal (clojure-test-face-at 11 11 ";`#'s/trim`") font-lock-comment-face))) + (should (equal (clojure-test-face-at 1 2 "\"`#'s/trim`\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 3 10 "\"`#'s/trim`\"") + '(font-lock-constant-face font-lock-string-face))) + (should (equal (clojure-test-face-at 11 12 "\"`#'s/trim`\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 1 1 ";`#'s/trim`") + font-lock-comment-delimiter-face)) + (should (equal (clojure-test-face-at 2 2 ";`#'s/trim`") + font-lock-comment-face)) + (should (equal (clojure-test-face-at 3 10 ";`#'s/trim`") + '(font-lock-constant-face font-lock-comment-face))) + (should (equal (clojure-test-face-at 11 11 ";`#'s/trim`") + font-lock-comment-face))) (ert-deftest clojure-mode-syntax-table/stuff-in-backticks () :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 1 2 "\"a\\bc\\n\"") font-lock-string-face)) - (should (equal (clojure-test-face-at 3 4 "\"a\\bc\\n\"") '(bold font-lock-string-face))) - (should (equal (clojure-test-face-at 5 5 "\"a\\bc\\n\"") font-lock-string-face)) - (should (equal (clojure-test-face-at 6 7 "\"a\\bc\\n\"") '(bold font-lock-string-face))) - (should (equal (clojure-test-face-at 4 5 "#\"a\\bc\\n\"") '(bold font-lock-string-face)))) - -(ert-deftest clojure-mode-syntax-table/fontify-namespaced-keyword () - :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 9 11 "(:alias/def x 10)") '(clojure-keyword-face))) - (should (equal (clojure-test-face-at 2 2 "{:alias/some 20}") '(clojure-keyword-face))) - (should (equal (clojure-test-face-at 3 7 "{:alias/some 20}") '(font-lock-type-face clojure-keyword-face))) - (should (equal (clojure-test-face-at 8 8 "{:alias/some 20}") '(default clojure-keyword-face))) - (should (equal (clojure-test-face-at 9 12 "{:alias/some 20}") '(clojure-keyword-face))) - (should (equal (clojure-test-face-at 2 2 "{:a.ias/some 20}") '(clojure-keyword-face))) - (should (equal (clojure-test-face-at 3 7 "{:a.ias/some 20}") '(font-lock-type-face clojure-keyword-face))) - (should (equal (clojure-test-face-at 8 8 "{:a.ias/some 20}") '(default clojure-keyword-face))) - (should (equal (clojure-test-face-at 9 12 "{:a.ias/some 20}") '(clojure-keyword-face)))) + (should (equal (clojure-test-face-at 1 2 "\"a\\bc\\n\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 3 4 "\"a\\bc\\n\"") + '(bold font-lock-string-face))) + (should (equal (clojure-test-face-at 5 5 "\"a\\bc\\n\"") + font-lock-string-face)) + (should (equal (clojure-test-face-at 6 7 "\"a\\bc\\n\"") + '(bold font-lock-string-face))) + (should (equal (clojure-test-face-at 4 5 "#\"a\\bc\\n\"") + '(bold font-lock-string-face)))) (ert-deftest clojure-mode-syntax-table/fontify-let-when-while-type-forms () :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 2 11 "(when-alist [x 1]\n ())") 'font-lock-keyword-face)) - (should (equal (clojure-test-face-at 2 12 "(while-alist [x 1]\n ())") 'font-lock-keyword-face)) - (should (equal (clojure-test-face-at 2 10 "(let-alist [x 1]\n ())") 'font-lock-keyword-face))) + (should (equal (clojure-test-face-at 2 11 "(when-alist [x 1]\n ())") + 'font-lock-keyword-face)) + (should (equal (clojure-test-face-at 2 12 "(while-alist [x 1]\n ())") + 'font-lock-keyword-face)) + (should (equal (clojure-test-face-at 2 10 "(let-alist [x 1]\n ())") + 'font-lock-keyword-face))) (ert-deftest clojure-mode-syntax-table/comment-macros () :tags '(fontification syntax-table) - (should (not (clojure-test-face-at 1 2 "#_ \n;; some crap\n (lala 0101\n lao\n\n 0 0i)"))) - (should (equal (clojure-test-face-at 5 41 "#_ \n;; some crap\n (lala 0101\n lao\n\n 0 0i)") 'font-lock-comment-face))) - -(ert-deftest clojure-mode-syntax-table/type () - :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 1 9 "SomeClass") 'font-lock-type-face))) - -(ert-deftest clojure-mode-syntax-table/type-hint () - :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "#^SomeClass" - (should (eq (clojure-test-face-at 3 11) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 1 2) nil)))) - -(ert-deftest clojure-mode-syntax-table/constructor () - :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 2 11 "(SomeClass.)") 'font-lock-type-face)) - (clojure-test-with-temp-buffer "(ns/SomeClass.)" - (should (eq (clojure-test-face-at 2 3) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 5 14) 'font-lock-type-face)))) + (should (equal (clojure-test-face-at + 1 2 "#_") + 'default)) + (should (equal (clojure-test-face-at + 1 2 "#_ \n;; some crap\n (lala 0101\n lao\n\n 0 0i)") + 'default)) + (should (equal (clojure-test-face-at + 5 41 "#_ \n;; some crap\n (lala 0101\n lao\n\n 0 0i)") + 'font-lock-comment-face))) (ert-deftest clojure-mode-syntax-table/namespace () :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 1 5 "one.p") 'font-lock-type-face)) - (should (eq (clojure-test-face-at 1 11 "one.p.top13") 'font-lock-type-face)) - (should (eq (clojure-test-face-at 2 12 "^one.p.top13") 'font-lock-type-face))) - -(ert-deftest clojure-mode-syntax-table/namespaced-symbol () - :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "clo.core/something" - (should (eq (clojure-test-face-at 9 9) 'default)) - (should (eq (clojure-test-face-at 1 8) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 10 18) nil))) - (clojure-test-with-temp-buffer "a/something" - (should (eq (clojure-test-face-at 1 1) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 3 12) 'nil)) - (should (eq (clojure-test-face-at 2 2) 'default))) - (clojure-test-with-temp-buffer "abc/something" - (should (eq (clojure-test-face-at 1 3) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 5 14) 'nil)) - (should (eq (clojure-test-face-at 4 4) 'default)))) - -(ert-deftest clojure-mode-syntax-table/static-method () - :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "Class/methodName" - (should (eq (clojure-test-face-at 1 5) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 6 6) 'default)) - (should (eq (clojure-test-face-at 7 16) 'clojure-interop-method-face))) - (clojure-test-with-temp-buffer "SomeClass/methodName" - (should (eq (clojure-test-face-at 1 9) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 10 10) 'default)) - (should (eq (clojure-test-face-at 11 20) 'clojure-interop-method-face))) - (clojure-test-with-temp-buffer "clojure.lang.Var/someMethod" - (should (eq (clojure-test-face-at 1 16) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 17 17) 'default)) - (should (eq (clojure-test-face-at 18 27) 'clojure-interop-method-face)))) - -(ert-deftest clojure-mode-syntax-table/interop-method () - :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 1 11 ".someMethod") 'clojure-interop-method-face)) - (should (eq (clojure-test-face-at 1 10 "someMethod") 'clojure-interop-method-face)) - (should (eq (clojure-test-face-at 1 11 "topHttpTest") 'clojure-interop-method-face)) - (should (eq (clojure-test-face-at 1 4 "getX") 'clojure-interop-method-face))) - -(ert-deftest clojure-mode-syntax-table/constant () - :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 1 5 "CONST") 'font-lock-constant-face)) - (should (eq (clojure-test-face-at 1 10 "CONST_NAME") 'font-lock-constant-face))) - -(ert-deftest clojure-mode-syntax-table/class-constant () - :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "Class/CONST_NAME" - (should (eq (clojure-test-face-at 6 6) 'default)) - (should (eq (clojure-test-face-at 1 5) 'font-lock-type-face)) - (should (eq (clojure-test-face-at 7 16) 'font-lock-constant-face)))) + (should (eq (clojure-test-face-at 5 12 "(ns .validns)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 12 "(ns =validns)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 21 "(ns .ValidNs=<>?+|?*.)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 28 "(ns ValidNs<>?+|?*.b*ar.ba*z)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 18 "(ns other.valid.ns)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns oneword)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns foo.bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns Foo.bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns Foo.Bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns foo.Bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns Foo-bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns Foo-Bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 11 "(ns foo-Bar)") 'font-lock-type-face)) + (should (eq (clojure-test-face-at 5 9 "(ns one.X)") 'font-lock-type-face))) + +(ert-deftest clojure-mode-syntax-table/oneword () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 2 8 " oneword") 'default)) + (should (eq (clojure-test-face-at 2 8 "@oneword") 'default)) + (should (eq (clojure-test-face-at 2 8 "#oneword") 'default)) + (should (eq (clojure-test-face-at 2 8 ".oneword") 'default)) + (should (eq (clojure-test-face-at 3 9 "#^oneword") + 'font-lock-type-face)) ;; type-hint + (should (eq (clojure-test-face-at 2 8 "(oneword)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/oneword)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/oneword)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(oneword/oneword)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/seg.mnt)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/seg.mnt)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(oneword/seg.mnt)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/mxdCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/mxdCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(oneword/mxdCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/CmlCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/CmlCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(oneword/CmlCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 11 28 "(oneword/veryCom|pLex.stu-ff)") + 'default)) + + (should (eq (clojure-test-face-at 2 8 "(oneword/.veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(oneword/.veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 12 29 "(oneword/.veryCom|pLex.stu-ff)") + 'default))) + +(ert-deftest clojure-mode-syntax-table/segment () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 2 8 " seg.mnt") 'default)) + (should (eq (clojure-test-face-at 2 8 "@seg.mnt") 'default)) + (should (eq (clojure-test-face-at 2 8 "#seg.mnt") 'default)) + (should (eq (clojure-test-face-at 2 8 ".seg.mnt") 'default)) + (should (eq (clojure-test-face-at 3 9 "#^seg.mnt") + 'font-lock-type-face)) ;; type-hint + (should (eq (clojure-test-face-at 2 8 "(seg.mnt)") 'default)) + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/oneword)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/oneword)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(seg.mnt/oneword)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/seg.mnt)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/seg.mnt)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(seg.mnt/seg.mnt)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/mxdCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/mxdCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(seg.mnt/mxdCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/CmlCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/CmlCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(seg.mnt/CmlCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 11 28 "(seg.mnt/veryCom|pLex.stu-ff)") + 'default)) + + (should (eq (clojure-test-face-at 2 8 "(seg.mnt/.veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(seg.mnt/.veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 12 29 "(seg.mnt/.veryCom|pLex.stu-ff)") + 'default))) + +(ert-deftest clojure-mode-syntax-table/camelcase () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 2 8 " CmlCase") 'default)) + (should (eq (clojure-test-face-at 2 8 "@CmlCase") 'default)) + (should (eq (clojure-test-face-at 2 8 "#CmlCase") 'default)) + (should (eq (clojure-test-face-at 2 8 ".CmlCase") 'default)) + (should (eq (clojure-test-face-at 3 9 "#^CmlCase") + 'font-lock-type-face)) ;; type-hint + (should (eq (clojure-test-face-at 2 8 "(CmlCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/oneword)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/oneword)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(CmlCase/oneword)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/seg.mnt)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/seg.mnt)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(CmlCase/seg.mnt)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/mxdCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/mxdCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(CmlCase/mxdCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/CmlCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/CmlCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(CmlCase/CmlCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 11 28 "(CmlCase/veryCom|pLex.stu-ff)") + 'default)) + + (should (eq (clojure-test-face-at 2 8 "(CmlCase/.veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(CmlCase/.veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 12 29 "(CmlCase/.veryCom|pLex.stu-ff)") + 'default))) + +(ert-deftest clojure-mode-syntax-table/mixedcase () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 2 8 " mxdCase") 'default)) + (should (eq (clojure-test-face-at 2 8 "@mxdCase") 'default)) + (should (eq (clojure-test-face-at 2 8 "#mxdCase") 'default)) + (should (eq (clojure-test-face-at 2 8 ".mxdCase") 'default)) + (should (eq (clojure-test-face-at 3 9 "#^mxdCase") + 'font-lock-type-face)) ;; type-hint + (should (eq (clojure-test-face-at 2 8 "(mxdCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/oneword)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/oneword)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(mxdCase/oneword)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/seg.mnt)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/seg.mnt)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(mxdCase/seg.mnt)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/mxdCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/mxdCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(mxdCase/mxdCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/CmlCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/CmlCase)") 'default)) + (should (eq (clojure-test-face-at 11 16 "(mxdCase/CmlCase)") 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 11 28 "(mxdCase/veryCom|pLex.stu-ff)") + 'default)) + + (should (eq (clojure-test-face-at 2 8 "(mxdCase/.veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 9 10 "(mxdCase/.veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at 12 29 "(mxdCase/.veryCom|pLex.stu-ff)") + 'default))) + +(ert-deftest clojure-mode-syntax-table/verycomplex () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 21 " veryCom|pLex.stu-ff") 'default)) + (should (eq (clojure-test-face-at 3 21 " @veryCom|pLex.stu-ff") 'default)) + (should (eq (clojure-test-face-at 3 21 " #veryCom|pLex.stu-ff") 'default)) + (should (eq (clojure-test-face-at 3 21 " .veryCom|pLex.stu-ff") 'default)) + (should (eq (clojure-test-face-at 3 21 "#^veryCom|pLex.stu-ff") + 'font-lock-type-face)) ;; type-hint + (should (eq (clojure-test-face-at 3 21 " (veryCom|pLex.stu-ff)") 'default)) + + (should (eq (clojure-test-face-at 3 21 " (veryCom|pLex.stu-ff/oneword)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 " (veryCom|pLex.stu-ff/oneword)") + 'default)) + (should (eq (clojure-test-face-at 23 29 " (veryCom|pLex.stu-ff/oneword)") + 'default)) + + (should (eq (clojure-test-face-at 3 21 " (veryCom|pLex.stu-ff/seg.mnt)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 " (veryCom|pLex.stu-ff/seg.mnt)") + 'default)) + (should (eq (clojure-test-face-at 22 29 " (veryCom|pLex.stu-ff/seg.mnt)") + 'default)) + + (should (eq (clojure-test-face-at 3 21 " (veryCom|pLex.stu-ff/mxdCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 " (veryCom|pLex.stu-ff/mxdCase)") + 'default)) + (should (eq (clojure-test-face-at 22 29 " (veryCom|pLex.stu-ff/mxdCase)") + 'default)) + + (should (eq (clojure-test-face-at 3 21 " (veryCom|pLex.stu-ff/CmlCase)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 " (veryCom|pLex.stu-ff/CmlCase)") + 'default)) + (should (eq (clojure-test-face-at 22 29 " (veryCom|pLex.stu-ff/CmlCase)") + 'default)) + + (should (eq (clojure-test-face-at + 3 21 " (veryCom|pLex.stu-ff/veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at + 22 22 " (veryCom|pLex.stu-ff/veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at + 23 41 " (veryCom|pLex.stu-ff/veryCom|pLex.stu-ff)") + 'default)) + + (should (eq (clojure-test-face-at + 3 21 " (veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff)") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at + 22 22 " (veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff)") + 'default)) + (should (eq (clojure-test-face-at + 23 42 " (veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff)") + 'default))) + +(ert-deftest clojure-mode-syntax-table/kw-oneword () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 9 " :oneword") 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:oneword 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:#oneword 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:.oneword 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/oneword 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/oneword 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:oneword/oneword 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/seg.mnt 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/seg.mnt 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:oneword/seg.mnt 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/CmlCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/CmlCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:oneword/CmlCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/mxdCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/mxdCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:oneword/mxdCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 29 "{:oneword/veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:oneword/.veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:oneword/.veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 30 "{:oneword/.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face))) + +(ert-deftest clojure-mode-syntax-table/kw-segment () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 9 " :seg.mnt") 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:#seg.mnt 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:.seg.mnt 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/oneword 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/oneword 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:seg.mnt/oneword 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/seg.mnt 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/seg.mnt 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:seg.mnt/seg.mnt 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/CmlCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/CmlCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:seg.mnt/CmlCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/mxdCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/mxdCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:seg.mnt/mxdCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 29 "{:seg.mnt/veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:seg.mnt/.veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:seg.mnt/.veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 30 "{:seg.mnt/.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face))) + +(ert-deftest clojure-mode-syntax-table/kw-camelcase () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 9 " :CmlCase") 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:#CmlCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:.CmlCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/oneword 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/oneword 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:CmlCase/oneword 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/seg.mnt 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/seg.mnt 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:CmlCase/seg.mnt 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/CmlCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/CmlCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:CmlCase/CmlCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/mxdCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/mxdCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:CmlCase/mxdCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 29 "{:CmlCase/veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:CmlCase/.veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:CmlCase/.veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 30 "{:CmlCase/.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face))) + +(ert-deftest clojure-mode-syntax-table/kw-mixedcase () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 9 " :mxdCase") 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:mxdCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:#mxdCase 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 10 "{:.mxdCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/oneword 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/oneword 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:mxdCase/oneword 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/seg.mnt 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/seg.mnt 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:mxdCase/seg.mnt 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/CmlCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/CmlCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:mxdCase/CmlCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/mxdCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/mxdCase 0}") 'default)) + (should (eq (clojure-test-face-at 11 17 "{:mxdCase/mxdCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 29 "{:mxdCase/veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:mxdCase/.veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 10 10 "{:mxdCase/.veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at 11 30 "{:mxdCase/.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face))) + +(ert-deftest clojure-mode-syntax-table/kw-verycomplex () + :tags '(fontification syntax-table) + (should (eq (clojure-test-face-at 3 9 " :veryCom|pLex.stu-ff") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:#veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + (should (eq (clojure-test-face-at 3 9 "{:.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 21 "{:veryCom|pLex.stu-ff/oneword 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 "{:veryCom|pLex.stu-ff/oneword 0}") + 'default)) + (should (eq (clojure-test-face-at 23 29 "{:veryCom|pLex.stu-ff/oneword 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:veryCom|pLex.stu-ff/seg.mnt 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 "{:veryCom|pLex.stu-ff/seg.mnt 0}") + 'default)) + (should (eq (clojure-test-face-at 23 29 "{:veryCom|pLex.stu-ff/seg.mnt 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:veryCom|pLex.stu-ff/CmlCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 "{:veryCom|pLex.stu-ff/CmlCase 0}") + 'default)) + (should (eq (clojure-test-face-at 23 29 "{:veryCom|pLex.stu-ff/CmlCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at 3 9 "{:veryCom|pLex.stu-ff/mxdCase 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at 22 22 "{:veryCom|pLex.stu-ff/mxdCase 0}") + 'default)) + (should (eq (clojure-test-face-at 23 29 "{:veryCom|pLex.stu-ff/mxdCase 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at + 3 21 "{:veryCom|pLex.stu-ff/veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at + 22 22 "{:veryCom|pLex.stu-ff/veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at + 23 41 "{:veryCom|pLex.stu-ff/veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face)) + + (should (eq (clojure-test-face-at + 3 21 "{:veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff 0}") + 'font-lock-type-face)) + (should (eq (clojure-test-face-at + 22 22 "{:veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff 0}") + 'default)) + (should (eq (clojure-test-face-at + 23 42 "{:veryCom|pLex.stu-ff/.veryCom|pLex.stu-ff 0}") + 'clojure-keyword-face))) (ert-deftest clojure-mode-syntax-table/namespaced-def () :tags '(fontification syntax-table) @@ -210,9 +645,10 @@ POS." (ert-deftest clojure-mode-syntax-table/variable-def () :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "(def foo 10)" - (should (eq (clojure-test-face-at 2 4) 'font-lock-keyword-face)) - (should (eq (clojure-test-face-at 6 8) 'font-lock-variable-name-face)))) + (should (eq (clojure-test-face-at 2 4 "(def foo 10)") + 'font-lock-keyword-face)) + (should (eq (clojure-test-face-at 6 8 "(def foo 10)") + 'font-lock-variable-name-face))) (ert-deftest clojure-mode-syntax-table/type-def () :tags '(fontification syntax-table) @@ -246,9 +682,11 @@ POS." (ert-deftest clojure-mode-syntax-table/fn () :tags '(fontification syntax-table) - (clojure-test-with-temp-buffer "(fn foo [x] x)" - (should (eq (clojure-test-face-at 2 3) 'font-lock-keyword-face)) - (should (eq (clojure-test-face-at 5 7) 'font-lock-function-name-face)))) + ;; try to byte-recompile the clojure-mode.el when the face of 'fn' is 't' + (should (eq (clojure-test-face-at 2 3 "(fn foo [x] x)") + 'font-lock-keyword-face)) + (should (eq (clojure-test-face-at 5 7 "(fn foo [x] x)") + 'font-lock-function-name-face))) (ert-deftest clojure-mode-syntax-table/lambda-params () :tags '(fontification syntax-table) @@ -261,34 +699,37 @@ POS." (ert-deftest clojure-mode-syntax-table/nil () :tags '(fontification syntax-table) (should (eq (clojure-test-face-at 4 6 "(= nil x)") 'font-lock-constant-face)) - (should-not (eq (clojure-test-face-at 3 5 "(fnil x)") 'font-lock-constant-face))) + (should-not (eq (clojure-test-face-at 3 5 "(fnil x)") + 'font-lock-constant-face))) (ert-deftest clojure-mode-syntax-table/true () :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 4 7 "(= true x)") 'font-lock-constant-face))) + (should (eq (clojure-test-face-at 4 7 "(= true x)") + 'font-lock-constant-face))) (ert-deftest clojure-mode-syntax-table/false () :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 4 8 "(= false x)") 'font-lock-constant-face))) + (should (eq (clojure-test-face-at 4 8 "(= false x)") + 'font-lock-constant-face))) (ert-deftest clojure-mode-syntax-table/keyword-meta () :tags '(fontification syntax-table) (clojure-test-with-temp-buffer "^:meta-data" (should (eq (clojure-test-face-at 1 1) nil)) - (should (equal (clojure-test-face-at 2 11) '(clojure-keyword-face))))) + (should (equal (clojure-test-face-at 2 11) 'clojure-keyword-face)))) (ert-deftest clojure-mode-syntax-table/keyword-allowed-chars () :tags '(fontification syntax-table) - (should (equal (clojure-test-face-at 1 8 ":aaa#bbb") '(clojure-keyword-face)))) + (should (equal (clojure-test-face-at 1 8 ":aaa#bbb") 'clojure-keyword-face))) (ert-deftest clojure-mode-syntax-table/keyword-disallowed-chars () :tags '(fontification syntax-table) (should (eq (clojure-test-face-at 1 5 ":aaa@bbb") 'various-faces)) - (should (equal (clojure-test-face-at 1 4 ":aaa@bbb") '(clojure-keyword-face))) + (should (equal (clojure-test-face-at 1 4 ":aaa@bbb") 'clojure-keyword-face)) (should (eq (clojure-test-face-at 1 5 ":aaa~bbb") 'various-faces)) - (should (equal (clojure-test-face-at 1 4 ":aaa~bbb") '(clojure-keyword-face))) + (should (equal (clojure-test-face-at 1 4 ":aaa~bbb") 'clojure-keyword-face)) (should (eq (clojure-test-face-at 1 5 ":aaa@bbb") 'various-faces)) - (should (equal (clojure-test-face-at 1 4 ":aaa@bbb") '(clojure-keyword-face)))) + (should (equal (clojure-test-face-at 1 4 ":aaa@bbb") 'clojure-keyword-face))) (ert-deftest clojure-mode-syntax-table/characters () :tags '(fontification syntax-table) @@ -308,15 +749,12 @@ POS." (ert-deftest clojure-mode-syntax-table/dynamic-var () :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 1 10 "*some-var*") 'font-lock-variable-name-face)) - (should (eq (clojure-test-face-at 2 11 "@*some-var*") 'font-lock-variable-name-face)) - (should (eq (clojure-test-face-at 9 13 "some.ns/*var*") 'font-lock-variable-name-face))) - -(ert-deftest clojure-mode-syntax-table/ns-macro () - :tags '(fontification syntax-table) - (should (eq (clojure-test-face-at 5 8 "(ns name)") 'font-lock-type-face)) - (should (eq (clojure-test-face-at 5 13 "(ns name.name)") 'font-lock-type-face)) - (should (eq (clojure-test-face-at 1 10 "[ns name]") nil))) + (should (eq (clojure-test-face-at 1 10 "*some-var*") + 'font-lock-variable-name-face)) + (should (eq (clojure-test-face-at 2 11 "@*some-var*") + 'font-lock-variable-name-face)) + (should (eq (clojure-test-face-at 9 13 "some.ns/*var*") + 'font-lock-variable-name-face))) (provide 'clojure-mode-font-lock-test)