mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Initial add. Testcase by Brendan from bug 72884.
This commit is contained in:
parent
916b103cb1
commit
8c5c09ac84
112
js/tests/ecma_3/Function/arguments-001.js
Normal file
112
js/tests/ecma_3/Function/arguments-001.js
Normal file
@ -0,0 +1,112 @@
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s): brendan@mozilla.org, pschwartau@netscape.com
|
||||
* Date: 07 May 2001
|
||||
*
|
||||
* SUMMARY: Testing the arguments object
|
||||
*
|
||||
* See http://bugzilla.mozilla.org/show_bug.cgi?id=72884
|
||||
*/
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
var UBound = 0;
|
||||
var bug = 72884;
|
||||
var summary = 'Testing the arguments object';
|
||||
var status = '';
|
||||
var statusitems = [ ];
|
||||
var actual = '';
|
||||
var actualvalues = [ ];
|
||||
var expect= '';
|
||||
var expectedvalues = [ ];
|
||||
var a = '';
|
||||
|
||||
|
||||
status = 'Section A of test';
|
||||
function g()
|
||||
{
|
||||
delete arguments.length;
|
||||
return arguments;
|
||||
}
|
||||
a = g();
|
||||
actual = a.length;
|
||||
expect = undefined;
|
||||
addThis();
|
||||
|
||||
|
||||
status = 'Section B of test';
|
||||
a = g(1,2,3);
|
||||
actual = a.length;
|
||||
expect = undefined;
|
||||
addThis();
|
||||
|
||||
actual = a[0];
|
||||
expect = 1;
|
||||
addThis();
|
||||
|
||||
actual = a[1];
|
||||
expect = 2;
|
||||
addThis();
|
||||
|
||||
actual = a[2];
|
||||
expect = 3;
|
||||
addThis();
|
||||
|
||||
|
||||
status = 'Section C of test';
|
||||
/*
|
||||
* Note that only callee and length can be overridden, so deleting an indexed
|
||||
* property and asking for it again causes it to be recreated by args_resolve:
|
||||
*/
|
||||
function g()
|
||||
{
|
||||
delete arguments[0];
|
||||
return arguments[0];
|
||||
}
|
||||
actual = g(42);
|
||||
expect = 42;
|
||||
addThis();
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
test();
|
||||
//-------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
function addThis()
|
||||
{
|
||||
statusitems[UBound] = status;
|
||||
actualvalues[UBound] = actual;
|
||||
expectedvalues[UBound] = expect;
|
||||
UBound++;
|
||||
}
|
||||
|
||||
|
||||
function test()
|
||||
{
|
||||
enterFunc ('test');
|
||||
printBugNumber (bug);
|
||||
printStatus (summary);
|
||||
|
||||
for (var i = 0; i < UBound; i++)
|
||||
{
|
||||
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);
|
||||
}
|
||||
|
||||
exitFunc ('test');
|
||||
}
|
Loading…
Reference in New Issue
Block a user