Comparing version 0.2.6 to 0.3.0
# How to compile | ||
```bash | ||
npm install && awk 'FNR==1{print ""}1' src/*.coffee src/package-start.txt package.json src/package-end.txt | node_modules/coffee-script/bin/coffee -cs > wishlist.js && node_modules/uglify-js/bin/uglifyjs wishlist.js -o wishlist.min.js -m --screw-ie8 --comments && awk 'FNR==1{print ""}1' test/*.coffee | node_modules/coffee-script/bin/coffee -cs > test/compiled.js | ||
npm install && awk 'FNR==1{print ""}1' src/*.coffee | node_modules/coffee-script/bin/coffee -cs > wishlist.js && node_modules/uglify-js/bin/uglifyjs wishlist.js -o wishlist.min.js -m --screw-ie8 --comments && awk 'FNR==1{print ""}1' test/*.coffee | node_modules/coffee-script/bin/coffee -cs > test/compiled.js | ||
``` | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "wishlist", | ||
"version": "0.2.6", | ||
"version": "0.3.0", | ||
"description": "Super natural testing framework.", | ||
@@ -11,6 +11,3 @@ "keywords": [ | ||
"homepage": "http://zhanzhenzhen.github.io/wishlist/", | ||
"licenses": [{ | ||
"type": "MIT", | ||
"url": "https://github.com/zhanzhenzhen/wishlist/blob/master/LICENSE.txt" | ||
}], | ||
"license": "MIT", | ||
"repository": { | ||
@@ -17,0 +14,0 @@ "type": "git", |
@@ -18,6 +18,9 @@ // Generated by CoffeeScript 1.7.1 | ||
2014-06-15T09:20:04.655Z OK: 13, Exception: 1, Pending: 4 | ||
2014-06-15T09:20:05.594Z OK: 13, Exception: 1, Pending: 4 | ||
2014-06-15T09:20:06.595Z OK: 16, Exception: 1, Pending: 1 | ||
2014-06-15T09:20:07.596Z OK: 17, Exception: 1, Pending: 0 | ||
2014-08-17T09:34:22.788Z OK: 13, Exception: 1, Pending: 4 | ||
2014-08-17T09:34:23.757Z OK: 13, Exception: 1, Pending: 4 | ||
2014-08-17T09:34:24.759Z OK: 16, Exception: 1, Pending: 1 | ||
111 | ||
null | ||
******************all ended! | ||
2014-08-17T09:34:25.760Z OK: 17, Exception: 1, Pending: 0 | ||
@@ -27,4 +30,4 @@ ********** Exceptional Test ********** | ||
Function: function () { | ||
return falseFunction(true); | ||
} | ||
return falseFunction(true); | ||
} | ||
Error Name: ReferenceError | ||
@@ -34,3 +37,2 @@ Error Message: falseFunction is not defined | ||
********** Broken Wish ********** | ||
@@ -552,2 +554,7 @@ Test: root --> String.prototype test | ||
return t.wish("[\n 1, 2, 3,\n \"asdf\", \"jkl\",\n {\n yyy: 4,\n iii: 5,\n jjj: NaN,\n kkk: null,\n \"mmm e\": -9,\n d: undefined\n }\n]\n=\n[\n 1, 2, 3,\n \"asdf\", \"jkl\",\n {\n yyy: 4,\n iii: 5,\n jjj: NaN,\n kkk: null,\n \"mmm e\": -9,\n d: undefined\n }\n]"); | ||
}).after(function(v) { | ||
console.log(v.var1); | ||
v.var1 = null; | ||
console.log(v.var1); | ||
return console.log("******************all ended!"); | ||
}).run(); | ||
@@ -554,0 +561,0 @@ }); |
235
wishlist.js
// Generated by CoffeeScript 1.7.1 | ||
/* @preserve | ||
/* @license | ||
Wishlist | ||
https://github.com/zhanzhenzhen/wishlist | ||
(c) 2014 Zhenzhen Zhan | ||
Wishlist may be freely distributed under the MIT license. | ||
Copyright 2014 Zhenzhen Zhan | ||
Released under the MIT license | ||
*/ | ||
(function() { | ||
var npmWishlist, | ||
var wishlist, | ||
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
npmWishlist = {}; | ||
wishlist = {}; | ||
npmWishlist.environmentType = (typeof exports !== "undefined" && exports !== null) && ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) && ((typeof process !== "undefined" && process !== null ? process.execPath : void 0) != null) && typeof process.execPath === "string" && process.execPath.search(/node/i) !== -1 ? "node" : (typeof window !== "undefined" && window !== null) && (typeof navigator !== "undefined" && navigator !== null) && (typeof HTMLElement !== "undefined" && HTMLElement !== null) ? "browser" : void 0; | ||
wishlist.environmentType = (typeof exports !== "undefined" && exports !== null) && ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) && ((typeof process !== "undefined" && process !== null ? process.execPath : void 0) != null) && typeof process.execPath === "string" && process.execPath.search(/node/i) !== -1 ? "node" : (typeof window !== "undefined" && window !== null) && (typeof navigator !== "undefined" && navigator !== null) && (typeof HTMLElement !== "undefined" && HTMLElement !== null) ? "browser" : void 0; | ||
npmWishlist.moduleSystem = (typeof exports !== "undefined" && exports !== null) && ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) ? "commonjs" : null; | ||
wishlist.moduleSystem = (typeof exports !== "undefined" && exports !== null) && ((typeof module !== "undefined" && module !== null ? module.exports : void 0) != null) ? "commonjs" : null; | ||
npmWishlist.objectIs = function(a, b) { | ||
wishlist.objectIs = function(a, b) { | ||
if (typeof a === "number" && typeof b === "number") { | ||
@@ -34,3 +34,3 @@ if (a === 0 && b === 0) { | ||
npmWishlist.objectClone = function(x) { | ||
wishlist.objectClone = function(x) { | ||
var key, y, _i, _len, _ref; | ||
@@ -46,3 +46,3 @@ y = {}; | ||
npmWishlist.valueToMessage = function(value) { | ||
wishlist.valueToMessage = function(value) { | ||
var internal, r; | ||
@@ -75,3 +75,3 @@ internal = function(value, maxLevel) { | ||
} else if (typeof value === "number") { | ||
if (npmWishlist.objectIs(value, -0)) { | ||
if (wishlist.objectIs(value, -0)) { | ||
return "-0"; | ||
@@ -98,5 +98,5 @@ } else { | ||
npmWishlist.currentRootTest = null; | ||
wishlist.currentRootTest = null; | ||
npmWishlist.parseExpression = function(expStr, envNames) { | ||
wishlist.parseExpression = function(expStr, envNames) { | ||
var c, dotAffected, i, objectKeyReady, oldDotAffected, oldObjectKeyReady, oldSlashQuoteReady, oldWordStarted, positions, quote, regex, s, slashQuoteReady, wordStarted; | ||
@@ -182,3 +182,3 @@ expStr += " "; | ||
npmWishlist.parseWish = function(wishStr) { | ||
wishlist.parseWish = function(wishStr) { | ||
var description, parsed; | ||
@@ -331,3 +331,3 @@ parsed = null; | ||
npmWishlist.parseWishes = function(wishlistStr) { | ||
wishlist.parseWishes = function(wishesStr) { | ||
var brace, bracket, c, i, lastIndex, oldSlashQuoteReady, parenthesis, positions, quote, r, s, slashQuoteReady; | ||
@@ -341,4 +341,4 @@ quote = null; | ||
i = 0; | ||
while (i < wishlistStr.length) { | ||
c = wishlistStr[i]; | ||
while (i < wishesStr.length) { | ||
c = wishesStr[i]; | ||
oldSlashQuoteReady = slashQuoteReady; | ||
@@ -397,3 +397,3 @@ if (quote === null) { | ||
var s; | ||
s = wishlistStr.substring(lastIndex + 1, index).trim(); | ||
s = wishesStr.substring(lastIndex + 1, index).trim(); | ||
if (s !== "") { | ||
@@ -404,3 +404,3 @@ r.push(s); | ||
}); | ||
s = wishlistStr.substr(lastIndex + 1).trim(); | ||
s = wishesStr.substr(lastIndex + 1).trim(); | ||
if (s !== "") { | ||
@@ -412,3 +412,3 @@ r.push(s); | ||
npmWishlist.sha256 = function(str) { | ||
wishlist.sha256 = function(str) { | ||
var Ch, H, K, M, Maj, N, ROTR, SHR, SIGMA0, SIGMA1, T1, T2, W, a, add, b, bytes, c, d, e, f, g, h, i, j, k, l, offset, paddedLength, sigma0, sigma1, t, wordToString, _i, _j, _k, _l, _m, _n, _ref; | ||
@@ -535,3 +535,3 @@ if (str.length > Math.round(Math.pow(2, 31) - 1)) { | ||
/* | ||
In `npmWishlist.Test`, the `wishes` property contains only separated wishes | ||
In `wishlist.Test`, the `wishes` property contains only separated wishes | ||
(i.e. not including those defined and checked in a test function), but | ||
@@ -541,3 +541,3 @@ the `wishResults` property includes results for all wishes. | ||
npmWishlist.Test = (function() { | ||
wishlist.Test = (function() { | ||
function Test(description) { | ||
@@ -549,5 +549,9 @@ this.description = description != null ? description : ""; | ||
})(this); | ||
this.afterFun = (function(_this) { | ||
return function() {}; | ||
})(this); | ||
this.wishes = []; | ||
this.async = false; | ||
this.parent = null; | ||
this.allCount = 1; | ||
this._resetContext(); | ||
@@ -559,3 +563,4 @@ } | ||
this.wishResults = []; | ||
return this.result = null; | ||
this.result = null; | ||
return this.endedCount = 0; | ||
}; | ||
@@ -570,3 +575,3 @@ | ||
combined = Array.isArray(raw) ? raw.join(";") : typeof raw === "string" ? raw : ""; | ||
return npmWishlist.parseWishes(combined); | ||
return wishlist.parseWishes(combined); | ||
}; | ||
@@ -627,13 +632,26 @@ })(this); | ||
Test.prototype.after = function(afterFun) { | ||
this.afterFun = afterFun; | ||
return this; | ||
}; | ||
Test.prototype.add = function() { | ||
var newChild; | ||
var count, newChild; | ||
newChild = null; | ||
if (arguments[0] instanceof npmWishlist.Test) { | ||
count = null; | ||
if (arguments[0] instanceof wishlist.Test) { | ||
newChild = arguments[0]; | ||
count = newChild.getAll().length; | ||
} else { | ||
newChild = new npmWishlist.Test(); | ||
newChild = new wishlist.Test(); | ||
newChild.set.apply(newChild, arguments); | ||
count = 1; | ||
} | ||
newChild.parent = this; | ||
this._children.push(newChild); | ||
this.getAncestorsAndSelf().forEach((function(_this) { | ||
return function(test) { | ||
return test.allCount += count; | ||
}; | ||
})(this)); | ||
return this; | ||
@@ -675,4 +693,24 @@ }; | ||
Test.prototype.getAncestorsAndSelf = function() { | ||
return [this].concat(this.getAncestors()); | ||
}; | ||
Test.prototype.getAll = function() { | ||
var r, traverse; | ||
r = []; | ||
r.push(this); | ||
traverse = (function(_this) { | ||
return function(test) { | ||
return test.getChildren().forEach(function(m) { | ||
r.push(m); | ||
return traverse(m); | ||
}); | ||
}; | ||
})(this); | ||
traverse(this); | ||
return r; | ||
}; | ||
Test.prototype.run = function(isRoot) { | ||
var allTests, timer, timerJob, traverse; | ||
var allTests, timer, timerJob; | ||
if (isRoot == null) { | ||
@@ -682,7 +720,7 @@ isRoot = true; | ||
if (isRoot) { | ||
npmWishlist.currentRootTest = this; | ||
wishlist.currentRootTest = this; | ||
} | ||
this._resetContext(); | ||
if (this.parent != null) { | ||
this.env = npmWishlist.objectClone(this.parent.env); | ||
this.env = wishlist.objectClone(this.parent.env); | ||
} | ||
@@ -692,4 +730,4 @@ setTimeout((function(_this) { | ||
var domain; | ||
if (npmWishlist.environmentType === "node") { | ||
domain = module.require("domain").create(); | ||
if (wishlist.environmentType === "node") { | ||
domain = require("domain").create(); | ||
domain.on("error", function(error) { | ||
@@ -721,13 +759,3 @@ return _this.end({ | ||
if (isRoot) { | ||
allTests = []; | ||
allTests.push(this); | ||
traverse = (function(_this) { | ||
return function(test) { | ||
return test.getChildren().forEach(function(m) { | ||
allTests.push(m); | ||
return traverse(m); | ||
}); | ||
}; | ||
})(this); | ||
traverse(this); | ||
allTests = this.getAll(); | ||
console.log(); | ||
@@ -782,6 +810,5 @@ timerJob = (function(_this) { | ||
markString = markString.trim(); | ||
mark = npmWishlist.sha256(markString).substr(0, 5); | ||
mark = wishlist.sha256(markString).substr(0, 5); | ||
console.log("\n" + ((exceptionTests.length === 0 ? "Tests OK." : "" + exceptionTests.length + " tests of " + allTests.length + " exceptional.") + " " + (failureCount === 0 ? "Wishes fulfilled." : "" + failureCount + " wishes of " + (failureCount + successCount) + " broken.") + " " + ("Mark: " + mark)) + "\n"); | ||
_this.allEnded = true; | ||
return npmWishlist.currentRootTest = null; | ||
return wishlist.currentRootTest = null; | ||
} | ||
@@ -806,2 +833,10 @@ }; | ||
})(this)); | ||
this.getAncestorsAndSelf().forEach((function(_this) { | ||
return function(test) { | ||
test.endedCount++; | ||
if (test.endedCount === test.allCount) { | ||
return test.afterFun(test.env); | ||
} | ||
}; | ||
})(this)); | ||
this.getChildren().forEach((function(_this) { | ||
@@ -821,3 +856,3 @@ return function(m) { | ||
return function(s) { | ||
npmWishlist.parseExpression(s, Object.keys(_this.env)).forEach(function(m, index) { | ||
wishlist.parseExpression(s, Object.keys(_this.env)).forEach(function(m, index) { | ||
var insertedString, pos; | ||
@@ -831,3 +866,3 @@ insertedString = "that.env."; | ||
})(this); | ||
parsed = npmWishlist.parseWish(wishStr); | ||
parsed = wishlist.parseWish(wishStr); | ||
args = parsed.components.map((function(_this) { | ||
@@ -863,4 +898,4 @@ return function(m, index) { | ||
Test.prototype.wish = function(wishlistStr) { | ||
return npmWishlist.parseWishes(wishlistStr).forEach((function(_this) { | ||
Test.prototype.wish = function(wishesStr) { | ||
return wishlist.parseWishes(wishesStr).forEach((function(_this) { | ||
return function(wishStr) { | ||
@@ -876,3 +911,3 @@ return _this._checkWish(wishStr); | ||
npmWishlist.Test.prototype._check_equal = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_equal = function(actual, ruler, description) { | ||
var determine, objects, result; | ||
@@ -888,3 +923,3 @@ if (description == null) { | ||
if (__indexOf.call(objects, m) >= 0) { | ||
return npmWishlist.objectIs(actual[index], m); | ||
return wishlist.objectIs(actual[index], m); | ||
} else { | ||
@@ -905,3 +940,3 @@ if (typeof m === "object" && m !== null) { | ||
if (_ref = ruler[m], __indexOf.call(objects, _ref) >= 0) { | ||
return npmWishlist.objectIs(actual[m], ruler[m]); | ||
return wishlist.objectIs(actual[m], ruler[m]); | ||
} else { | ||
@@ -919,3 +954,3 @@ if (typeof ruler[m] === "object" && ruler[m] !== null) { | ||
} else { | ||
return npmWishlist.objectIs(actual, ruler); | ||
return wishlist.objectIs(actual, ruler); | ||
} | ||
@@ -929,4 +964,4 @@ }; | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "= " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "= " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -936,3 +971,3 @@ return result; | ||
npmWishlist.Test.prototype._check_notEqual = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_notEqual = function(actual, ruler, description) { | ||
var determine, objects, result; | ||
@@ -948,3 +983,3 @@ if (description == null) { | ||
if (__indexOf.call(objects, m) >= 0) { | ||
return !npmWishlist.objectIs(actual[index], m); | ||
return !wishlist.objectIs(actual[index], m); | ||
} else { | ||
@@ -965,3 +1000,3 @@ if (typeof m === "object" && m !== null) { | ||
if (_ref = ruler[m], __indexOf.call(objects, _ref) >= 0) { | ||
return !npmWishlist.objectIs(actual[m], ruler[m]); | ||
return !wishlist.objectIs(actual[m], ruler[m]); | ||
} else { | ||
@@ -979,3 +1014,3 @@ if (typeof ruler[m] === "object" && ruler[m] !== null) { | ||
} else { | ||
return !npmWishlist.objectIs(actual, ruler); | ||
return !wishlist.objectIs(actual, ruler); | ||
} | ||
@@ -989,4 +1024,4 @@ }; | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "≠ " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "≠ " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -996,3 +1031,3 @@ return result; | ||
npmWishlist.Test.prototype._check_is = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_is = function(actual, ruler, description) { | ||
var result; | ||
@@ -1003,8 +1038,8 @@ if (description == null) { | ||
result = { | ||
type: npmWishlist.objectIs(actual, ruler), | ||
type: wishlist.objectIs(actual, ruler), | ||
description: description | ||
}; | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "is " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "is " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1014,3 +1049,3 @@ return result; | ||
npmWishlist.Test.prototype._check_isnt = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_isnt = function(actual, ruler, description) { | ||
var result; | ||
@@ -1021,8 +1056,8 @@ if (description == null) { | ||
result = { | ||
type: !npmWishlist.objectIs(actual, ruler), | ||
type: !wishlist.objectIs(actual, ruler), | ||
description: description | ||
}; | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "isn't " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "isn't " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1032,3 +1067,3 @@ return result; | ||
npmWishlist.Test.prototype._check_throws = function(fun, ruler, description) { | ||
wishlist.Test.prototype._check_throws = function(fun, ruler, description) { | ||
var error, passed, result, resultType; | ||
@@ -1074,3 +1109,3 @@ if (description == null) { | ||
npmWishlist.Test.prototype._check_doesNotThrow = function(fun, description) { | ||
wishlist.Test.prototype._check_doesNotThrow = function(fun, description) { | ||
var result, resultType; | ||
@@ -1099,3 +1134,3 @@ if (description == null) { | ||
npmWishlist.Test.prototype._check_lessThan = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_lessThan = function(actual, ruler, description) { | ||
var result; | ||
@@ -1110,4 +1145,4 @@ if (description == null) { | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "< " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "< " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1117,3 +1152,3 @@ return result; | ||
npmWishlist.Test.prototype._check_lessThanOrEqual = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_lessThanOrEqual = function(actual, ruler, description) { | ||
var result; | ||
@@ -1128,4 +1163,4 @@ if (description == null) { | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "<= " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "<= " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1135,3 +1170,3 @@ return result; | ||
npmWishlist.Test.prototype._check_greaterThan = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_greaterThan = function(actual, ruler, description) { | ||
var result; | ||
@@ -1146,4 +1181,4 @@ if (description == null) { | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = "> " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = "> " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1153,3 +1188,3 @@ return result; | ||
npmWishlist.Test.prototype._check_greaterThanOrEqual = function(actual, ruler, description) { | ||
wishlist.Test.prototype._check_greaterThanOrEqual = function(actual, ruler, description) { | ||
var result; | ||
@@ -1164,4 +1199,4 @@ if (description == null) { | ||
if (result.type === false) { | ||
result.actual = npmWishlist.valueToMessage(actual); | ||
result.expected = ">= " + npmWishlist.valueToMessage(ruler); | ||
result.actual = wishlist.valueToMessage(actual); | ||
result.expected = ">= " + wishlist.valueToMessage(ruler); | ||
} | ||
@@ -1171,34 +1206,10 @@ return result; | ||
if (npmWishlist.environmentType === "browser") { | ||
window.npmWishlist = npmWishlist; | ||
if (wishlist.environmentType === "browser") { | ||
window.npmWishlist = wishlist; | ||
} | ||
if (npmWishlist.moduleSystem === "commonjs") { | ||
module.exports = npmWishlist; | ||
if (wishlist.moduleSystem === "commonjs") { | ||
module.exports = wishlist; | ||
} | ||
npmWishlist.packageInfo = { | ||
"name": "wishlist", | ||
"version": "0.2.6", | ||
"description": "Super natural testing framework.", | ||
"keywords": ["test", "testing", "async", "unit", "bdd", "tdd", "asynchronous", "assertion", "assert", "mocha", "qunit", "karma", "jasmine", "vows", "qunitjs", "chai"], | ||
"author": "Zhenzhen Zhan <zhanzhenzhen@hotmail.com>", | ||
"homepage": "http://zhanzhenzhen.github.io/wishlist/", | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "https://github.com/zhanzhenzhen/wishlist/blob/master/LICENSE.txt" | ||
} | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/zhanzhenzhen/wishlist.git" | ||
}, | ||
"devDependencies": { | ||
"coffee-script": "1.7.1", | ||
"uglify-js": "2.4.13" | ||
}, | ||
"main": "wishlist" | ||
}; | ||
}).call(this); |
@@ -1,7 +0,7 @@ | ||
/* @preserve | ||
/* @license | ||
Wishlist | ||
https://github.com/zhanzhenzhen/wishlist | ||
(c) 2014 Zhenzhen Zhan | ||
Wishlist may be freely distributed under the MIT license. | ||
Copyright 2014 Zhenzhen Zhan | ||
Released under the MIT license | ||
*/ | ||
(function(){var npmWishlist,__indexOf=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1};npmWishlist={};npmWishlist.environmentType=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null&&(typeof process!=="undefined"&&process!==null?process.execPath:void 0)!=null&&typeof process.execPath==="string"&&process.execPath.search(/node/i)!==-1?"node":typeof window!=="undefined"&&window!==null&&(typeof navigator!=="undefined"&&navigator!==null)&&(typeof HTMLElement!=="undefined"&&HTMLElement!==null)?"browser":void 0;npmWishlist.moduleSystem=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null?"commonjs":null;npmWishlist.objectIs=function(e,t){if(typeof e==="number"&&typeof t==="number"){if(e===0&&t===0){return 1/e===1/t}else if(isNaN(e)&&isNaN(t)){return true}else{return e===t}}else{return e===t}};npmWishlist.objectClone=function(e){var t,n,s,r,i;n={};i=Object.keys(e);for(s=0,r=i.length;s<r;s++){t=i[s];n[t]=e[t]}return n};npmWishlist.valueToMessage=function(e){var t,n;t=function(e,n){if(e===void 0){return"undefined"}else if(e===null){return"null"}else if(Array.isArray(e)){if(n>0){return"["+e.map(function(e){return t(e,n-1)}).join(",")+"]"}else{return"[Array]"}}else if(typeof e==="function"){return"[Function]"}else if(typeof e==="object"){if(n>0){return"{"+Object.keys(e).map(function(s){return""+JSON.stringify(s)+":"+t(e[s],n-1)}).join(",")+"}"}else{return"[Object]"}}else if(typeof e==="string"){return JSON.stringify(e.toString())}else if(typeof e==="number"){if(npmWishlist.objectIs(e,-0)){return"-0"}else{return e.toString()}}else{return e.toString()}};n=t(e,3);if(n.length>1e3){n=t(e,2)}if(n.length>1e3){n=t(e,1)}if(n.length>1e3){n=t(e,0)}return n};npmWishlist.currentRootTest=null;npmWishlist.parseExpression=function(e,t){var n,s,r,i,l,u,o,a,f,p,c,h,m,y;e+=" ";if(t.length===0){return[]}c=new RegExp("^("+t.join("|")+")[^a-zA-Z0-9_$]","g");f=[];p=null;m=true;y=false;s=false;i=false;r=0;while(r<e.length-1){n=e[r];o=m;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n===")"||n==="]"){m=false}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{m=true}}a=y;if(p===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n==="."){y=true}else{y=false}}l=s;if(p===null){if(n==="."){s=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{s=false}}u=i;if(p===null){if(n==="{"||n===","){i=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{i=false}}if(n==='"'&&p===null){p="double";r++}else if(n==="'"&&p===null){p="single";r++}else if(n==="/"&&p===null&&o){p="slash";r++}else if(n==='"'&&p==="double"||n==="'"&&p==="single"||n==="/"&&p==="slash"){p=null;r++}else if(n==="\\"&&p!==null){r+=2}else if(p===null&&!a&&!l&&("a"<=n&&n<="z"||"A"<=n&&n<="Z")){h=e.substr(r,31);if(!(u&&h.search(/^([a-zA-Z0-9_$])+\s*:/)!==-1)&&h.search(c)!==-1){f.push(r)}r++}else{r++}}return f};npmWishlist.parseWish=function(e){var t,n;n=null;t=null;[0,1].forEach(function(s){var r,i,l,u,o,a,f,p,c,h,m,y;h=null;c=0;i=0;r=0;y=true;u=false;o=0;while(o<e.length){l=e[o];p=y;if(h===null){if("a"<=l&&l<="z"||"A"<=l&&l<="Z"||"0"<=l&&l<="9"||l==="_"||l==="$"||l===")"||l==="]"){y=false}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{y=true}}f=u;if(h===null){if(l==="."){u=true}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{u=false}}if(l==='"'&&h===null){h="double";o++}else if(l==="'"&&h===null){h="single";o++}else if(l==="/"&&h===null&&p){h="slash";o++}else if(l==='"'&&h==="double"||l==="'"&&h==="single"||l==="/"&&h==="slash"){h=null;o++}else if(l==="\\"&&h!==null){o+=2}else if(l==="("){c++;o++}else if(l==="["){i++;o++}else if(l==="{"){r++;o++}else if(l===")"){c--;o++}else if(l==="]"){i--;o++}else if(l==="}"){r--;o++}else if(h===null&&!f&&(c===i&&i===r&&r===0)){if(s===0){if(l===":"){t=e.substr(o+1);e=e.substr(0,o);break}}else if(s===1){m=e.substr(o);if((a=m.match(/^=([^]+)$/))!=null){n={type:"equal",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<>([^]+)$/))!=null){n={type:"notEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sis\s([^]+)$/))!=null){n={type:"is",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sisnt\s([^]+)$/))!=null){n={type:"isnt",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^\sthrows(?:\s([^]+))?$/))!=null){n={type:"throws",components:[e.substr(0,o),a[1]!=null?a[1]:"undefined"]};break}else if((a=m.match(/^<=([^]+)$/))!=null){n={type:"lessThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>=([^]+)$/))!=null){n={type:"greaterThanOrEqual",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^<([^]+)$/))!=null){n={type:"lessThan",components:[e.substr(0,o),a[1]]};break}else if((a=m.match(/^>([^]+)$/))!=null){n={type:"greaterThan",components:[e.substr(0,o),a[1]]};break}}o++}else{o++}}if(s===1){return n!=null?n:n={type:"doesNotThrow",components:[e]}}});n.components.push(JSON.stringify((t!=null?t:e).trim()));return n};npmWishlist.parseWishes=function(e){var t,n,s,r,i,l,u,o,a,f,p,c;a=null;u=0;n=0;t=0;c=true;o=[];r=0;while(r<e.length){s=e[r];l=c;if(a===null){if("a"<=s&&s<="z"||"A"<=s&&s<="Z"||"0"<=s&&s<="9"||s==="_"||s==="$"||s===")"||s==="]"){c=false}else if(s===" "||s===" "||s==="\n"||s==="\r"){}else{c=true}}if(s==='"'&&a===null){a="double";r++}else if(s==="'"&&a===null){a="single";r++}else if(s==="/"&&a===null&&l){a="slash";r++}else if(s==='"'&&a==="double"||s==="'"&&a==="single"||s==="/"&&a==="slash"){a=null;r++}else if(s==="\\"&&a!==null){r+=2}else if(s==="("){u++;r++}else if(s==="["){n++;r++}else if(s==="{"){t++;r++}else if(s===")"){u--;r++}else if(s==="]"){n--;r++}else if(s==="}"){t--;r++}else if(a===null&&(u===n&&n===t&&t===0)&&s===";"){o.push(r);r++}else{r++}}f=[];i=-1;o.forEach(function(t){var n;n=e.substring(i+1,t).trim();if(n!==""){f.push(n)}return i=t});p=e.substr(i+1).trim();if(p!==""){f.push(p)}return f};npmWishlist.sha256=function(e){var t,n,s,r,i,l,u,o,a,f,p,c,h,m,y,g,d,v,b,W,T,_,w,x,j,k,A,E,M,O,z,S,I,$,N,q,C,Z,R,J;if(e.length>Math.round(Math.pow(2,31)-1)){throw new Error}I=function(e){var t;return function(){var n,s;s=[];for(t=n=7;n>=0;t=--n){s.push(((e>>>t*4)%16).toString(16))}return s}().join("")};y=function(){var e,t,n,s;t=0;for(n=0,s=arguments.length;n<s;n++){e=arguments[n];t=(t+e)%4294967296}return t};u=function(e,t){return e>>>t|e<<32-t};o=function(e,t){return e>>>t};t=function(e,t,n){return e&t^~e&n};i=function(e,t,n){return e&t^e&n^t&n};a=function(e){return u(e,2)^u(e,13)^u(e,22)};f=function(e){return u(e,6)^u(e,11)^u(e,25)};O=function(e){return u(e,7)^u(e,18)^o(e,3)};z=function(e){return u(e,17)^u(e,19)^o(e,10)};s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];d=e.split("").map(function(e){return e.charCodeAt(0)});A=e.length*8;k=448-A-1;while(k<0){k+=512}M=A+1+k+64;d.push(128);for(x=$=0,J=Math.round((k-7)/8);0<=J?$<J:$>J;x=0<=J?++$:--$){d.push(0)}d.push(0);d.push(0);d.push(0);d.push(0);d.push(A>>>24);d.push((A>>>16)%256);d.push((A>>>8)%256);d.push(A%256);l=Math.round(M/512);r=new Array(l);for(x=N=0;0<=l?N<l:N>l;x=0<=l?++N:--N){r[x]=new Array(16);for(j=q=0;q<16;j=++q){E=x*64+j*4;r[x][j]=d[E]<<24|d[E+1]<<16|d[E+2]<<8|d[E+3]}}h=new Array(64);for(x=C=0;0<=l?C<l:C>l;x=0<=l?++C:--C){for(S=Z=0;Z<64;S=++Z){h[S]=S<16?r[x][S]:y(z(h[S-2]),h[S-7],O(h[S-15]),h[S-16])}m=n[0];g=n[1];v=n[2];b=n[3];W=n[4];T=n[5];_=n[6];w=n[7];for(S=R=0;R<64;S=++R){p=y(w,f(W),t(W,T,_),s[S],h[S]);c=y(a(m),i(m,g,v));w=_;_=T;T=W;W=y(b,p);b=v;v=g;g=m;m=y(p,c)}n[0]=y(m,n[0]);n[1]=y(g,n[1]);n[2]=y(v,n[2]);n[3]=y(b,n[3]);n[4]=y(W,n[4]);n[5]=y(T,n[5]);n[6]=y(_,n[6]);n[7]=y(w,n[7])}return n.map(function(e){return I(e)}).join("")};npmWishlist.Test=function(){function Test(e){this.description=e!=null?e:"";this._children=[];this.fun=function(e){return function(){}}(this);this.wishes=[];this.async=false;this.parent=null;this._resetContext()}Test.prototype._resetContext=function(){this.env={};this.wishResults=[];return this.result=null};Test.prototype.set=function(){var e,t,n,s,r,i;e=t=i=r=s=void 0;n=function(e){return function(e){var t;t=Array.isArray(e)?e.join(";"):typeof e==="string"?e:"";return npmWishlist.parseWishes(t)}}(this);if(typeof arguments[0]==="string"){e=arguments[0];t=arguments[1];if(typeof arguments[2]==="object"&&arguments[2]!==null&&!Array.isArray(arguments[2])){s=arguments[2]}else{r=arguments[2];s=arguments[3]}}else{t=arguments[0];if(typeof arguments[1]==="object"&&arguments[1]!==null&&!Array.isArray(arguments[1])){s=arguments[1]}else{r=arguments[1];s=arguments[2]}}i=n(r);if(s==null){s={}}if(e!==void 0){this.description=e}this.fun=t;if(r!==void 0){this.wishes=i}if(s.async!==void 0){this.async=s.async}return this};Test.prototype.setAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.set.apply(this,e)};Test.prototype.add=function(){var e;e=null;if(arguments[0]instanceof npmWishlist.Test){e=arguments[0]}else{e=new npmWishlist.Test;e.set.apply(e,arguments)}e.parent=this;this._children.push(e);return this};Test.prototype.addAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.add.apply(this,e)};Test.prototype.getChildren=function(){return this._children.slice(0)};Test.prototype.getAncestors=function(){var e,t;t=this;e=[];while(t.parent!==null){e.push(t.parent);t=t.parent}return e};Test.prototype.run=function(e){var t,n,s,r;if(e==null){e=true}if(e){npmWishlist.currentRootTest=this}this._resetContext();if(this.parent!=null){this.env=npmWishlist.objectClone(this.parent.env)}setTimeout(function(e){return function(){var t;if(npmWishlist.environmentType==="node"){t=module.require("domain").create();t.on("error",function(t){return e.end({type:false,errorMessage:"Error Name: "+t.name+"\nError Message: "+t.message+"\nError Stack: "+t.stack})});t.run(function(){return e.fun(e.env,e)})}else{try{e.fun(e.env,e)}catch(t){e.end({type:false})}}if(e.result==null&&!e.async){return e.end({type:true})}}}(this),0);if(e){t=[];t.push(this);r=function(e){return function(e){return e.getChildren().forEach(function(e){t.push(e);return r(e)})}}(this);r(this);console.log();s=function(e){return function(){var s,r,i,l,u,o,a;u=t.filter(function(e){return e.result!=null&&e.result.type===true});s=t.filter(function(e){return e.result!=null&&e.result.type===false});o=t.filter(function(e){return e.result==null});console.log(""+(new Date).toISOString()+" OK: "+u.length+", "+("Exception: "+s.length+", Pending: "+o.length));if(o.length===0){clearInterval(n);s.forEach(function(e){console.log("\n********** Exceptional Test **********");console.log("Test: "+e.description);console.log("Function: "+e.fun.toString());if(e.result.errorMessage!=null){return console.log(e.result.errorMessage)}});r=0;a=0;l="";t.forEach(function(e){return e.wishResults.forEach(function(t){var n,s;l+=" "+t.type.toString();if(t.type===false){r++;n=e.getAncestors();n.reverse();s=n.concat([e]).map(function(e){return e.description}).join(" --> ");console.log("\n********** Broken Wish **********");console.log(" Test: "+s);console.log(" Wish: "+t.description);console.log("Expected: "+t.expected);return console.log(" Actual: "+t.actual)}else{return a++}})});l=l.trim();i=npmWishlist.sha256(l).substr(0,5);console.log("\n"+((s.length===0?"Tests OK.":""+s.length+" tests of "+t.length+" exceptional.")+" "+(r===0?"Wishes fulfilled.":""+r+" wishes of "+(r+a)+" broken.")+" "+("Mark: "+i))+"\n");e.allEnded=true;return npmWishlist.currentRootTest=null}}}(this);n=setInterval(s,1e3);setTimeout(s,10)}return this};Test.prototype.end=function(e){if(this.result==null){this.result=e!=null?e:{type:true};this.wishes.forEach(function(e){return function(t){return e._checkWish(t)}}(this));this.getChildren().forEach(function(e){return function(e){return e.run(false)}}(this))}return this};Test.prototype._checkWish=function(wishStr){var args,description,interpret,parsed,result,that;that=this;interpret=function(e){return function(t){npmWishlist.parseExpression(t,Object.keys(e.env)).forEach(function(e,n){var s,r;s="that.env.";r=e+s.length*n;return t=t.substr(0,r)+s+t.substr(r)});return t}}(this);parsed=npmWishlist.parseWish(wishStr);args=parsed.components.map(function(e){return function(e,t){if(t===parsed.components.length-1){return e}else{return interpret(e)}}}(this));description=JSON.parse(args[args.length-1]);result=function(){try{args=args.map(function(_this){return function(m){return eval("(("+m+"))")}}(this));return this["_check_"+parsed.type].apply(this,args)}catch(e){return{type:false,description:description,actual:"unknown",expected:"unknown"}}}.call(this);return this.wishResults.push(result)};Test.prototype.wish=function(e){return npmWishlist.parseWishes(e).forEach(function(e){return function(t){return e._checkWish(t)}}(this))};return Test}();npmWishlist.Test.prototype._check_equal=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.every(function(t,n){if(__indexOf.call(r,t)>=0){return npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).every(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="= "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_notEqual=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.some(function(t,n){if(__indexOf.call(r,t)>=0){return!npmWishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).some(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return!npmWishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return!npmWishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=npmWishlist.valueToMessage(e);i.expected="≠ "+npmWishlist.valueToMessage(t)}return i};npmWishlist.Test.prototype._check_is=function(e,t,n){var s;if(n==null){n=""}s={type:npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="is "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_isnt=function(e,t,n){var s;if(n==null){n=""}s={type:!npmWishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="isn't "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_throws=function(e,t,n){var s,r,i,l;if(n==null){n=""}r=false;l=function(){try{e();r=true;return false}catch(e){s=e;if(t==null){return true}else if(t instanceof RegExp){if(t.test(s.message)){return true}else{return false}}else{if(s instanceof t){return true}else{return false}}}}();i={type:l,description:n};if(i.type===false){i.actual=r?"no exception":"another exception";i.expected=r?"exception":"an exception"}return i};npmWishlist.Test.prototype._check_doesNotThrow=function(e,t){var n,s;if(t==null){t=""}s=function(){try{e();return true}catch(e){return false}}();n={type:s,description:t};if(n.type===false){n.actual="exception";n.expected="no exception"}return n};npmWishlist.Test.prototype._check_lessThan=function(e,t,n){var s;if(n==null){n=""}s={type:e<t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="< "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_lessThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e<=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="<= "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThan=function(e,t,n){var s;if(n==null){n=""}s={type:e>t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected="> "+npmWishlist.valueToMessage(t)}return s};npmWishlist.Test.prototype._check_greaterThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e>=t,description:n};if(s.type===false){s.actual=npmWishlist.valueToMessage(e);s.expected=">= "+npmWishlist.valueToMessage(t)}return s};if(npmWishlist.environmentType==="browser"){window.npmWishlist=npmWishlist}if(npmWishlist.moduleSystem==="commonjs"){module.exports=npmWishlist}npmWishlist.packageInfo={name:"wishlist",version:"0.2.6",description:"Super natural testing framework.",keywords:["test","testing","async","unit","bdd","tdd","asynchronous","assertion","assert","mocha","qunit","karma","jasmine","vows","qunitjs","chai"],author:"Zhenzhen Zhan <zhanzhenzhen@hotmail.com>",homepage:"http://zhanzhenzhen.github.io/wishlist/",licenses:[{type:"MIT",url:"https://github.com/zhanzhenzhen/wishlist/blob/master/LICENSE.txt"}],repository:{type:"git",url:"https://github.com/zhanzhenzhen/wishlist.git"},devDependencies:{"coffee-script":"1.7.1","uglify-js":"2.4.13"},main:"wishlist"}}).call(this); | ||
(function(){var wishlist,__indexOf=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++){if(t in this&&this[t]===e)return t}return-1};wishlist={};wishlist.environmentType=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null&&(typeof process!=="undefined"&&process!==null?process.execPath:void 0)!=null&&typeof process.execPath==="string"&&process.execPath.search(/node/i)!==-1?"node":typeof window!=="undefined"&&window!==null&&(typeof navigator!=="undefined"&&navigator!==null)&&(typeof HTMLElement!=="undefined"&&HTMLElement!==null)?"browser":void 0;wishlist.moduleSystem=typeof exports!=="undefined"&&exports!==null&&(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null?"commonjs":null;wishlist.objectIs=function(e,t){if(typeof e==="number"&&typeof t==="number"){if(e===0&&t===0){return 1/e===1/t}else if(isNaN(e)&&isNaN(t)){return true}else{return e===t}}else{return e===t}};wishlist.objectClone=function(e){var t,n,s,r,i;n={};i=Object.keys(e);for(s=0,r=i.length;s<r;s++){t=i[s];n[t]=e[t]}return n};wishlist.valueToMessage=function(e){var t,n;t=function(e,n){if(e===void 0){return"undefined"}else if(e===null){return"null"}else if(Array.isArray(e)){if(n>0){return"["+e.map(function(e){return t(e,n-1)}).join(",")+"]"}else{return"[Array]"}}else if(typeof e==="function"){return"[Function]"}else if(typeof e==="object"){if(n>0){return"{"+Object.keys(e).map(function(s){return""+JSON.stringify(s)+":"+t(e[s],n-1)}).join(",")+"}"}else{return"[Object]"}}else if(typeof e==="string"){return JSON.stringify(e.toString())}else if(typeof e==="number"){if(wishlist.objectIs(e,-0)){return"-0"}else{return e.toString()}}else{return e.toString()}};n=t(e,3);if(n.length>1e3){n=t(e,2)}if(n.length>1e3){n=t(e,1)}if(n.length>1e3){n=t(e,0)}return n};wishlist.currentRootTest=null;wishlist.parseExpression=function(e,t){var n,s,r,i,l,u,o,f,a,c,h,p,y,g;e+=" ";if(t.length===0){return[]}h=new RegExp("^("+t.join("|")+")[^a-zA-Z0-9_$]","g");a=[];c=null;y=true;g=false;s=false;i=false;r=0;while(r<e.length-1){n=e[r];o=y;if(c===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n===")"||n==="]"){y=false}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{y=true}}f=g;if(c===null){if("a"<=n&&n<="z"||"A"<=n&&n<="Z"||"0"<=n&&n<="9"||n==="_"||n==="$"||n==="."){g=true}else{g=false}}l=s;if(c===null){if(n==="."){s=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{s=false}}u=i;if(c===null){if(n==="{"||n===","){i=true}else if(n===" "||n===" "||n==="\n"||n==="\r"){}else{i=false}}if(n==='"'&&c===null){c="double";r++}else if(n==="'"&&c===null){c="single";r++}else if(n==="/"&&c===null&&o){c="slash";r++}else if(n==='"'&&c==="double"||n==="'"&&c==="single"||n==="/"&&c==="slash"){c=null;r++}else if(n==="\\"&&c!==null){r+=2}else if(c===null&&!f&&!l&&("a"<=n&&n<="z"||"A"<=n&&n<="Z")){p=e.substr(r,31);if(!(u&&p.search(/^([a-zA-Z0-9_$])+\s*:/)!==-1)&&p.search(h)!==-1){a.push(r)}r++}else{r++}}return a};wishlist.parseWish=function(e){var t,n;n=null;t=null;[0,1].forEach(function(s){var r,i,l,u,o,f,a,c,h,p,y,g;p=null;h=0;i=0;r=0;g=true;u=false;o=0;while(o<e.length){l=e[o];c=g;if(p===null){if("a"<=l&&l<="z"||"A"<=l&&l<="Z"||"0"<=l&&l<="9"||l==="_"||l==="$"||l===")"||l==="]"){g=false}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{g=true}}a=u;if(p===null){if(l==="."){u=true}else if(l===" "||l===" "||l==="\n"||l==="\r"){}else{u=false}}if(l==='"'&&p===null){p="double";o++}else if(l==="'"&&p===null){p="single";o++}else if(l==="/"&&p===null&&c){p="slash";o++}else if(l==='"'&&p==="double"||l==="'"&&p==="single"||l==="/"&&p==="slash"){p=null;o++}else if(l==="\\"&&p!==null){o+=2}else if(l==="("){h++;o++}else if(l==="["){i++;o++}else if(l==="{"){r++;o++}else if(l===")"){h--;o++}else if(l==="]"){i--;o++}else if(l==="}"){r--;o++}else if(p===null&&!a&&(h===i&&i===r&&r===0)){if(s===0){if(l===":"){t=e.substr(o+1);e=e.substr(0,o);break}}else if(s===1){y=e.substr(o);if((f=y.match(/^=([^]+)$/))!=null){n={type:"equal",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^<>([^]+)$/))!=null){n={type:"notEqual",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^\sis\s([^]+)$/))!=null){n={type:"is",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^\sisnt\s([^]+)$/))!=null){n={type:"isnt",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^\sthrows(?:\s([^]+))?$/))!=null){n={type:"throws",components:[e.substr(0,o),f[1]!=null?f[1]:"undefined"]};break}else if((f=y.match(/^<=([^]+)$/))!=null){n={type:"lessThanOrEqual",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^>=([^]+)$/))!=null){n={type:"greaterThanOrEqual",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^<([^]+)$/))!=null){n={type:"lessThan",components:[e.substr(0,o),f[1]]};break}else if((f=y.match(/^>([^]+)$/))!=null){n={type:"greaterThan",components:[e.substr(0,o),f[1]]};break}}o++}else{o++}}if(s===1){return n!=null?n:n={type:"doesNotThrow",components:[e]}}});n.components.push(JSON.stringify((t!=null?t:e).trim()));return n};wishlist.parseWishes=function(e){var t,n,s,r,i,l,u,o,f,a,c,h;f=null;u=0;n=0;t=0;h=true;o=[];r=0;while(r<e.length){s=e[r];l=h;if(f===null){if("a"<=s&&s<="z"||"A"<=s&&s<="Z"||"0"<=s&&s<="9"||s==="_"||s==="$"||s===")"||s==="]"){h=false}else if(s===" "||s===" "||s==="\n"||s==="\r"){}else{h=true}}if(s==='"'&&f===null){f="double";r++}else if(s==="'"&&f===null){f="single";r++}else if(s==="/"&&f===null&&l){f="slash";r++}else if(s==='"'&&f==="double"||s==="'"&&f==="single"||s==="/"&&f==="slash"){f=null;r++}else if(s==="\\"&&f!==null){r+=2}else if(s==="("){u++;r++}else if(s==="["){n++;r++}else if(s==="{"){t++;r++}else if(s===")"){u--;r++}else if(s==="]"){n--;r++}else if(s==="}"){t--;r++}else if(f===null&&(u===n&&n===t&&t===0)&&s===";"){o.push(r);r++}else{r++}}a=[];i=-1;o.forEach(function(t){var n;n=e.substring(i+1,t).trim();if(n!==""){a.push(n)}return i=t});c=e.substr(i+1).trim();if(c!==""){a.push(c)}return a};wishlist.sha256=function(e){var t,n,s,r,i,l,u,o,f,a,c,h,p,y,g,d,w,m,v,b,T,_,A,x,j,k,E,M,O,S,C,$,I,W,N,q,R,z,Z,F;if(e.length>Math.round(Math.pow(2,31)-1)){throw new Error}I=function(e){var t;return function(){var n,s;s=[];for(t=n=7;n>=0;t=--n){s.push(((e>>>t*4)%16).toString(16))}return s}().join("")};g=function(){var e,t,n,s;t=0;for(n=0,s=arguments.length;n<s;n++){e=arguments[n];t=(t+e)%4294967296}return t};u=function(e,t){return e>>>t|e<<32-t};o=function(e,t){return e>>>t};t=function(e,t,n){return e&t^~e&n};i=function(e,t,n){return e&t^e&n^t&n};f=function(e){return u(e,2)^u(e,13)^u(e,22)};a=function(e){return u(e,6)^u(e,11)^u(e,25)};S=function(e){return u(e,7)^u(e,18)^o(e,3)};C=function(e){return u(e,17)^u(e,19)^o(e,10)};s=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];n=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];w=e.split("").map(function(e){return e.charCodeAt(0)});E=e.length*8;k=448-E-1;while(k<0){k+=512}O=E+1+k+64;w.push(128);for(x=W=0,F=Math.round((k-7)/8);0<=F?W<F:W>F;x=0<=F?++W:--W){w.push(0)}w.push(0);w.push(0);w.push(0);w.push(0);w.push(E>>>24);w.push((E>>>16)%256);w.push((E>>>8)%256);w.push(E%256);l=Math.round(O/512);r=new Array(l);for(x=N=0;0<=l?N<l:N>l;x=0<=l?++N:--N){r[x]=new Array(16);for(j=q=0;q<16;j=++q){M=x*64+j*4;r[x][j]=w[M]<<24|w[M+1]<<16|w[M+2]<<8|w[M+3]}}p=new Array(64);for(x=R=0;0<=l?R<l:R>l;x=0<=l?++R:--R){for($=z=0;z<64;$=++z){p[$]=$<16?r[x][$]:g(C(p[$-2]),p[$-7],S(p[$-15]),p[$-16])}y=n[0];d=n[1];m=n[2];v=n[3];b=n[4];T=n[5];_=n[6];A=n[7];for($=Z=0;Z<64;$=++Z){c=g(A,a(b),t(b,T,_),s[$],p[$]);h=g(f(y),i(y,d,m));A=_;_=T;T=b;b=g(v,c);v=m;m=d;d=y;y=g(c,h)}n[0]=g(y,n[0]);n[1]=g(d,n[1]);n[2]=g(m,n[2]);n[3]=g(v,n[3]);n[4]=g(b,n[4]);n[5]=g(T,n[5]);n[6]=g(_,n[6]);n[7]=g(A,n[7])}return n.map(function(e){return I(e)}).join("")};wishlist.Test=function(){function Test(e){this.description=e!=null?e:"";this._children=[];this.fun=function(e){return function(){}}(this);this.afterFun=function(e){return function(){}}(this);this.wishes=[];this.async=false;this.parent=null;this.allCount=1;this._resetContext()}Test.prototype._resetContext=function(){this.env={};this.wishResults=[];this.result=null;return this.endedCount=0};Test.prototype.set=function(){var e,t,n,s,r,i;e=t=i=r=s=void 0;n=function(e){return function(e){var t;t=Array.isArray(e)?e.join(";"):typeof e==="string"?e:"";return wishlist.parseWishes(t)}}(this);if(typeof arguments[0]==="string"){e=arguments[0];t=arguments[1];if(typeof arguments[2]==="object"&&arguments[2]!==null&&!Array.isArray(arguments[2])){s=arguments[2]}else{r=arguments[2];s=arguments[3]}}else{t=arguments[0];if(typeof arguments[1]==="object"&&arguments[1]!==null&&!Array.isArray(arguments[1])){s=arguments[1]}else{r=arguments[1];s=arguments[2]}}i=n(r);if(s==null){s={}}if(e!==void 0){this.description=e}this.fun=t;if(r!==void 0){this.wishes=i}if(s.async!==void 0){this.async=s.async}return this};Test.prototype.setAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.set.apply(this,e)};Test.prototype.after=function(e){this.afterFun=e;return this};Test.prototype.add=function(){var e,t;t=null;e=null;if(arguments[0]instanceof wishlist.Test){t=arguments[0];e=t.getAll().length}else{t=new wishlist.Test;t.set.apply(t,arguments);e=1}t.parent=this;this._children.push(t);this.getAncestorsAndSelf().forEach(function(t){return function(t){return t.allCount+=e}}(this));return this};Test.prototype.addAsync=function(){var e,t,n,s,r;e=[];for(s=0,r=arguments.length;s<r;s++){n=arguments[s];e.push(n)}t=e[e.length-1];if(typeof t==="object"&&t!==null&&!Array.isArray(t)){t.async=true}else{e.push({async:true})}return this.add.apply(this,e)};Test.prototype.getChildren=function(){return this._children.slice(0)};Test.prototype.getAncestors=function(){var e,t;t=this;e=[];while(t.parent!==null){e.push(t.parent);t=t.parent}return e};Test.prototype.getAncestorsAndSelf=function(){return[this].concat(this.getAncestors())};Test.prototype.getAll=function(){var e,t;e=[];e.push(this);t=function(n){return function(n){return n.getChildren().forEach(function(n){e.push(n);return t(n)})}}(this);t(this);return e};Test.prototype.run=function(e){var t,n,s;if(e==null){e=true}if(e){wishlist.currentRootTest=this}this._resetContext();if(this.parent!=null){this.env=wishlist.objectClone(this.parent.env)}setTimeout(function(e){return function(){var t;if(wishlist.environmentType==="node"){t=require("domain").create();t.on("error",function(t){return e.end({type:false,errorMessage:"Error Name: "+t.name+"\nError Message: "+t.message+"\nError Stack: "+t.stack})});t.run(function(){return e.fun(e.env,e)})}else{try{e.fun(e.env,e)}catch(t){e.end({type:false})}}if(e.result==null&&!e.async){return e.end({type:true})}}}(this),0);if(e){t=this.getAll();console.log();s=function(e){return function(){var e,s,r,i,l,u,o;l=t.filter(function(e){return e.result!=null&&e.result.type===true});e=t.filter(function(e){return e.result!=null&&e.result.type===false});u=t.filter(function(e){return e.result==null});console.log(""+(new Date).toISOString()+" OK: "+l.length+", "+("Exception: "+e.length+", Pending: "+u.length));if(u.length===0){clearInterval(n);e.forEach(function(e){console.log("\n********** Exceptional Test **********");console.log("Test: "+e.description);console.log("Function: "+e.fun.toString());if(e.result.errorMessage!=null){return console.log(e.result.errorMessage)}});s=0;o=0;i="";t.forEach(function(e){return e.wishResults.forEach(function(t){var n,r;i+=" "+t.type.toString();if(t.type===false){s++;n=e.getAncestors();n.reverse();r=n.concat([e]).map(function(e){return e.description}).join(" --> ");console.log("\n********** Broken Wish **********");console.log(" Test: "+r);console.log(" Wish: "+t.description);console.log("Expected: "+t.expected);return console.log(" Actual: "+t.actual)}else{return o++}})});i=i.trim();r=wishlist.sha256(i).substr(0,5);console.log("\n"+((e.length===0?"Tests OK.":""+e.length+" tests of "+t.length+" exceptional.")+" "+(s===0?"Wishes fulfilled.":""+s+" wishes of "+(s+o)+" broken.")+" "+("Mark: "+r))+"\n");return wishlist.currentRootTest=null}}}(this);n=setInterval(s,1e3);setTimeout(s,10)}return this};Test.prototype.end=function(e){if(this.result==null){this.result=e!=null?e:{type:true};this.wishes.forEach(function(e){return function(t){return e._checkWish(t)}}(this));this.getAncestorsAndSelf().forEach(function(e){return function(e){e.endedCount++;if(e.endedCount===e.allCount){return e.afterFun(e.env)}}}(this));this.getChildren().forEach(function(e){return function(e){return e.run(false)}}(this))}return this};Test.prototype._checkWish=function(wishStr){var args,description,interpret,parsed,result,that;that=this;interpret=function(e){return function(t){wishlist.parseExpression(t,Object.keys(e.env)).forEach(function(e,n){var s,r;s="that.env.";r=e+s.length*n;return t=t.substr(0,r)+s+t.substr(r)});return t}}(this);parsed=wishlist.parseWish(wishStr);args=parsed.components.map(function(e){return function(e,t){if(t===parsed.components.length-1){return e}else{return interpret(e)}}}(this));description=JSON.parse(args[args.length-1]);result=function(){try{args=args.map(function(_this){return function(m){return eval("(("+m+"))")}}(this));return this["_check_"+parsed.type].apply(this,args)}catch(e){return{type:false,description:description,actual:"unknown",expected:"unknown"}}}.call(this);return this.wishResults.push(result)};Test.prototype.wish=function(e){return wishlist.parseWishes(e).forEach(function(e){return function(t){return e._checkWish(t)}}(this))};return Test}();wishlist.Test.prototype._check_equal=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.every(function(t,n){if(__indexOf.call(r,t)>=0){return wishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).every(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return wishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return wishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=wishlist.valueToMessage(e);i.expected="= "+wishlist.valueToMessage(t)}return i};wishlist.Test.prototype._check_notEqual=function(e,t,n){var s,r,i;if(n==null){n=""}r=[];s=function(e){return function(e,t){if(Array.isArray(e)&&Array.isArray(t)){if(t.some(function(t,n){if(__indexOf.call(r,t)>=0){return!wishlist.objectIs(e[n],t)}else{if(typeof t==="object"&&t!==null){r.push(t)}return s(e[n],t)}})){return true}else{return false}}else if(typeof e==="object"&&e!==null&&typeof t==="object"&&t!==null){if(Object.keys(t).some(function(n){var i;if(i=t[n],__indexOf.call(r,i)>=0){return!wishlist.objectIs(e[n],t[n])}else{if(typeof t[n]==="object"&&t[n]!==null){r.push(t[n])}return s(e[n],t[n])}})){return true}else{return false}}else{return!wishlist.objectIs(e,t)}}}(this);i={type:s(e,t),description:n};if(i.type===false){i.actual=wishlist.valueToMessage(e);i.expected="≠ "+wishlist.valueToMessage(t)}return i};wishlist.Test.prototype._check_is=function(e,t,n){var s;if(n==null){n=""}s={type:wishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected="is "+wishlist.valueToMessage(t)}return s};wishlist.Test.prototype._check_isnt=function(e,t,n){var s;if(n==null){n=""}s={type:!wishlist.objectIs(e,t),description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected="isn't "+wishlist.valueToMessage(t)}return s};wishlist.Test.prototype._check_throws=function(e,t,n){var s,r,i,l;if(n==null){n=""}r=false;l=function(){try{e();r=true;return false}catch(e){s=e;if(t==null){return true}else if(t instanceof RegExp){if(t.test(s.message)){return true}else{return false}}else{if(s instanceof t){return true}else{return false}}}}();i={type:l,description:n};if(i.type===false){i.actual=r?"no exception":"another exception";i.expected=r?"exception":"an exception"}return i};wishlist.Test.prototype._check_doesNotThrow=function(e,t){var n,s;if(t==null){t=""}s=function(){try{e();return true}catch(e){return false}}();n={type:s,description:t};if(n.type===false){n.actual="exception";n.expected="no exception"}return n};wishlist.Test.prototype._check_lessThan=function(e,t,n){var s;if(n==null){n=""}s={type:e<t,description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected="< "+wishlist.valueToMessage(t)}return s};wishlist.Test.prototype._check_lessThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e<=t,description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected="<= "+wishlist.valueToMessage(t)}return s};wishlist.Test.prototype._check_greaterThan=function(e,t,n){var s;if(n==null){n=""}s={type:e>t,description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected="> "+wishlist.valueToMessage(t)}return s};wishlist.Test.prototype._check_greaterThanOrEqual=function(e,t,n){var s;if(n==null){n=""}s={type:e>=t,description:n};if(s.type===false){s.actual=wishlist.valueToMessage(e);s.expected=">= "+wishlist.valueToMessage(t)}return s};if(wishlist.environmentType==="browser"){window.npmWishlist=wishlist}if(wishlist.moduleSystem==="commonjs"){module.exports=wishlist}}).call(this); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
137465
1649
21
3
2