Bug 1027693 - Add a test for top-level let not creating a variable that'd show up in |with (global)| scope. r=jorendorff over IRC on original landing, minor adjustments to eliminate a log-highlighting false positive r=trivial

--HG--
extra : rebase_source : a43dd2daa969aafbab9d1354c82e2a65ffbdd907
This commit is contained in:
Jeff Walden 2014-06-13 18:44:14 -07:00
parent 56a3b472f2
commit 1dbd12f10f
4 changed files with 34 additions and 0 deletions

View File

@ -343,6 +343,10 @@ function jsTestDriverBrowserInit()
{
properties.version = '1.8';
}
else if (properties.test.match(/^ecma_6\/LexicalEnvironment/))
{
properties.version = '1.8';
}
}
// default to language=type;text/javascript. required for

View File

@ -0,0 +1,5 @@
// NOTE: This only turns on 1.8.5 in shell builds. The browser requires the
// futzing in js/src/tests/browser.js (which only turns on 1.8, the most
// the browser supports).
if (typeof version != 'undefined')
version(185);

View File

@ -0,0 +1,25 @@
// |reftest| fails-if(Function("try{Function('let\x20x=5;');return(1,eval)('let\x20x=3;\\'x\\'\x20in\x20this');}catch(e){return(true);}")()) -- needs bug 589199 fix (top-level let not same as var); please convert AssertEq to assertEq when removing this fails-if, too
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
let v = "global-v";
function f(v, global)
{
with (global)
return v;
}
// Don't use assertEq because it triggers tbpl error-highlighting false
// positives. When this test isn't fails-if, just use assertEq directly.
var AssertEq = typeof reportCompare === "function"
? (act, exp, msg) => reportCompare(exp, act, msg)
: assertEq;
AssertEq(f("argument-v", this), "argument-v",
"let-var shouldn't appear in global for |with| purposes");
if (typeof reportCompare === "function")
reportCompare(true, true);
print("Tests complete");