]> code.delx.au - gnu-emacs-elpa/blobdiff - test/context-coloring-test.el
Add comments and strings to condition-case test.
[gnu-emacs-elpa] / test / context-coloring-test.el
index 4d5905491bf9434c1aca3d82b524f378f2b4fb87..e6e6a594b856b7e0f37054956110e4ca4e6b633f 100644 (file)
@@ -414,19 +414,7 @@ override it."
        (context-coloring-define-dispatch
         'define-dispatch-no-strategy
         :modes '(context-coloring-test-define-dispatch-error-mode)))
-     "No colorizer, scopifier or command defined for dispatch")))
-
-(context-coloring-test-define-derived-mode define-dispatch-scopifier)
-
-(context-coloring-test-deftest define-dispatch-scopifier
-  (lambda ()
-    (context-coloring-define-dispatch
-     'define-dispatch-scopifier
-     :modes '(context-coloring-test-define-dispatch-scopifier-mode)
-     :scopifier (lambda () (vector)))
-    (context-coloring-test-define-dispatch-scopifier-mode)
-    (context-coloring-mode)
-    (context-coloring-colorize)))
+     "No colorizer or command defined for dispatch")))
 
 (context-coloring-test-define-derived-mode missing-executable)
 
@@ -1099,7 +1087,21 @@ ssssssssssss0"))
 (xxxxx x (x)
   (xx (xx x 111
       111111 1 111 111
-      111111 1 1111111111 11 111 1 111 1 00001 10000 11 00001 1 100001111")))
+      111111 1 1111111111 11 111 1 111 1 00001 10000 11 00001 1 10000
+                 sss ccc
+                 1111
+
+(xxxxxx '(sss cc
+          sss cc
+          ))
+
+(xxxxxx () 111111 11111)")))
+
+(context-coloring-test-deftest-emacs-lisp splice
+  (lambda ()
+    (context-coloring-test-assert-coloring "
+(xxxxxx ()
+  111111 00001 100001)")))
 
 (context-coloring-test-deftest-emacs-lisp comment
   (lambda ()
@@ -1119,12 +1121,14 @@ ssssssssssss0"))
   (lambda ()
     (context-coloring-test-assert-coloring "
 (xxxxx x ()
-  (x x 1 11 11 111 11 1 111 (1 1 1)))")))
+  (x x 1 11 11 111 111 11 1 111 (1 1 1)))")))
 
 (context-coloring-test-deftest-emacs-lisp let
   (lambda ()
     (context-coloring-test-assert-coloring "
 1111 11
+      cccccccccc
+      11 sss1
       11 01
       11 00001
       11 2222 22
@@ -1148,33 +1152,56 @@ ssssssssssss0"))
     2222 1 1 2 2 2 000022
   1111 1 1 1 0 0 000011")))
 
-;; (defun context-coloring-test-insert-unread-space ()
-;;   "Simulate the insertion of a space as if by a user."
-;;   (setq unread-command-events (cons '(t . 32)
-;;                                     unread-command-events)))
-
-;; (defun context-coloring-test-remove-faces ()
-;;   "Remove all faces in the current buffer."
-;;   (remove-text-properties (point-min) (point-max) '(face nil)))
-
-;; (context-coloring-test-deftest-emacs-lisp iteration
-;;   (lambda ()
-;;     (let ((context-coloring-emacs-lisp-iterations-per-pause 1))
-;;       (context-coloring-colorize)
-;;       (context-coloring-test-assert-coloring "
-;; cc `CC' `CC'
-;; (xxxxx x ())")
-;;       (context-coloring-test-remove-faces)
-;;       (context-coloring-test-insert-unread-space)
-;;       (context-coloring-colorize)
-;;       ;; The first iteration will color the first part of the comment, but
-;;       ;; that's it.  Then it will be interrupted.
-;;       (context-coloring-test-assert-coloring "
-;; cc nnnn nnnn
-;; nnnnnn n nnn")))
-;;   :before (lambda ()
-;;             (setq context-coloring-syntactic-comments t)
-;;             (setq context-coloring-syntactic-strings t)))
+(context-coloring-test-deftest-emacs-lisp cond
+  (lambda ()
+    (context-coloring-test-assert-coloring "
+(xxx (x)
+  11111
+   11 11
+   10000 11
+   1111 1 00001 11
+   11 11111 1 000011
+   cc c
+   sss1)")))
+
+(context-coloring-test-deftest-emacs-lisp condition-case
+  (lambda ()
+    (context-coloring-test-assert-coloring "
+1111111111-1111 111
+    111111 000 00001
+  111111 111 00001
+  1111111 111111 111 000011
+
+(111111111-1111-111111-11111 111
+    cc c
+    (xxx () 222)
+  (11111 (xxx () 222))
+  sss)")))
+
+(defun context-coloring-test-insert-unread-space ()
+  "Simulate the insertion of a space as if by a user."
+  (setq unread-command-events (cons '(t . 32)
+                                    unread-command-events)))
+
+(defun context-coloring-test-remove-faces ()
+  "Remove all faces in the current buffer."
+  (remove-text-properties (point-min) (point-max) '(face nil)))
+
+(context-coloring-test-deftest-emacs-lisp iteration
+  (lambda ()
+    (let ((context-coloring-elisp-sexps-per-pause 2))
+      (context-coloring-colorize)
+      (context-coloring-test-assert-coloring "
+cc `CC' `CC'
+(xxxxx x ())")
+      (context-coloring-test-remove-faces)
+      (context-coloring-test-insert-unread-space)
+      (context-coloring-colorize)
+      ;; Coloring is interrupted after the first "sexp" (the comment in this
+      ;; case).
+      (context-coloring-test-assert-coloring "
+cc `CC' `CC'
+nnnnnn n nnn"))))
 
 (provide 'context-coloring-test)