[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7a9bd8d 07/28: Add async mode startup test.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 7a9bd8d 07/28: Add async mode startup test. |
Date: |
Tue, 05 May 2015 11:10:16 +0000 |
branch: master
commit 7a9bd8d82cee14afacf7d402bc89595c7afb9286
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Add async mode startup test.
---
context-coloring.el | 8 +++++++-
test/context-coloring-test.el | 15 +++++++++++++++
2 files changed, 22 insertions(+), 1 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index 5ef09ab..31eb133 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -470,12 +470,18 @@ elisp tracks, and asynchronously for shell command
tracks."
;;; Colorization
+(defvar context-coloring-colorize-hook nil
+ "Hooks to run after coloring a buffer.")
+
(defun context-coloring-colorize (&optional callback)
"Color the current buffer by function context.
Invoke CALLBACK when complete; see `context-coloring-dispatch'."
(interactive)
- (context-coloring-dispatch callback))
+ (context-coloring-dispatch
+ (lambda ()
+ (when callback (funcall callback))
+ (run-hooks 'context-coloring-colorize-hook))))
(defvar-local context-coloring-changed nil
"Indication that the buffer has changed recently, which implies
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 333a3f3..ede72aa 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -55,6 +55,7 @@
(setq context-coloring-syntactic-comments nil)
(setq context-coloring-syntactic-strings nil)
(setq context-coloring-js-block-scopes nil)
+ (setq context-coloring-colorize-hook nil)
(setq context-coloring-check-scopifier-version-hook nil))
(defmacro context-coloring-test-with-fixture (fixture &rest body)
@@ -303,6 +304,20 @@ FOREGROUND. Apply ARGUMENTS to
;;; The tests
+(ert-deftest-async context-coloring-test-async-mode-startup (done)
+ (context-coloring-test-with-fixture-async
+ "./fixtures/function-scopes.js"
+ (lambda (teardown)
+ (js-mode)
+ (add-hook
+ 'context-coloring-colorize-hook
+ (lambda ()
+ ;; If this runs we are implicitly successful; this test only confirms
+ ;; that colorization occurs on mode startup.
+ (funcall teardown)
+ (funcall done)))
+ (context-coloring-mode))))
+
(ert-deftest context-coloring-test-check-version ()
(when (not (context-coloring-check-version "2.1.3" "3.0.1"))
(ert-fail "Expected version 3.0.1 to satisfy 2.1.3, but it didn't."))
- [elpa] master updated (510f0ff -> 8a083d5), Jackson Ray Hamilton, 2015/05/05
- [elpa] master f9a6dce 03/28: Coveralls, Jackson Ray Hamilton, 2015/05/05
- [elpa] master 7a9bd8d 07/28: Add async mode startup test.,
Jackson Ray Hamilton <=
- [elpa] master 2efebc8 10/28: Don't colorize if there are parse errors., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 30f9b0a 02/28: Update Cask file., Jackson Ray Hamilton, 2015/05/05
- [elpa] master fd5b9e1 05/28: Add tests for versions and disabling., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 85ff3ef 13/28: Trailing whitespace, empty arrays, empty strings., Jackson Ray Hamilton, 2015/05/05
- [elpa] master f11f97f 09/28: Make default colors more like font-lock's., Jackson Ray Hamilton, 2015/05/05
- [elpa] master a7f5970 04/28: Remove unused function., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 9873030 08/28: Use real keywords., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 0888e06 01/28: Use Cask and Coveralls., Jackson Ray Hamilton, 2015/05/05
- [elpa] master 202ca74 15/28: Drop `subr-x' dependency., Jackson Ray Hamilton, 2015/05/05
- [elpa] master dd3fe3c 06/28: Fix badges., Jackson Ray Hamilton, 2015/05/05