aboutsummaryrefslogtreecommitdiff
path: root/node_modules/assert
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-03 15:35:00 +0200
commitde98e0b232509d5f40c135d540a70e415272ff85 (patch)
treea79222a5b58484ab3b80d18efcaaa7ccc4769b33 /node_modules/assert
parente0c9d480a73fa629c1e4a47d3e721f1d2d345406 (diff)
downloadwallet-core-de98e0b232509d5f40c135d540a70e415272ff85.tar.xz
node_modules
Diffstat (limited to 'node_modules/assert')
-rw-r--r--node_modules/assert/.npmignore1
-rw-r--r--node_modules/assert/.travis.yml31
-rw-r--r--node_modules/assert/.zuul.yml13
-rw-r--r--node_modules/assert/LICENSE18
-rw-r--r--node_modules/assert/README.md64
-rw-r--r--node_modules/assert/assert.js490
-rw-r--r--node_modules/assert/package.json30
-rw-r--r--node_modules/assert/test.js345
8 files changed, 992 insertions, 0 deletions
diff --git a/node_modules/assert/.npmignore b/node_modules/assert/.npmignore
new file mode 100644
index 000000000..3c3629e64
--- /dev/null
+++ b/node_modules/assert/.npmignore
@@ -0,0 +1 @@
+node_modules
diff --git a/node_modules/assert/.travis.yml b/node_modules/assert/.travis.yml
new file mode 100644
index 000000000..a690ffd44
--- /dev/null
+++ b/node_modules/assert/.travis.yml
@@ -0,0 +1,31 @@
+language: node_js
+before_install:
+ - npm install -g npm@2
+ - npm install -g npm
+matrix:
+ include:
+ - node_js: '0.8'
+ env: TASK=test-node
+ - node_js: '0.10'
+ env: TASK=test-node
+ - node_js: '0.11'
+ env: TASK=test-node
+ - node_js: '0.12'
+ env: TASK=test-node
+ - node_js: 1
+ env: TASK=test-node
+ - node_js: 2
+ env: TASK=test-node
+ - node_js: 3
+ env: TASK=test-node
+ - node_js: 4
+ env: TASK=test-node
+ - node_js: 5
+ env: TASK=test-node
+ - node_js: '0.10'
+ env: TASK=test-browser
+script: "npm run $TASK"
+env:
+ global:
+ - secure: qThuKBZQtkooAvzaYldECGNqvKGPRTnXx62IVyhSbFlsCY1VCmjhLldhyPDiZQ3JqL1XvSkK8OMDupiHqZnNE0nGijoO4M/kaEdjBB+jpjg3f8I6te2SNU935SbkfY9KHAaFXMZwdcq7Fk932AxWEu+FMSDM+080wNKpEATXDe4=
+ - secure: O/scKjHLRcPN5ILV5qsSkksQ7qcZQdHWEUUPItmj/4+vmCc28bHpicoUxXG5A96iHvkBbdmky/nGCg464ZaNLk68m6hfEMDAR3J6mhM2Pf5C4QI/LlFlR1fob9sQ8lztwSGOItwdK8Rfrgb30RRVV71f6FxnaJ6PKMuMNT5S1AQ=
diff --git a/node_modules/assert/.zuul.yml b/node_modules/assert/.zuul.yml
new file mode 100644
index 000000000..9353eb740
--- /dev/null
+++ b/node_modules/assert/.zuul.yml
@@ -0,0 +1,13 @@
+ui: mocha-qunit
+tunnel: ngrok
+browsers:
+ - name: chrome
+ version: latest
+ - name: firefox
+ version: latest
+ - name: safari
+ version: latest
+ - name: ie
+ version: 9..latest
+ - name: microsoftedge
+ version: latest
diff --git a/node_modules/assert/LICENSE b/node_modules/assert/LICENSE
new file mode 100644
index 000000000..e3d4e695a
--- /dev/null
+++ b/node_modules/assert/LICENSE
@@ -0,0 +1,18 @@
+Copyright Joyent, Inc. and other Node contributors. All rights reserved.
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+IN THE SOFTWARE.
diff --git a/node_modules/assert/README.md b/node_modules/assert/README.md
new file mode 100644
index 000000000..6d252ab57
--- /dev/null
+++ b/node_modules/assert/README.md
@@ -0,0 +1,64 @@
+# assert
+
+[![Build Status](https://travis-ci.org/defunctzombie/commonjs-assert.svg?branch=master)](https://travis-ci.org/defunctzombie/commonjs-assert)
+
+This module is used for writing unit tests for your applications, you can access it with require('assert').
+
+The API is derived from the [commonjs 1.0 unit testing](http://wiki.commonjs.org/wiki/Unit_Testing/1.0) spec and the [node.js assert module](http://nodejs.org/api/assert.html)
+
+## assert.fail(actual, expected, message, operator)
+Throws an exception that displays the values for actual and expected separated by the provided operator.
+
+## assert(value, message), assert.ok(value, [message])
+Tests if value is truthy, it is equivalent to assert.equal(true, !!value, message);
+
+## assert.equal(actual, expected, [message])
+Tests shallow, coercive equality with the equal comparison operator ( == ).
+
+## assert.notEqual(actual, expected, [message])
+Tests shallow, coercive non-equality with the not equal comparison operator ( != ).
+
+## assert.deepEqual(actual, expected, [message])
+Tests for deep equality.
+
+## assert.notDeepEqual(actual, expected, [message])
+Tests for any deep inequality.
+
+## assert.strictEqual(actual, expected, [message])
+Tests strict equality, as determined by the strict equality operator ( === )
+
+## assert.notStrictEqual(actual, expected, [message])
+Tests strict non-equality, as determined by the strict not equal operator ( !== )
+
+## assert.throws(block, [error], [message])
+Expects block to throw an error. error can be constructor, regexp or validation function.
+
+Validate instanceof using constructor:
+
+```javascript
+assert.throws(function() { throw new Error("Wrong value"); }, Error);
+```
+
+Validate error message using RegExp:
+
+```javascript
+assert.throws(function() { throw new Error("Wrong value"); }, /value/);
+```
+
+Custom error validation:
+
+```javascript
+assert.throws(function() {
+ throw new Error("Wrong value");
+}, function(err) {
+ if ( (err instanceof Error) && /value/.test(err) ) {
+ return true;
+ }
+}, "unexpected error");
+```
+
+## assert.doesNotThrow(block, [message])
+Expects block not to throw an error, see assert.throws for details.
+
+## assert.ifError(value)
+Tests if value is not a false value, throws if it is a true value. Useful when testing the first argument, error in callbacks.
diff --git a/node_modules/assert/assert.js b/node_modules/assert/assert.js
new file mode 100644
index 000000000..fa1b910d5
--- /dev/null
+++ b/node_modules/assert/assert.js
@@ -0,0 +1,490 @@
+'use strict';
+
+// compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
+// original notice:
+
+/*!
+ * The buffer module from node.js, for the browser.
+ *
+ * @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
+ * @license MIT
+ */
+function compare(a, b) {
+ if (a === b) {
+ return 0;
+ }
+
+ var x = a.length;
+ var y = b.length;
+
+ for (var i = 0, len = Math.min(x, y); i < len; ++i) {
+ if (a[i] !== b[i]) {
+ x = a[i];
+ y = b[i];
+ break;
+ }
+ }
+
+ if (x < y) {
+ return -1;
+ }
+ if (y < x) {
+ return 1;
+ }
+ return 0;
+}
+function isBuffer(b) {
+ if (global.Buffer && typeof global.Buffer.isBuffer === 'function') {
+ return global.Buffer.isBuffer(b);
+ }
+ return !!(b != null && b._isBuffer);
+}
+
+// based on node assert, original notice:
+
+// http://wiki.commonjs.org/wiki/Unit_Testing/1.0
+//
+// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8!
+//
+// Originally from narwhal.js (http://narwhaljs.org)
+// Copyright (c) 2009 Thomas Robinson <280north.com>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the 'Software'), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var util = require('util/');
+var hasOwn = Object.prototype.hasOwnProperty;
+var pSlice = Array.prototype.slice;
+var functionsHaveNames = (function () {
+ return function foo() {}.name === 'foo';
+}());
+function pToString (obj) {
+ return Object.prototype.toString.call(obj);
+}
+function isView(arrbuf) {
+ if (isBuffer(arrbuf)) {
+ return false;
+ }
+ if (typeof global.ArrayBuffer !== 'function') {
+ return false;
+ }
+ if (typeof ArrayBuffer.isView === 'function') {
+ return ArrayBuffer.isView(arrbuf);
+ }
+ if (!arrbuf) {
+ return false;
+ }
+ if (arrbuf instanceof DataView) {
+ return true;
+ }
+ if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) {
+ return true;
+ }
+ return false;
+}
+// 1. The assert module provides functions that throw
+// AssertionError's when particular conditions are not met. The
+// assert module must conform to the following interface.
+
+var assert = module.exports = ok;
+
+// 2. The AssertionError is defined in assert.
+// new assert.AssertionError({ message: message,
+// actual: actual,
+// expected: expected })
+
+var regex = /\s*function\s+([^\(\s]*)\s*/;
+// based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js
+function getName(func) {
+ if (!util.isFunction(func)) {
+ return;
+ }
+ if (functionsHaveNames) {
+ return func.name;
+ }
+ var str = func.toString();
+ var match = str.match(regex);
+ return match && match[1];
+}
+assert.AssertionError = function AssertionError(options) {
+ this.name = 'AssertionError';
+ this.actual = options.actual;
+ this.expected = options.expected;
+ this.operator = options.operator;
+ if (options.message) {
+ this.message = options.message;
+ this.generatedMessage = false;
+ } else {
+ this.message = getMessage(this);
+ this.generatedMessage = true;
+ }
+ var stackStartFunction = options.stackStartFunction || fail;
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(this, stackStartFunction);
+ } else {
+ // non v8 browsers so we can have a stacktrace
+ var err = new Error();
+ if (err.stack) {
+ var out = err.stack;
+
+ // try to strip useless frames
+ var fn_name = getName(stackStartFunction);
+ var idx = out.indexOf('\n' + fn_name);
+ if (idx >= 0) {
+ // once we have located the function frame
+ // we need to strip out everything before it (and its line)
+ var next_line = out.indexOf('\n', idx + 1);
+ out = out.substring(next_line + 1);
+ }
+
+ this.stack = out;
+ }
+ }
+};
+
+// assert.AssertionError instanceof Error
+util.inherits(assert.AssertionError, Error);
+
+function truncate(s, n) {
+ if (typeof s === 'string') {
+ return s.length < n ? s : s.slice(0, n);
+ } else {
+ return s;
+ }
+}
+function inspect(something) {
+ if (functionsHaveNames || !util.isFunction(something)) {
+ return util.inspect(something);
+ }
+ var rawname = getName(something);
+ var name = rawname ? ': ' + rawname : '';
+ return '[Function' + name + ']';
+}
+function getMessage(self) {
+ return truncate(inspect(self.actual), 128) + ' ' +
+ self.operator + ' ' +
+ truncate(inspect(self.expected), 128);
+}
+
+// At present only the three keys mentioned above are used and
+// understood by the spec. Implementations or sub modules can pass
+// other keys to the AssertionError's constructor - they will be
+// ignored.
+
+// 3. All of the following functions must throw an AssertionError
+// when a corresponding condition is not met, with a message that
+// may be undefined if not provided. All assertion methods provide
+// both the actual and expected values to the assertion error for
+// display purposes.
+
+function fail(actual, expected, message, operator, stackStartFunction) {
+ throw new assert.AssertionError({
+ message: message,
+ actual: actual,
+ expected: expected,
+ operator: operator,
+ stackStartFunction: stackStartFunction
+ });
+}
+
+// EXTENSION! allows for well behaved errors defined elsewhere.
+assert.fail = fail;
+
+// 4. Pure assertion tests whether a value is truthy, as determined
+// by !!guard.
+// assert.ok(guard, message_opt);
+// This statement is equivalent to assert.equal(true, !!guard,
+// message_opt);. To test strictly for the value true, use
+// assert.strictEqual(true, guard, message_opt);.
+
+function ok(value, message) {
+ if (!value) fail(value, true, message, '==', assert.ok);
+}
+assert.ok = ok;
+
+// 5. The equality assertion tests shallow, coercive equality with
+// ==.
+// assert.equal(actual, expected, message_opt);
+
+assert.equal = function equal(actual, expected, message) {
+ if (actual != expected) fail(actual, expected, message, '==', assert.equal);
+};
+
+// 6. The non-equality assertion tests for whether two objects are not equal
+// with != assert.notEqual(actual, expected, message_opt);
+
+assert.notEqual = function notEqual(actual, expected, message) {
+ if (actual == expected) {
+ fail(actual, expected, message, '!=', assert.notEqual);
+ }
+};
+
+// 7. The equivalence assertion tests a deep equality relation.
+// assert.deepEqual(actual, expected, message_opt);
+
+assert.deepEqual = function deepEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected, false)) {
+ fail(actual, expected, message, 'deepEqual', assert.deepEqual);
+ }
+};
+
+assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
+ if (!_deepEqual(actual, expected, true)) {
+ fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual);
+ }
+};
+
+function _deepEqual(actual, expected, strict, memos) {
+ // 7.1. All identical values are equivalent, as determined by ===.
+ if (actual === expected) {
+ return true;
+ } else if (isBuffer(actual) && isBuffer(expected)) {
+ return compare(actual, expected) === 0;
+
+ // 7.2. If the expected value is a Date object, the actual value is
+ // equivalent if it is also a Date object that refers to the same time.
+ } else if (util.isDate(actual) && util.isDate(expected)) {
+ return actual.getTime() === expected.getTime();
+
+ // 7.3 If the expected value is a RegExp object, the actual value is
+ // equivalent if it is also a RegExp object with the same source and
+ // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`).
+ } else if (util.isRegExp(actual) && util.isRegExp(expected)) {
+ return actual.source === expected.source &&
+ actual.global === expected.global &&
+ actual.multiline === expected.multiline &&
+ actual.lastIndex === expected.lastIndex &&
+ actual.ignoreCase === expected.ignoreCase;
+
+ // 7.4. Other pairs that do not both pass typeof value == 'object',
+ // equivalence is determined by ==.
+ } else if ((actual === null || typeof actual !== 'object') &&
+ (expected === null || typeof expected !== 'object')) {
+ return strict ? actual === expected : actual == expected;
+
+ // If both values are instances of typed arrays, wrap their underlying
+ // ArrayBuffers in a Buffer each to increase performance
+ // This optimization requires the arrays to have the same type as checked by
+ // Object.prototype.toString (aka pToString). Never perform binary
+ // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
+ // bit patterns are not identical.
+ } else if (isView(actual) && isView(expected) &&
+ pToString(actual) === pToString(expected) &&
+ !(actual instanceof Float32Array ||
+ actual instanceof Float64Array)) {
+ return compare(new Uint8Array(actual.buffer),
+ new Uint8Array(expected.buffer)) === 0;
+
+ // 7.5 For all other Object pairs, including Array objects, equivalence is
+ // determined by having the same number of owned properties (as verified
+ // with Object.prototype.hasOwnProperty.call), the same set of keys
+ // (although not necessarily the same order), equivalent values for every
+ // corresponding key, and an identical 'prototype' property. Note: this
+ // accounts for both named and indexed properties on Arrays.
+ } else if (isBuffer(actual) !== isBuffer(expected)) {
+ return false;
+ } else {
+ memos = memos || {actual: [], expected: []};
+
+ var actualIndex = memos.actual.indexOf(actual);
+ if (actualIndex !== -1) {
+ if (actualIndex === memos.expected.indexOf(expected)) {
+ return true;
+ }
+ }
+
+ memos.actual.push(actual);
+ memos.expected.push(expected);
+
+ return objEquiv(actual, expected, strict, memos);
+ }
+}
+
+function isArguments(object) {
+ return Object.prototype.toString.call(object) == '[object Arguments]';
+}
+
+function objEquiv(a, b, strict, actualVisitedObjects) {
+ if (a === null || a === undefined || b === null || b === undefined)
+ return false;
+ // if one is a primitive, the other must be same
+ if (util.isPrimitive(a) || util.isPrimitive(b))
+ return a === b;
+ if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
+ return false;
+ var aIsArgs = isArguments(a);
+ var bIsArgs = isArguments(b);
+ if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
+ return false;
+ if (aIsArgs) {
+ a = pSlice.call(a);
+ b = pSlice.call(b);
+ return _deepEqual(a, b, strict);
+ }
+ var ka = objectKeys(a);
+ var kb = objectKeys(b);
+ var key, i;
+ // having the same number of owned properties (keys incorporates
+ // hasOwnProperty)
+ if (ka.length !== kb.length)
+ return false;
+ //the same set of keys (although not necessarily the same order),
+ ka.sort();
+ kb.sort();
+ //~~~cheap key test
+ for (i = ka.length - 1; i >= 0; i--) {
+ if (ka[i] !== kb[i])
+ return false;
+ }
+ //equivalent values for every corresponding key, and
+ //~~~possibly expensive deep test
+ for (i = ka.length - 1; i >= 0; i--) {
+ key = ka[i];
+ if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects))
+ return false;
+ }
+ return true;
+}
+
+// 8. The non-equivalence assertion tests for any deep inequality.
+// assert.notDeepEqual(actual, expected, message_opt);
+
+assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected, false)) {
+ fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual);
+ }
+};
+
+assert.notDeepStrictEqual = notDeepStrictEqual;
+function notDeepStrictEqual(actual, expected, message) {
+ if (_deepEqual(actual, expected, true)) {
+ fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual);
+ }
+}
+
+
+// 9. The strict equality assertion tests strict equality, as determined by ===.
+// assert.strictEqual(actual, expected, message_opt);
+
+assert.strictEqual = function strictEqual(actual, expected, message) {
+ if (actual !== expected) {
+ fail(actual, expected, message, '===', assert.strictEqual);
+ }
+};
+
+// 10. The strict non-equality assertion tests for strict inequality, as
+// determined by !==. assert.notStrictEqual(actual, expected, message_opt);
+
+assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
+ if (actual === expected) {
+ fail(actual, expected, message, '!==', assert.notStrictEqual);
+ }
+};
+
+function expectedException(actual, expected) {
+ if (!actual || !expected) {
+ return false;
+ }
+
+ if (Object.prototype.toString.call(expected) == '[object RegExp]') {
+ return expected.test(actual);
+ }
+
+ try {
+ if (actual instanceof expected) {
+ return true;
+ }
+ } catch (e) {
+ // Ignore. The instanceof check doesn't work for arrow functions.
+ }
+
+ if (Error.isPrototypeOf(expected)) {
+ return false;
+ }
+
+ return expected.call({}, actual) === true;
+}
+
+function _tryBlock(block) {
+ var error;
+ try {
+ block();
+ } catch (e) {
+ error = e;
+ }
+ return error;
+}
+
+function _throws(shouldThrow, block, expected, message) {
+ var actual;
+
+ if (typeof block !== 'function') {
+ throw new TypeError('"block" argument must be a function');
+ }
+
+ if (typeof expected === 'string') {
+ message = expected;
+ expected = null;
+ }
+
+ actual = _tryBlock(block);
+
+ message = (expected && expected.name ? ' (' + expected.name + ').' : '.') +
+ (message ? ' ' + message : '.');
+
+ if (shouldThrow && !actual) {
+ fail(actual, expected, 'Missing expected exception' + message);
+ }
+
+ var userProvidedMessage = typeof message === 'string';
+ var isUnwantedException = !shouldThrow && util.isError(actual);
+ var isUnexpectedException = !shouldThrow && actual && !expected;
+
+ if ((isUnwantedException &&
+ userProvidedMessage &&
+ expectedException(actual, expected)) ||
+ isUnexpectedException) {
+ fail(actual, expected, 'Got unwanted exception' + message);
+ }
+
+ if ((shouldThrow && actual && expected &&
+ !expectedException(actual, expected)) || (!shouldThrow && actual)) {
+ throw actual;
+ }
+}
+
+// 11. Expected to throw an error:
+// assert.throws(block, Error_opt, message_opt);
+
+assert.throws = function(block, /*optional*/error, /*optional*/message) {
+ _throws(true, block, error, message);
+};
+
+// EXTENSION! This is annoying to write outside this module.
+assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) {
+ _throws(false, block, error, message);
+};
+
+assert.ifError = function(err) { if (err) throw err; };
+
+var objectKeys = Object.keys || function (obj) {
+ var keys = [];
+ for (var key in obj) {
+ if (hasOwn.call(obj, key)) keys.push(key);
+ }
+ return keys;
+};
diff --git a/node_modules/assert/package.json b/node_modules/assert/package.json
new file mode 100644
index 000000000..bc6a40568
--- /dev/null
+++ b/node_modules/assert/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "assert",
+ "description": "commonjs assert - node.js api compatible",
+ "keywords": [
+ "assert"
+ ],
+ "version": "1.4.1",
+ "homepage": "https://github.com/defunctzombie/commonjs-assert",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/defunctzombie/commonjs-assert.git"
+ },
+ "main": "./assert.js",
+ "dependencies": {
+ "util": "0.10.3"
+ },
+ "devDependencies": {
+ "mocha": "~1.21.4",
+ "zuul": "~3.10.0",
+ "zuul-ngrok": "^4.0.0"
+ },
+ "license": "MIT",
+ "scripts": {
+ "test-node": "mocha --ui qunit test.js",
+ "test-browser": "zuul -- test.js",
+ "test": "npm run test-node && npm run test-browser",
+ "test-native": "TEST_NATIVE=true mocha --ui qunit test.js",
+ "browser-local": "zuul --no-coverage --local 8000 -- test.js"
+ }
+}
diff --git a/node_modules/assert/test.js b/node_modules/assert/test.js
new file mode 100644
index 000000000..8c7c5a4b7
--- /dev/null
+++ b/node_modules/assert/test.js
@@ -0,0 +1,345 @@
+// Copyright Joyent, Inc. and other Node contributors.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to permit
+// persons to whom the Software is furnished to do so, subject to the
+// following conditions:
+//
+// The above copyright notice and this permission notice shall be included
+// in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+// USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+var nodeAssert = require('assert');
+var ourAssert = require('./');
+var keys = Object.keys;
+if (process.env.TEST_NATIVE === true) {
+ tests(nodeAssert, 'node assert');
+} else {
+ tests(ourAssert, 'our assert');
+}
+
+function makeBlock(f) {
+ var args = Array.prototype.slice.call(arguments, 1);
+ return function() {
+ return f.apply(this, args);
+ };
+}
+
+function tests (assert, what) {
+ test('assert.ok', function () {
+ assert.throws(makeBlock(assert, false), assert.AssertionError, 'ok(false)');
+
+ assert.doesNotThrow(makeBlock(assert, true), assert.AssertionError, 'ok(true)');
+
+ assert.doesNotThrow(makeBlock(assert, 'test', 'ok(\'test\')'));
+
+ assert.throws(makeBlock(assert.ok, false),
+ assert.AssertionError, 'ok(false)');
+
+ assert.doesNotThrow(makeBlock(assert.ok, true),
+ assert.AssertionError, 'ok(true)');
+
+ assert.doesNotThrow(makeBlock(assert.ok, 'test'), 'ok(\'test\')');
+ });
+
+ test('assert.equal', function () {
+ assert.throws(makeBlock(assert.equal, true, false), assert.AssertionError, 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.equal, null, null), 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.equal, undefined, undefined), 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.equal, null, undefined), 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.equal, true, true), 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.equal, 2, '2'), 'equal');
+
+ assert.doesNotThrow(makeBlock(assert.notEqual, true, false), 'notEqual');
+
+ assert.throws(makeBlock(assert.notEqual, true, true),
+ assert.AssertionError, 'notEqual');
+ });
+
+ test('assert.strictEqual', function () {
+ assert.throws(makeBlock(assert.strictEqual, 2, '2'),
+ assert.AssertionError, 'strictEqual');
+
+ assert.throws(makeBlock(assert.strictEqual, null, undefined),
+ assert.AssertionError, 'strictEqual');
+
+ assert.doesNotThrow(makeBlock(assert.notStrictEqual, 2, '2'), 'notStrictEqual');
+ });
+
+ test('assert.deepStrictEqual', function () {
+ assert.throws(makeBlock(assert.deepStrictEqual, [2], ['2']),
+ assert.AssertionError, 'deepStrictEqual');
+
+ assert.throws(makeBlock(assert.deepStrictEqual, [null], [undefined]),
+ assert.AssertionError, 'deepStrictEqual');
+
+ assert.doesNotThrow(makeBlock(assert.notDeepStrictEqual, [2], ['2']), 'notDeepStrictEqual');
+ });
+
+ test('assert.deepEqual - 7.2', function () {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new Date(2000, 3, 14),
+ new Date(2000, 3, 14)), 'deepEqual date');
+
+ assert.throws(makeBlock(assert.deepEqual, new Date(), new Date(2000, 3, 14)),
+ assert.AssertionError,
+ 'deepEqual date');
+ });
+
+ test('assert.deepEqual - 7.3', function () {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, /a/, /a/));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, /a/g, /a/g));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, /a/i, /a/i));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, /a/m, /a/m));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, /a/igm, /a/igm));
+ assert.throws(makeBlock(assert.deepEqual, /ab/, /a/));
+ assert.throws(makeBlock(assert.deepEqual, /a/g, /a/));
+ assert.throws(makeBlock(assert.deepEqual, /a/i, /a/));
+ assert.throws(makeBlock(assert.deepEqual, /a/m, /a/));
+ assert.throws(makeBlock(assert.deepEqual, /a/igm, /a/im));
+
+ var re1 = /a/;
+ re1.lastIndex = 3;
+ assert.throws(makeBlock(assert.deepEqual, re1, /a/));
+ });
+
+ test('assert.deepEqual - 7.4', function () {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, 4, '4'), 'deepEqual == check');
+ assert.doesNotThrow(makeBlock(assert.deepEqual, true, 1), 'deepEqual == check');
+ assert.throws(makeBlock(assert.deepEqual, 4, '5'),
+ assert.AssertionError,
+ 'deepEqual == check');
+ });
+
+ test('assert.deepEqual - 7.5', function () {
+ // having the same number of owned properties && the same set of keys
+ assert.doesNotThrow(makeBlock(assert.deepEqual, {a: 4}, {a: 4}));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, {a: 4, b: '2'}, {a: 4, b: '2'}));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, [4], ['4']));
+ assert.throws(makeBlock(assert.deepEqual, {a: 4}, {a: 4, b: true}),
+ assert.AssertionError);
+ assert.doesNotThrow(makeBlock(assert.deepEqual, ['a'], {0: 'a'}));
+ //(although not necessarily the same order),
+ assert.doesNotThrow(makeBlock(assert.deepEqual, {a: 4, b: '1'}, {b: '1', a: 4}));
+ var a1 = [1, 2, 3];
+ var a2 = [1, 2, 3];
+ a1.a = 'test';
+ a1.b = true;
+ a2.b = true;
+ a2.a = 'test';
+ assert.throws(makeBlock(assert.deepEqual, keys(a1), keys(a2)),
+ assert.AssertionError);
+ assert.doesNotThrow(makeBlock(assert.deepEqual, a1, a2));
+ });
+
+ test('assert.deepEqual - ES6 primitives', function () {
+ assert.throws(makeBlock(assert.deepEqual, null, {}), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, undefined, {}), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, 'a', ['a']), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, 'a', {0: 'a'}), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, 1, {}), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, true, {}), assert.AssertionError);
+ if (typeof Symbol === 'symbol') {
+ assert.throws(makeBlock(assert.deepEqual, Symbol(), {}), assert.AssertionError);
+ }
+ });
+
+ test('assert.deepEqual - object wrappers', function () {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new String('a'), ['a']));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new String('a'), {0: 'a'}));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new Number(1), {}));
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new Boolean(true), {}));
+ });
+
+ test('assert.deepEqual - Buffers', function () {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new Buffer([1, 2, 3]), new Buffer([1, 2, 3])));
+ if (typeof global.Uint8Array === 'function') {
+ assert.throws(makeBlock(assert.deepEqual, new Buffer([1, 2, 3]), new Uint8Array([1, 2, 3])));
+ }
+ if (typeof global.Uint16Array === 'function') {
+ assert.doesNotThrow(makeBlock(assert.deepEqual, new Uint16Array([1, 2, 3]), new Uint16Array([1, 2, 3])));
+ }
+ });
+
+ function thrower(errorConstructor) {
+ throw new errorConstructor('test');
+ }
+
+ test('assert - Testing the throwing', function () {
+ var aethrow = makeBlock(thrower, assert.AssertionError);
+ aethrow = makeBlock(thrower, assert.AssertionError);
+
+ // the basic calls work
+ assert.throws(makeBlock(thrower, assert.AssertionError),
+ assert.AssertionError, 'message');
+ assert.throws(makeBlock(thrower, assert.AssertionError), assert.AssertionError);
+ assert.throws(makeBlock(thrower, assert.AssertionError));
+
+ // if not passing an error, catch all.
+ assert.throws(makeBlock(thrower, TypeError));
+
+ // when passing a type, only catch errors of the appropriate type
+ var threw = false;
+ try {
+ assert.throws(makeBlock(thrower, TypeError), assert.AssertionError);
+ } catch (e) {
+ threw = true;
+ assert.ok(e instanceof TypeError, 'type');
+ }
+ assert.equal(true, threw,
+ 'a.throws with an explicit error is eating extra errors',
+ assert.AssertionError);
+ threw = false;
+
+ // doesNotThrow should pass through all errors
+ try {
+ assert.doesNotThrow(makeBlock(thrower, TypeError), assert.AssertionError);
+ } catch (e) {
+ threw = true;
+ assert.ok(e instanceof TypeError);
+ }
+ assert.equal(true, threw,
+ 'a.doesNotThrow with an explicit error is eating extra errors');
+
+ // key difference is that throwing our correct error makes an assertion error
+ try {
+ assert.doesNotThrow(makeBlock(thrower, TypeError), TypeError);
+ } catch (e) {
+ threw = true;
+ assert.ok(e instanceof assert.AssertionError);
+ }
+ assert.equal(true, threw,
+ 'a.doesNotThrow is not catching type matching errors');
+ });
+
+ test('assert.ifError', function () {
+ assert.throws(function() {assert.ifError(new Error('test error'))});
+ assert.doesNotThrow(function() {assert.ifError(null)});
+ assert.doesNotThrow(function() {assert.ifError()});
+ });
+
+ test('assert - make sure that validating using constructor really works', function () {
+ var threw = false;
+ try {
+ assert.throws(
+ function() {
+ throw ({});
+ },
+ Array
+ );
+ } catch (e) {
+ threw = true;
+ }
+ assert.ok(threw, 'wrong constructor validation');
+ });
+
+ test('assert - use a RegExp to validate error message', function () {
+ assert.throws(makeBlock(thrower, TypeError), /test/);
+ });
+
+ test('assert - se a fn to validate error object', function () {
+ assert.throws(makeBlock(thrower, TypeError), function(err) {
+ if ((err instanceof TypeError) && /test/.test(err)) {
+ return true;
+ }
+ });
+ });
+
+ test('assert - Make sure deepEqual doesn\'t loop forever on circular refs', function () {
+ var b = {};
+ b.b = b;
+
+ var c = {};
+ c.b = c;
+
+ var gotError = false;
+ var equal = true;
+ try {
+ equal = assert.deepEqual(b, c);
+ } catch (e) {
+ gotError = true;
+ }
+ assert.ok(gotError || !equal, gotError ? 'got error': 'are equal');
+ });
+
+ test('assert - Ensure reflexivity of deepEqual with `arguments` objects', function() {
+ var args = (function() { return arguments; })();
+ assert.throws(makeBlock(assert.deepEqual, [], args), assert.AssertionError);
+ assert.throws(makeBlock(assert.deepEqual, args, []), assert.AssertionError);
+ });
+
+ test('assert - test assertion message', function () {
+ function testAssertionMessage(actual, expected) {
+ try {
+ assert.equal(actual, '');
+ } catch (e) {
+ assert.equal(e.toString(),
+ ['AssertionError:', expected, '==', '\'\''].join(' '));
+ }
+ }
+ testAssertionMessage(undefined, 'undefined');
+ testAssertionMessage(null, 'null');
+ testAssertionMessage(true, 'true');
+ testAssertionMessage(false, 'false');
+ testAssertionMessage(0, '0');
+ testAssertionMessage(100, '100');
+ testAssertionMessage(NaN, 'NaN');
+ testAssertionMessage(Infinity, 'Infinity');
+ testAssertionMessage(-Infinity, '-Infinity');
+ testAssertionMessage('', '""');
+ testAssertionMessage('foo', '\'foo\'');
+ testAssertionMessage([], '[]');
+ testAssertionMessage([1, 2, 3], '[ 1, 2, 3 ]');
+ testAssertionMessage(new Buffer([1, 2, 3]), '<Buffer 01 02 03>');
+ if (typeof global.Uint8Array === 'function' && Object.getOwnPropertyNames( new Uint8Array([])).length === 0) {
+ // todo fix util.inspect
+ testAssertionMessage(new Uint8Array([1, 2, 3]), '{ \'0\': 1, \'1\': 2, \'2\': 3 }');
+ }
+ testAssertionMessage(/a/, '/a/');
+ testAssertionMessage(function f() {}, '[Function: f]');
+ testAssertionMessage({}, '{}');
+ testAssertionMessage({a: undefined, b: null}, '{ a: undefined, b: null }');
+ testAssertionMessage({a: NaN, b: Infinity, c: -Infinity},
+ '{ a: NaN, b: Infinity, c: -Infinity }');
+ });
+
+ test('assert - regressions from node.js testcase', function () {
+ var threw = false;
+
+ try {
+ assert.throws(function () {
+ assert.ifError(null);
+ });
+ } catch (e) {
+ threw = true;
+ assert.equal(e.message, 'Missing expected exception..');
+ }
+ assert.ok(threw);
+
+ try {
+ assert.equal(1, 2);
+ } catch (e) {
+ assert.equal(e.toString().split('\n')[0], 'AssertionError: 1 == 2');
+ }
+
+ try {
+ assert.equal(1, 2, 'oh no');
+ } catch (e) {
+ assert.equal(e.toString().split('\n')[0], 'AssertionError: oh no');
+ }
+ });
+}