[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 2bb4d12 124/271: More cleanup.
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 2bb4d12 124/271: More cleanup. |
Date: |
Thu, 05 Feb 2015 18:30:28 +0000 |
branch: master
commit 2bb4d124aef51bb4ff108636ada45b7638956b8d
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
More cleanup.
---
test/context-coloring-test.el | 8 --
test/fixtures/scopes.js | 8 --
test/fixtures/vow.js | 270 -----------------------------------------
3 files changed, 0 insertions(+), 286 deletions(-)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 03ec4c0..a428dd6 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -20,16 +20,8 @@ FIXTURE."
(context-coloring-mode)
,@body))
-(ert-deftest context-coloring-test-scopes ()
- (context-coloring-test-with-fixture "./fixtures/scopes.js"
- ))
-
(ert-deftest context-coloring-test-nested ()
(context-coloring-test-with-fixture "./fixtures/nested.js"
))
-(ert-deftest context-coloring-test-vow ()
- (context-coloring-test-with-fixture "./fixtures/vow.js"
- ))
-
(provide 'context-coloring-test)
diff --git a/test/fixtures/scopes.js b/test/fixtures/scopes.js
deleted file mode 100644
index 696d812..0000000
--- a/test/fixtures/scopes.js
+++ /dev/null
@@ -1,8 +0,0 @@
-(function () {
- var a;
- var b = 0;
-}());
-var A;
-var B = 1;
-window.setTimeout();
-ooga = 2;
diff --git a/test/fixtures/vow.js b/test/fixtures/vow.js
deleted file mode 100644
index 374853e..0000000
--- a/test/fixtures/vow.js
+++ /dev/null
@@ -1,270 +0,0 @@
-// vow.js
-// Douglas Crockford
-// 2013-09-20
-
-// Public Domain
-
-/*global setImmediate */
-
-
-var VOW = (function () {
- 'use strict';
-
-// The VOW object contains a .make function that is used to make vows.
-// It may also contain other useful functions.
-// In some mythologies, 'VOW' is called 'deferrer'.
-
- function enlighten(queue, fate) {
-
-// enlighten is a helper function of herald and .when. It schedules the
-// processing of all of the resolution functions in either the keepers queue
-// or the breakers queue in later turns with the promise's fate.
-
- queue.forEach(function (func) {
- setImmediate(func, fate);
- });
- }
-
- return {
- make: function make() {
-
-// The make function makes new vows. A vow contains a promise object and the
-// two resolution functions (break and keep) that determine the fate of the
-// promise.
-
- var breakers = [], // .when's broken queue
- fate, // The promise's ultimate value
- keepers = [], // .when's kept queue
- status = 'pending'; // 'broken', 'kept', or 'pending'
-
- function enqueue(
- resolution, // 'keep' or 'break'
- func, // A function that was registered with .when
- vow // A vow that provides the resolution functions
- ) {
-
-// enqueue is a helper function used by .when. It will append a function to
-// either the keepers queue or the breakers queue.
-
- var queue = resolution === 'keep' ? keepers : breakers;
- queue[queue.length] = typeof func !== 'function'
-
-// If func is not a function, push the resolver so that the value passes to
-// the next cascaded .when.
-
- ? vow[resolution]
-
-// If the func is a function, push a function that calls func with a value.
-// The result can be a promise, or not a promise, or an exception.
-
- : function (value) {
- try {
- var result = func(value);
-
-// If the result is a promise, then register our resolver with that promise.
-
- if (result && result.is_promise === true) {
- result.when(vow.keep, vow.break);
-
-// But if it is not a promise, then use the result to resolve our promise.
-
- } else {
- vow.keep(result);
- }
-
-// But if func throws an exception, then break our promise.
-
- } catch (e) {
- vow.break(e);
- }
- };
- }
-
- function herald(state, value, queue) {
-
-// The herald function is a helper function of break and keep.
-// It seals the promise's fate, updates its status, enlightens
-// one of the queues, and empties both queues.
-
- if (status !== 'pending') {
- throw "overpromise";
- }
- fate = value;
- status = state;
- enlighten(queue, fate);
- keepers.length = 0;
- breakers.length = 0;
- }
-
-// Construct and return the vow object.
-
- return {
- 'break': function (value) {
-
-// The break method breaks the promise.
-
- herald('broken', value, breakers);
- },
- keep: function keep(value) {
-
-// The keep method keeps the promise.
-
- herald('kept', value, keepers);
- },
- promise: {
-
-// The promise is an object with a .when method.
-
- is_promise: true,
-
-// The .when method is the promise monad's bind. The .when method can take two
-// optional functions. One of those functions may be called, depending on the
-// promise's resolution. Both could be called if the the kept function throws.
-
- when: function (kept, broken) {
-
-// Make a new vow. Return the new promise.
-
- var vow = make();
- switch (status) {
-
-// If this promise is still pending, then enqueue both kept and broken.
-
- case 'pending':
- enqueue('keep', kept, vow);
- enqueue('break', broken, vow);
- break;
-
-// If the promise has already been kept, then enqueue only the kept function,
-// and enlighten it.
-
- case 'kept':
- enqueue('keep', kept, vow);
- enlighten(keepers, fate);
- break;
-
-// If the promise has already been broken, then enqueue only the broken
-// function, and enlighten it.
-
- case 'broken':
- enqueue('break', broken, vow);
- enlighten(breakers, fate);
- break;
- }
- return vow.promise;
- }
- }
- };
- },
- every: function every(array) {
-
-// The every function takes an array of promises and returns a promise that
-// will deliver an array of results only if every promise is kept.
-
- var remaining = array.length, results = [], vow = VOW.make();
-
- if (!remaining) {
- vow.break(array);
- } else {
- array.forEach(function (promise, i) {
- promise.when(function (value) {
- results[i] = value;
- remaining -= 1;
- if (remaining === 0) {
- vow.keep(results);
- }
- }, function (reason) {
- remaining = NaN;
- vow.break(reason);
- });
- });
- }
- return vow.promise;
- },
- first: function first(array) {
-
-// The first function takes an array of promises and returns a promise to
-// deliver the first observed kept promise, or a broken promise if all of
-// the promises are broken.
-
- var found = false, remaining = array.length, vow = VOW.make();
-
- function check() {
- remaining -= 1;
- if (remaining === 0 && !found) {
- vow.break();
- }
- }
-
- if (remaining === 0) {
- vow.break(array);
- } else {
- array.forEach(function (promise) {
- promise.when(function (value) {
- if (!found) {
- found = true;
- vow.keep(value);
- }
- check();
- }, check);
- });
- }
- return vow.promise;
- },
- any: function any(array) {
-
-// The any function takes an array of promises and returns a promise that
-// will deliver a possibly sparse array of results of any kept promises.
-// The result will contain an undefined element for each broken promise.
-
- var remaining = array.length, results = [], vow = VOW.make();
-
- function check() {
- remaining -= 1;
- if (remaining === 0) {
- vow.keep(results);
- }
- }
-
- if (!remaining) {
- vow.keep(results);
- } else {
- array.forEach(function (promise, i) {
- promise.when(function (value) {
- results[i] = value;
- check();
- }, check);
- });
- }
- return vow.promise;
- },
- kept: function (value) {
-
-// Returns a new kept promise.
-
- var vow = VOW.make();
- vow.keep(value);
- return vow.promise;
- },
- broken: function (reason) {
-
-// Returns a new broken promise.
-
- var vow = VOW.make();
- vow.break(reason);
- return vow.promise;
- }
- };
-}());
-
-
-// If your system does not have setImmediate, then simulate it with setTimeout.
-
-if (typeof setImmediate !== 'function') {
- setImmediate = function setImmediate(func, param) {
- 'use strict';
- return setTimeout(function () {
- func(param);
- }, 0);
- };
-}
- [elpa] master 549e523 149/271: Add failing test for block scopes., (continued)
- [elpa] master 549e523 149/271: Add failing test for block scopes., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9f87a03 148/271: Actually colorize complex files., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 76122df 144/271: Write js2 scopifier., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 5fcd757 146/271: Refactor to use more resilient dispatch strategy., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 8982c75 127/271: Merge branch 'feature/tests' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master e06fbe9 158/271: Add comment support for js2-mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a2b6a5a 112/271: Use defvar-local., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 6c8175e 153/271: Update compilation., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4f57f0c 163/271: Improve global test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master dc8e99c 130/271: Function name., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 2bb4d12 124/271: More cleanup.,
Jackson Ray Hamilton <=
- [elpa] master d301048 154/271: Update compilation again., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 1d9cf42 164/271: Refactor tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master a0ccc5c 162/271: Improve and pass catch test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c8fa33f 170/271: Improve async benchmarking., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7954efc 110/271: Rename instances of depth to level., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 338716d 161/271: Refactor., Jackson Ray Hamilton, 2015/02/05
- [elpa] master fc81cf9 157/271: Don't use timers for js2-mode., Jackson Ray Hamilton, 2015/02/05
- [elpa] master b4c220a 159/271: Always remove hooks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master e040ca0 181/271: Just use stable emacs., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9e7ee77 155/271: Add catch test. Don't uncolorize., Jackson Ray Hamilton, 2015/02/05