зеркало из https://github.com/mozilla/pjs.git
Added two new sections to the test.
This commit is contained in:
Родитель
96c68a8c35
Коммит
4e4e073308
|
@ -34,6 +34,7 @@
|
|||
var UBound = 0;
|
||||
var bug = '(none)';
|
||||
var summary = 'Testing that functions are scoped statically, not dynamically';
|
||||
var self = this; // capture a reference to the global object
|
||||
var status = '';
|
||||
var statusitems = [ ];
|
||||
var actual = '';
|
||||
|
@ -166,6 +167,44 @@ expect = 2; // NOT 3 !!!
|
|||
addThis();
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly verify that f exists at global level, even though
|
||||
* it was defined under the with(obj) block -
|
||||
*/
|
||||
status = 'Section G of test';
|
||||
var a = 1;
|
||||
var obj = {a:2};
|
||||
with (obj)
|
||||
{
|
||||
function f()
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
actual = String([obj.hasOwnProperty('f'), self.hasOwnProperty('f')]);
|
||||
expect = String([false, true]);
|
||||
addThis();
|
||||
|
||||
|
||||
/*
|
||||
* Explicitly verify that f exists at global level, even though
|
||||
* it was defined under the with(obj) block -
|
||||
*/
|
||||
status = 'Section H of test';
|
||||
var a = 1;
|
||||
var obj = {a:2};
|
||||
with (obj)
|
||||
{
|
||||
function f()
|
||||
{
|
||||
return a;
|
||||
}
|
||||
}
|
||||
actual = String(['f' in obj, 'f' in self]);
|
||||
expect = String([false, true]);
|
||||
addThis();
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
test();
|
||||
|
|
Загрузка…
Ссылка в новой задаче