Created
June 19, 2013 09:04
-
-
Save ckknight/5812838 to your computer and use it in GitHub Desktop.
GorillaScript coverage example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
if (typeof top === "object" && top !== null && typeof top.opener === "object" && top.opener !== null && !top.opener._$jscoverage) { | |
top.opener._$jscoverage = {}; | |
} | |
} catch (e) {} | |
try { | |
if (typeof top === "object" && top !== null) { | |
try { | |
if (typeof top.opener === "object" && top.opener !== null && top.opener._$jscoverage) { | |
top._$jscoverage = top.opener._$jscoverage; | |
} | |
} catch (e) {} | |
if (!top._$jscoverage) { | |
top._$jscoverage = {}; | |
} | |
} | |
} catch (e) {} | |
try { | |
if (typeof top === "object" && top !== null) { | |
top._$jscoverage; | |
} | |
} catch (e) {} | |
if (typeof _$jscoverage !== "object") { | |
_$jscoverage = {}; | |
} | |
if (!_$jscoverage["test/tmp.gs"]) { | |
(function () { | |
var cov, i, lines; | |
_$jscoverage["test/tmp.gs"] = cov = []; | |
for (i = 0, lines = [ | |
2, | |
3, | |
5, | |
7, | |
8 | |
]; i < 5; ++i) { | |
cov[lines[i]] = 0; | |
} | |
cov.source = [ | |
"let fun(value)", | |
" if value", | |
' console.log "We\'re having fun"', | |
" else", | |
' console.log "No fun for you!"', | |
"", | |
"fun(true)", | |
"fun(false)" | |
]; | |
}()); | |
} | |
(function () { | |
"use strict"; | |
function fun(value) { | |
++_$jscoverage["test/tmp.gs"][2]; | |
if (value) { | |
++_$jscoverage["test/tmp.gs"][3]; | |
return console.log("We're having fun"); | |
} else { | |
++_$jscoverage["test/tmp.gs"][5]; | |
return console.log("No fun for you!"); | |
} | |
} | |
++_$jscoverage["test/tmp.gs"][7]; | |
fun(true); | |
++_$jscoverage["test/tmp.gs"][8]; | |
fun(false); | |
}.call(this)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let fun(value) | |
if value | |
console.log "We're having fun" | |
else | |
console.log "No fun for you!" | |
fun(true) | |
fun(false) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function () { | |
"use strict"; | |
function fun(value) { | |
if (value) { | |
return console.log("We're having fun"); | |
} else { | |
return console.log("No fun for you!"); | |
} | |
} | |
fun(true); | |
fun(false); | |
}.call(this)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment