VimUnDoY^F赒V6fWтN=zK`BY 2 $"$$!N#ax_VM\'/* vim:set ts=2 sw=2 sts=2 expandtab */L/*jshint asi: true newcap: true undef: true es5: true node: true devel: true forin: false *//*global define: true */var COLOR_BLANK = '\033[0;30m', COLOR_RED = '\033[0;31m', COLOR_GREEN = '\033[0;32m', COLOR_YELLOW = '\033[0;33m', COLOR_BLUE = '\033[0;34m', COLOR_PURPLE = '\033[0;35m', COLOR_CYAN = '\033[0;36m', COLOR_WHITE = '\033[0;37m', COLOR_RESET = '\033[m', COLOR_PASS = COLOR_GREEN, COLOR_FAIL = COLOR_RED, COLOR_ERROR = COLOR_PURPLE, ICON_PASS = '✓ ', ICON_FAIL = '✗ ', ICON_ERROR = '⚡ ', ICON_SECTION = '* ', INDENT = ' ' function Color(color, message) {8 return color ? color + message + COLOR_RESET : message}"function Indent(message, indent) {1 indent = undefined === indent ? INDENT : indent' return message.replace(/^/gm, indent)}/**5 * Internal utility function that is used to generate1 * textual representation of things passed to it. */+function toSource(thing, indent, visited) {4 indent = undefined !== indent ? indent + ' ' : '' var result, index, root if (!visited) { root = true visited = [] } index = visited.indexOf(thing), if (0 <= index) return '#' + ++index + '#' switch (typeof (thing)) { case 'string': result = '"' + thing + '"' break case 'number': result = '' + thing break case 'object': if (null === thing) { result = 'null' break } if (Array.isArray(thing)) { result = '['( result += thing.map(function ($) {+ return toSource($, indent, visited) }).join(',') result += ']' break } visited.push(thing) var names = [], for (var name in thing) names.push(name)@ result = thing + '' !== {} + '' ? '/* ' + thing + ' */' : '' if (names.length > 0) {$ result += '\n' + indent + '{ '+ result += names.map(function (name) {' var repr = '\'' + name + '\': ' try {8 repr += toSource(thing[name], indent, visited) } catch (e) { repr += '[Exception!]' } return repr# }).join('\n' + indent + ', ')# result += '\n' + indent + '}' } break case "function":= result = thing.toString().split('\n').join('\n' + indent) break default: result = '' + thing }F return root && '\n' === result.charAt(0) ? result.substr(1) : result}function Log(options) { options = options || {}' return Object.create(Log.prototype, { name: { value: options.name }, indent: {3 value: options.indent || Log.prototype.indent } })}Log.prototype = { constructor: Log, indent: ''," print: function print(message) {= process.stdout.write(Indent(message, this.indent) + '\n') }, pass: function pass(message) {> this.print(Indent(Color(COLOR_PASS, ICON_PASS + message))) }, fail: function fail(e) { var message = e.messageU if ('expected' in e) message += '\n Expected: \n' + toSource(e.expected, INDENT)O if ('actual' in e) message += '\n Actual: \n' + toSource(e.actual, INDENT)S if ('operator' in e) message += '\n Operator: ' + toSource(e.operator, INDENT)> this.print(Indent(Color(COLOR_FAIL, ICON_FAIL + message))) }, error: function error(e) {D this.print(Indent(Color(COLOR_ERROR, ICON_ERROR + toSource(e)))) },& section: function section(options) { options = options || {}) options.indent = this.indent + INDENT return Log(options) }}exports.Log = Log5_{VMcz8function source(value, indent, limit, offset, visited) {5_|VMu {5_ VMw 5_VM|5_VM)5_VM  "use strict";5_ VM 5_  vMV  "function instanceOf(value, Type) { var isConstructorNameSame; var isConstructorSourceSame;? // If `instanceof` returned `true` we know result right away.+ var isInstanceOf = value instanceof Type;N // If `instanceof` returned `false` we do ducktype check since `Type` may beO // from a different sandbox. If a constructor of the `value` or a constructorM // of the value's prototype has same name and source we assume that it's an // instance of the Type. if (!isInstanceOf && value) {A isConstructorNameSame = value.constructor.name === Type.name;H isConstructorSourceSame = String(value.constructor) == String(Type);H isInstanceOf = (isConstructorNameSame && isConstructorSourceSame) ||C instanceOf(Object.getPrototypeOf(value), Type); } return isInstanceOf;}Afunction isFunction(value) { return typeof value === 'function' }0function isNull(value) { return value === null }:function isUndefined(value) { return value === undefined }Ofunction isObject(value) { return typeof value === 'object' && !isNull(value) }=function isString(value) { return typeof value === 'string' }Nfunction isPrimitive(value) { return !isFunction(value) && !isObject(value) }function isDate(value) { E return !!(value && value.getTimezoneOffset && value.setUTCFullYear)}function isRegExp(value) {0 return !!(value && value.test && value.exec &&= (value.ignoreCase || value.ignoreCase === false))}8function source(value, indent, limit, offset, visited) { var result; var names; var nestingIndex;& var isCompact = !isUndefined(limit); indent = indent || " "; offset = (offset || ""); result = ""; visited = visited || []; if (isUndefined(value)) { result += "undefined"; } else if (isNull(value)) { result += "null"; } else if (isString(value)) { result += '"' + value + '"'; } else if (isFunction(value)) {& value = String(value).split("\n");( if (isCompact && value.length > 2) {! value = value.splice(0, 2); value.push("...}"); }( result += value.join("\n" + offset); } else if (isArray(value)) {8 if ((nestingIndex = (visited.indexOf(value) + 1))) {( result = "#" + nestingIndex + "#"; } else { visited.push(value); if (isCompact)& value = value.slice(0, limit); result += "[\n";+ result += value.map(function(value) {N return offset + indent + source(value, indent, limit, offset + indent,1 visited); }).join(",\n");3 result += isCompact && value.length > limit ?> ",\n" + offset + "...]" : "\n" + offset + "]"; } } else if (isObject(value)) {8 if ((nestingIndex = (visited.indexOf(value) + 1))) {' result = "#" + nestingIndex + "#" } else { visited.push(value)! names = Object.keys(value);' result += "{ // " + value + "\n";P result += (isCompact ? names.slice(0, limit) : names).map(function(name) {3 var _limit = isCompact ? limit - 1 : limit;F var descriptor = Object.getOwnPropertyDescriptor(value, name);- var result = offset + indent + "// "; var accessor;# if (0 <= name.indexOf(" "))" name = '"' + name + '"'; if (descriptor.writable) result += "writable ";$ if (descriptor.configurable)$ result += "configurable ";" if (descriptor.enumerable)" result += "enumerable "; result += "\n";$ if ("value" in descriptor) {2 result += offset + indent + name + ": ";M result += source(descriptor.value, indent, _limit, indent + offset,$ visited); } else { if (descriptor.get) {< result += offset + indent + "get " + name + " ";N accessor = source(descriptor.get, indent, _limit, indent + offset,' visited);= result += accessor.substr(accessor.indexOf("{")); } if (descriptor.set) {< result += offset + indent + "set " + name + " ";N accessor = source(descriptor.set, indent, _limit, indent + offset,' visited);= result += accessor.substr(accessor.indexOf("{")); } } return result; }).join(",\n"); if (isCompact) {0 if (names.length > limit && limit > 0) {7 result += ",\n" + offset + indent + "//..."; } } else { if (names.length) result += ",";; result += "\n" + offset + indent + '"__proto__": ';A result += source(Object.getPrototypeOf(value), indent, 0,* offset + indent); }$ result += "\n" + offset + "}"; } } else { result += String(value); } return result;}7exports.source = function (value, indentation, limit) {+ return source(value, indentation, limit);}5_  vM   W5_ :M[9;X6 return isObject(value) && instanceOf(value, RegExp);5_  :(M[9;XF return isObject(value) || isFunction()&& instanceOf(value, RegExp);5_ :.M[9;XK return isObject(value) || isFunction(value)&& instanceOf(value, RegExp);5_:.M[9;XL return isObject(value) || isFunction(value) && instanceOf(value, RegExp);5_: M[ 9;XM return isObject(value) || isFunction(value)) && instanceOf(value, RegExp);5_N'M\rMOX' return typeof value === "function";5_N-M\wMOX? return typeof value === "function" && obj.call && obj.apply5_N;M\yMOXA return typeof value === "function" && value.call && obj.apply5_NCM\{MOXC return typeof value === "function" && value.call && value.apply5_:4M]H9;XN return (isObject(value) || isFunction(value)) && instanceOf(value, RegExp);5_4N#aO46Y 46X5_5N#aS46Y if ()5_ 5N#aW46Y if (descriptor.get)5_! 5+N#a^46Y, if (descriptor.get) result += ''5_ "!5/N#ac46Y/ if (descriptor.get) result += ',\n'5_!#"1N#ax12Y 13Z result += value[]5_"$#2N#a13Z! result += value[name]5_#$2!N#a13Z" result += value[name];5_1<N#a%02XB result += accessor.substr(accessor.indexOf("{")) + '';5_1@N#a'02XD result += accessor.substr(accessor.indexOf("{")) + '\n';5_1@N#aE02XE result += accessor.substr(accessor.indexOf("{")) + ',\n';5_:0M]9;XN return (isObject(value) || isFunction(value)) && instanceOf(value, RegExp);5_: M] 9;XO return ( isObject(value) || isFunction(value)) && instanceOf(value, RegExp);5_: M]9;XN return (isObject(value) || isFunction(value)) && instanceOf(value, RegExp);5_:4M].9;X# return instanceOf(value, RegExp);5_ :M[9;X5 return isObject(value && instanceOf(value, RegExp);5