[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master b468d1c 166/271: Improve block scope test. Rename and docu
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master b468d1c 166/271: Improve block scope test. Rename and document block scope variable. |
Date: |
Thu, 05 Feb 2015 18:30:52 +0000 |
branch: master
commit b468d1c4f3fe1d52949d20510d4227fb5774d305
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Improve block scope test. Rename and document block scope variable.
---
context-coloring.el | 13 ++++++++-----
test/context-coloring-test.el | 16 +++++++++++++---
test/fixtures/block-scopes.js | 7 ++++++-
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/context-coloring.el b/context-coloring.el
index f189473..5818d74 100644
--- a/context-coloring.el
+++ b/context-coloring.el
@@ -53,15 +53,18 @@
(defcustom context-coloring-delay 0.25
"Delay between a buffer update and colorization.
-Increase this if your machine is high-performing. Decrease it if it ain't."
+Increase this if your machine is high-performing. Decrease it if it ain't.
+
+Supported modes: `js-mode', `js3-mode'"
:group 'context-coloring)
-(defcustom context-coloring-block-scopes nil
+(defcustom context-coloring-js-block-scopes nil
"If non-nil, add block scopes to the scope hierarchy.
The block-scope-inducing `let' and `const' are introduced in
-ES6. If you are writing ES6 code, then turn this on; otherwise,
-confusion will ensue."
+ES6. If you are writing ES6 code, enable this; otherwise, don't.
+
+Supported modes: `js2-mode'"
:group 'context-coloring)
@@ -221,7 +224,7 @@ For example: \"context-coloring-level-1-face\"."
(while (and scope
(js2-node-parent scope)
(setq enclosing-scope (js2-node-get-enclosing-scope scope)))
- (when (or context-coloring-block-scopes
+ (when (or context-coloring-js-block-scopes
(let ((type (js2-scope-type scope)))
(or (= type js2-SCRIPT)
(= type js2-FUNCTION)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 1228c44..bb55bc1 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -16,8 +16,12 @@
"Evaluate BODY in a temporary buffer with the relative
FIXTURE."
`(with-temp-buffer
- (insert (context-coloring-test-read-file ,fixture))
- ,@body))
+ (unwind-protect
+ (progn
+ (insert (context-coloring-test-read-file ,fixture))
+ ,@body)
+ ;; Cleanup.
+ (setq context-coloring-js-block-scopes nil))))
(defmacro context-coloring-test-js-mode (fixture &rest body)
`(context-coloring-test-with-fixture
@@ -95,7 +99,13 @@ FIXTURE."
(ert-deftest context-coloring-test-js2-mode-block-scopes ()
(context-coloring-test-js2-mode
"./fixtures/block-scopes.js"
- (context-coloring-test-region-level-p 1 10 0)))
+ (context-coloring-test-region-level-p 20 64 1)
+ (setq context-coloring-js-block-scopes t)
+ (context-coloring-colorize)
+ (context-coloring-test-region-level-p 20 27 1)
+ (context-coloring-test-region-level-p 27 41 2)
+ (context-coloring-test-region-level-p 41 42 1)
+ (context-coloring-test-region-level-p 42 64 2)))
(ert-deftest context-coloring-test-js2-mode-catch ()
(context-coloring-test-js2-mode
diff --git a/test/fixtures/block-scopes.js b/test/fixtures/block-scopes.js
index cb0c6db..735ca6f 100644
--- a/test/fixtures/block-scopes.js
+++ b/test/fixtures/block-scopes.js
@@ -1 +1,6 @@
-if (1) {}
+(function () {
+ if (1) {
+ var a;
+ let b;
+ }
+}());
- [elpa] master 9e7ee77 155/271: Add catch test. Don't uncolorize., (continued)
- [elpa] master 9e7ee77 155/271: Add catch test. Don't uncolorize., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 665a54a 167/271: Add more js-mode tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 43f2e3b 168/271: Increase reliability of async tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 28183e4 188/271: Readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master bdfdbe4 151/271: Improve benchmarks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d27f2fe 182/271: Fix callback removal., Jackson Ray Hamilton, 2015/02/05
- [elpa] master cb0644a 136/271: Cleanup JavaScript tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c1e9226 171/271: Reorganize lib., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9e14226 135/271: Merge branch 'feature/language-generalization' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7473cc9 169/271: Improve documentation and error handling for async tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b468d1c 166/271: Improve block scope test. Rename and document block scope variable.,
Jackson Ray Hamilton <=
- [elpa] master d411168 175/271: Revert to single var., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4c5f3ab 145/271: Fix first-run bug, passing js2-mode test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 15bfad7 165/271: Renames., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4d73262 152/271: Speed up local name lookup., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4fee39d 174/271: Remove .jslintrc files., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 903d938 176/271: Update readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d48e8cc 057/271: Add benchmark., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d157167 258/271: Strip headers. Use make dependencies., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 63e2590 207/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05
- [elpa] master d4ddaa6 160/271: Use edge js2-mode., Jackson Ray Hamilton, 2015/02/05