openmct/platform/framework/test/lib/blanket_jasmine.js

36 lines
75 KiB
JavaScript
Raw Normal View History

/*! blanket - v1.1.5 */
!function(a){/*
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be>
Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl>
Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com>
Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com>
Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com>
Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
!function(b,c){"use strict";"function"==typeof a&&a.amd?a(["exports"],c):c("undefined"!=typeof exports?exports:b.esprima={})}(this,function(a){"use strict";function b(a,b){if(!a)throw new Error("ASSERT: "+b)}function c(a,b){return mc.slice(a,b)}function d(a){return"0123456789".indexOf(a)>=0}function e(a){return"0123456789abcdefABCDEF".indexOf(a)>=0}function f(a){return"01234567".indexOf(a)>=0}function g(a){return" "===a||" "===a||" "===a||"\f"===a||"\xa0"===a||a.charCodeAt(0)>=5760&&"\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\ufeff".indexOf(a)>=0}function h(a){return"\n"===a||"\r"===a||"\u2028"===a||"\u2029"===a}function i(a){return"$"===a||"_"===a||"\\"===a||a>="a"&&"z">=a||a>="A"&&"Z">=a||a.charCodeAt(0)>=128&&lc.NonAsciiIdentifierStart.test(a)}function j(a){return"$"===a||"_"===a||"\\"===a||a>="a"&&"z">=a||a>="A"&&"Z">=a||a>="0"&&"9">=a||a.charCodeAt(0)>=128&&lc.NonAsciiIdentifierPart.test(a)}function k(a){switch(a){case"class":case"enum":case"export":case"extends":case"import":case"super":return!0}return!1}function l(a){switch(a){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return!0}return!1}function m(a){return"eval"===a||"arguments"===a}function n(a){var b=!1;switch(a.length){case 2:b="if"===a||"in"===a||"do"===a;break;case 3:b="var"===a||"for"===a||"new"===a||"try"===a;break;case 4:b="this"===a||"else"===a||"case"===a||"void"===a||"with"===a;break;case 5:b="while"===a||"break"===a||"catch"===a||"throw"===a;break;case 6:b="return"===a||"typeof"===a||"delete"===a||"switch"===a;break;case 7:b="default"===a||"finally"===a;break;case 8:b="function"===a||"continue"===a||"debugger"===a;break;case 10:b="instanceof"===a}if(b)return!0;switch(a){case"const":return!0;case"yield":case"let":return!0}return nc&&l(a)?!0:k(a)}function o(){var a,b,c;for(b=!1,c=!1;rc>oc;)if(a=mc[oc],c)a=mc[oc++],h(a)&&(c=!1,"\r"===a&&"\n"===mc[oc]&&++oc,++pc,qc=oc);else if(b)h(a)?("\r"===a&&"\n"===mc[oc+1]&&++oc,++pc,++oc,qc=oc,oc>=rc&&A({},kc.UnexpectedToken,"ILLEGAL")):(a=mc[oc++],oc>=rc&&A({},kc.UnexpectedToken,"ILLEGAL"),"*"===a&&(a=mc[oc],"/"===a&&(++oc,b=!1)));else if("/"===a)if(a=mc[oc+1],"/"===a)oc+=2,c=!0;else{if("*"!==a)break;oc+=2,b=!0,oc>=rc&&A({},kc.UnexpectedToken,"ILLEGAL")}else if(g(a))++oc;else{if(!h(a))break;++oc,"\r"===a&&"\n"===mc[oc]&&++oc,++pc,qc=oc}}function p(a){var b,c,d,f=0;for(c="u"===a?4:2,b=0;c>b;++b){if(!(rc>oc&&e(mc[oc])))return"";d=mc[oc++],f=16*f+"0123456789abcdef".indexOf(d.toLowerCase())}return String.fromCharCode(f)}function q(){var a,b,c,d;if(a=mc[oc],i(a)){if(b=oc,"\\"===a){if(++oc,"u"!==mc[oc])return;if(++oc,d=oc,a=p("u")){if("\\"===a||!i(a))return;c=a}else oc=d,c="u"}else c=mc[oc++];for(;rc>oc&&(a=mc[oc],j(a));)if("\\"===a){if(++oc,"u"!==mc[oc])return;if(++oc,d=oc,a=p("u")){if("\\"===a||!j(a))return;c+=a}else oc=d,c+="u"}else c+=mc[oc++];return 1===c.length?{type:gc.Identifier,value:c,lineNumber:pc,lineStart:qc,range:[b,oc]}:n(c)?{type:gc.Keyword,value:c,lineNumber:pc,lineStart:qc,range:[b,oc]}:"null"===c?{type:gc.NullLiteral,value:c,lineNumber:pc,lineStart:qc,range:[b,oc]}:"true"===c||"false"===c?{type:gc.BooleanLiteral,value:c,lineNumber:pc,lineStart:qc,range:[b,oc]}:{type:gc.Identifier,value:c,lineNumber:pc,lineStart:qc,range:[b,oc]}}}function r(){var a,b,c,e=oc,f=mc[oc];return";"===f||"{"===f||"}"===f?(++oc,{type:gc.Punctuator,value:f,lineNumber:pc,lineStart:qc,range:[e,oc]}):","===f||"("===f||")"===f?(++oc,{type:gc.Punctuator,value:f,lineNumber:pc,lineStart:qc,range:[e,oc]}):(a=mc[oc+1],"."!==f||d(a)?(b=mc[oc+2],c=mc[oc+3],">"===f&&">"===a&&">"===b&&"="===c?(oc+=4,{type:gc.Punctuator,value:">>>=",lineNumber:pc,lineStart:qc,range:[e,oc]}):"="===f&&"="===a&&"="===b?(oc+=3,{type:gc.Punctuator,value:"===",lineNumber:pc,lineStart:qc,range:[e,oc]}):"!"===f&&"="===a&&"="===b?(oc+=3,{type:gc.Punctuator,value:"!==",lineNumber:pc,lineStart:qc,range:[e,oc]}):">"===f&&">"===a&&">"===b?(oc+=3,{type:gc.Punctuator,value:">>>",lineNumber:pc,lineStart:qc,range:[e,oc]}):"<"===f&&"<"===a&&"=
}catch(e){throw e}finally{dc(),uc={}}return c}var gc,hc,ic,jc,kc,lc,mc,nc,oc,pc,qc,rc,sc,tc,uc;gc={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},hc={},hc[gc.BooleanLiteral]="Boolean",hc[gc.EOF]="<end>",hc[gc.Identifier]="Identifier",hc[gc.Keyword]="Keyword",hc[gc.NullLiteral]="Null",hc[gc.NumericLiteral]="Numeric",hc[gc.Punctuator]="Punctuator",hc[gc.StringLiteral]="String",ic={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"},jc={Data:1,Get:2,Set:4},kc={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"},lc={NonAsciiIdentifierStart:new RegExp("[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u
* falafel (c) James Halliday / MIT License
* https://github.com/substack/node-falafel
*/
function(a,b){function c(a,b,c){function d(b){c[a.range[0]]=b;for(var d=a.range[0]+1;d<a.range[1];d++)c[d]=""}if(a.range)if(a.parent=b,a.source=function(){return c.slice(a.range[0],a.range[1]).join("")},a.update&&"object"==typeof a.update){var g=a.update;f(e(g),function(a){d[a]=g[a]}),a.update=d}else a.update=d}var d=a("esprima").parse,e=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},f=function(a,b){if(a.forEach)return a.forEach(b);for(var c=0;c<a.length;c++)b.call(a,a[c],c,a)},g=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};b.exports=function(a,b,h){"function"==typeof b&&(h=b,b={}),"object"==typeof a&&(b=a,a=b.source,delete b.source),a=void 0===a?b.source:a,b.range=!0,"string"!=typeof a&&(a=String(a));var i=d(a,b),j={chunks:a.split(""),toString:function(){return j.chunks.join("")},inspect:function(){return j.toString()}};return function k(a,b){c(a,b,j.chunks),f(e(a),function(b){if("parent"!==b){var d=a[b];g(d)?f(d,function(b){b&&"string"==typeof b.type&&k(b,a)}):d&&"string"==typeof d.type&&(c(d,a,j.chunks),k(d,a))}}),h(a)}(i,void 0),j},window.falafel=b.exports}(function(){return{parse:esprima.parse}},{exports:{}});var inBrowser="undefined"!=typeof window&&this===window,parseAndModify=inBrowser?window.falafel:require("falafel");(inBrowser?window:exports).blanket=function(){var a,b=["ExpressionStatement","BreakStatement","ContinueStatement","VariableDeclaration","ReturnStatement","ThrowStatement","TryStatement","FunctionDeclaration","IfStatement","WhileStatement","DoWhileStatement","ForStatement","ForInStatement","SwitchStatement","WithStatement"],c=["IfStatement","WhileStatement","DoWhileStatement","ForStatement","ForInStatement","WithStatement"],d=Math.floor(1e3*Math.random()),e={},f={reporter:null,adapter:null,filter:null,customVariable:null,loader:null,ignoreScriptError:!1,existingRequireJS:!1,autoStart:!1,timeout:180,ignoreCors:!1,branchTracking:!1,sourceURL:!1,debug:!1,engineOnly:!1,testReadyCallback:null,commonJS:!1,instrumentCache:!1,modulePattern:null};return inBrowser&&"undefined"!=typeof window.blanket&&(a=window.blanket.noConflict()),_blanket={noConflict:function(){return a?a:_blanket},_getCopyNumber:function(){return d},extend:function(a){_blanket._extend(_blanket,a)},_extend:function(a,b){if(b)for(var c in b)a[c]instanceof Object&&"function"!=typeof a[c]?_blanket._extend(a[c],b[c]):a[c]=b[c]},getCovVar:function(){var a=_blanket.options("customVariable");return a?(_blanket.options("debug")&&console.log("BLANKET-Using custom tracking variable:",a),inBrowser?"window."+a:a):inBrowser?"window._$blanket":"_$jscoverage"},options:function(a,b){if("string"!=typeof a)_blanket._extend(f,a);else{if("undefined"==typeof b)return f[a];f[a]=b}},instrument:function(a,b){var c=a.inputFile,d=a.inputFileName;if(_blanket.options("instrumentCache")&&sessionStorage&&sessionStorage.getItem("blanket_instrument_store-"+d))_blanket.options("debug")&&console.log("BLANKET-Reading instrumentation from cache: ",d),b(sessionStorage.getItem("blanket_instrument_store-"+d));else{var e=_blanket._prepareSource(c);_blanket._trackingArraySetup=[],c=c.replace(/^\#\!.*/,"");var f=parseAndModify(c,{loc:!0,comment:!0},_blanket._addTracking(d));f=_blanket._trackingSetup(d,e)+f,_blanket.options("sourceURL")&&(f+="\n//@ sourceURL="+d.replace("http://","")),_blanket.options("debug")&&console.log("BLANKET-Instrumented file: ",d),_blanket.options("instrumentCache")&&sessionStorage&&(_blanket.options("debug")&&console.log("BLANKET-Saving instrumentation to cache: ",d),sessionStorage.setItem("blanket_instrument_store-"+d,f)),b(f)}},_trackingArraySetup:[],_branchingArraySetup:[],_prepareSource:function(a){return a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/(\r\n|\n|\r)/gm,"\n").split("\n")},_trackingSetup:function(a,b){var c=_blanket.options("branchTracking"),d=b.join("',\n'"),e="",f=_blanket.getCovVar();return e+="if (typeof "+f+" === 'undefined') "+f+" = {};\n",c&&(e+="var _$branchFcn=function(f,l,c,r){ ",e+="if (!!r) { ",e+=f+"[f].branchData[l][c][0] = "+f+"[f].branchData[l][c][0] || [