Transitioning to strict mode
Claus Reinke
claus.reinke at talk21.com
Mon Feb 18 07:48:19 PST 2013
>> Talking about 100% coverage and "catching all errors" is never a
>> good combination - even if you should have found an example of
>> where this works, it will be an exception.
> There are a couple of things I'm sure of. For instance, direct eval
> aside (eval needs some specific work anyway because its semantics is
> changed a lot), if you have 100% coverage, every instance of setting to
> an undeclared variable will be caught. There is no exception.
Out of curiosity, what does your favorite test coverage tool report
for the source below? And what does it report when you comment
out the directive?
Claus
----------------
function test(force) {
"use strict";
function isStrict() { return !this }
console.log(isStrict());
if (!force && (!isStrict() && (doocument="unndefined"))) {
console.log("we don't have lift-off");
} else {
console.log("ready to go!");
// do stuff
}
!isStrict() && console.log(doocument);
}
test(false);
test(true);
More information about the es-discuss
mailing list