diff --git a/mozilla/js/tests/Makefile b/mozilla/js/tests/Makefile
index 9c11ef2c32b..13a3360c454 100644
--- a/mozilla/js/tests/Makefile
+++ b/mozilla/js/tests/Makefile
@@ -1,8 +1,10 @@
+JS = $(shell find . -name '*.js' -print)
-testmenu:
+all: menu.html
+
+menu.html: menuhead.html menufoot.html $(JS) Makefile
exec perl mklistpage.pl > menubody.html
cat menuhead.html menubody.html menufoot.html > menu.html
-testmenu_dos:
- perl mklistpage.pl > menubody.html
- type menuhead.html menubody.html menufoot.html > menu.html
+clean:
+ rm -f menubody.html menu.html
diff --git a/mozilla/js/tests/e4x/Expressions/browser.js b/mozilla/js/tests/e4x/Expressions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Expressions/shell.js b/mozilla/js/tests/e4x/Expressions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Global/browser.js b/mozilla/js/tests/e4x/Global/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Global/shell.js b/mozilla/js/tests/e4x/Global/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Namespace/browser.js b/mozilla/js/tests/e4x/Namespace/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Namespace/shell.js b/mozilla/js/tests/e4x/Namespace/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/QName/browser.js b/mozilla/js/tests/e4x/QName/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/QName/shell.js b/mozilla/js/tests/e4x/QName/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Regress/browser.js b/mozilla/js/tests/e4x/Regress/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Regress/shell.js b/mozilla/js/tests/e4x/Regress/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Statements/browser.js b/mozilla/js/tests/e4x/Statements/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Statements/shell.js b/mozilla/js/tests/e4x/Statements/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/TypeConversion/browser.js b/mozilla/js/tests/e4x/TypeConversion/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/TypeConversion/shell.js b/mozilla/js/tests/e4x/TypeConversion/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Types/browser.js b/mozilla/js/tests/e4x/Types/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/Types/shell.js b/mozilla/js/tests/e4x/Types/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/XML/browser.js b/mozilla/js/tests/e4x/XML/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/XML/shell.js b/mozilla/js/tests/e4x/XML/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/XMLList/browser.js b/mozilla/js/tests/e4x/XMLList/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/XMLList/shell.js b/mozilla/js/tests/e4x/XMLList/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/e4x/browser.js b/mozilla/js/tests/e4x/browser.js
new file mode 100644
index 00000000000..3b3935f8b97
--- /dev/null
+++ b/mozilla/js/tests/e4x/browser.js
@@ -0,0 +1,182 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * 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):
+ */
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ *
+ *
+ *
+ */
+function writeLineToLog( string ) {
+ document.write( string + "
\n");
+}
+
+function print( string ) {
+ writeLineToLog( string );
+}
+
+var testcases = new Array();
+var tc = testcases.length;
+var BUGSTR = '';
+var SUMMARY = '';
+var DESCRIPTION = '';
+var EXPECTED = '';
+var ACTUAL = '';
+var MSG = '';
+var SECTION = '';
+
+function TestCase(n, d, e, a)
+{
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = ( e == a );
+ this.reason = '';
+ this.bugnumber = typeof(BUGSTR) != 'undefined' ? BUGSTR : '';
+ testcases[tc++] = this;
+}
+
+function reportSuccess(section, expected, actual)
+{
+ var testcase = new TestCase(gTestName, SUMMARY + DESCRIPTION + ' Section ' + section, expected, actual);
+ testcase.passed = true;
+};
+
+function reportError(msg, page, line)
+{
+ var testcase;
+
+ if (typeof SUMMARY == 'undefined')
+ {
+ SUMMARY = 'Unknown';
+ }
+ if (typeof SECTION == 'undefined')
+ {
+ SECTION = 'Unknown';
+ }
+ if (typeof DESCRIPTION == 'undefined')
+ {
+ DESCRIPTION = 'Unknown';
+ }
+ if (typeof EXPECTED == 'undefined')
+ {
+ EXPECTED = 'Unknown';
+ }
+
+ testcase = new TestCase(gTestName, SUMMARY + DESCRIPTION + ' Section ' + SECTION, EXPECTED, "error");
+
+ testcase.passed = false;
+ testcase.reason += msg;
+
+ if (typeof(page) != 'undefined')
+ {
+ testcase.reason += ' Page: ' + page;
+ }
+ if (typeof(line) != 'undefined')
+ {
+ testcase.reason += ' Line: ' + line;
+ }
+ reportFailure(SECTION, msg);
+
+};
+
+
+var _reportFailure = reportFailure;
+reportFailure = function (section, msg)
+{
+ var testcase;
+
+ testcase = new TestCase(gTestName, SUMMARY + DESCRIPTION + ' Section ' + section, EXPECTED, ACTUAL);
+
+ testcase.passed = false;
+ testcase.reason += msg;
+
+ _reportFailure(section, msg);
+
+};
+
+
+var _printBugNumber = printBugNumber;
+printBugNumber = function (num)
+{
+ BUGSTR = BUGNUMBER + num;
+ _printBugNumber(num);
+}
+
+var _START = START;
+START = function (summary)
+{
+ SUMMARY = summary;
+ printStatus(summary);
+}
+
+var _TEST = TEST;
+TEST = function (section, expected, actual)
+{
+ SECTION = section;
+ EXPECTED = expected;
+ ACTUAL = actual;
+ if (_TEST(section, expected, actual))
+ {
+ reportSuccess(section, expected, actual);
+ }
+}
+
+var _TEST_XML = TEST_XML;
+TEST_XML = function (section, expected, actual)
+{
+ SECTION = section;
+ EXPECTED = expected;
+ ACTUAL = actual;
+ if (_TEST_XML(section, expected, actual))
+ {
+ reportSuccess(section, expected, actual);
+ }
+}
+
+function gc()
+{
+}
+
+function quit()
+{
+}
+
+// override NL from shell.js.
+// assume running either on unix with \n line endings
+// or on windows under cygwin with \n line endings.
+
+function NL()
+{
+ return '\n';
+}
+
+window.onerror = reportError;
diff --git a/mozilla/js/tests/e4x/shell.js b/mozilla/js/tests/e4x/shell.js
index 65d03aac85e..88308554a33 100644
--- a/mozilla/js/tests/e4x/shell.js
+++ b/mozilla/js/tests/e4x/shell.js
@@ -138,7 +138,9 @@ function TEST(section, expected, actual)
if (output != "")
{
reportFailure (section, output);
+ return false;
}
+ return true;
}
function TEST_XML(section, expected, actual)
@@ -148,17 +150,19 @@ function TEST_XML(section, expected, actual)
if (actual_t != "xml") {
// force error on type mismatch
- TEST(section, new XML(), actual);
- return;
+ return TEST(section, new XML(), actual);
}
if (expected_t == "string") {
- TEST(section, expected, actual.toXMLString());
- } else if (expected_t == "number") {
- TEST(section, String(expected), actual.toXMLString());
- } else {
- reportFailure (section, "Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string");
+ return TEST(section, expected, actual.toXMLString());
}
+
+ if (expected_t == "number") {
+ return TEST(section, String(expected), actual.toXMLString());
+ }
+
+ reportFailure (section, "Bad TEST_XML usage: type of expected is "+expected_t+", should be number or string");
+ return false;
}
function SHOULD_THROW(section)
diff --git a/mozilla/js/tests/e4x/template.js b/mozilla/js/tests/e4x/template.js
new file mode 100755
index 00000000000..803345c1155
--- /dev/null
+++ b/mozilla/js/tests/e4x/template.js
@@ -0,0 +1,49 @@
+/* -*- Mode: java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- *//* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla 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/MPL/
+ *
+ * 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 JavaScript Engine testing utilities.
+ *
+ * The Initial Developer of the Original Code is
+ * Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2005
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+START("section - description");
+
+var bug = 99999;
+var summary = '';
+var actual = '';
+var expect = '';
+
+printBugNumber (bug);
+printStatus (summary);
+
+// test here
+
+END();
diff --git a/mozilla/js/tests/ecma/Array/15.4-1.js b/mozilla/js/tests/ecma/Array/15.4-1.js
index fab7c85e4b0..733e3ce769d 100644
--- a/mozilla/js/tests/ecma/Array/15.4-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,108 +35,97 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4-1.js
- ECMA Section: 15.4 Array Objects
+ File Name: 15.4-1.js
+ ECMA Section: 15.4 Array Objects
- Description: Every Array object has a length property whose value
- is always an integer with positive sign and less than
- Math.pow(2,32).
+ Description: Every Array object has a length property whose value
+ is always an integer with positive sign and less than
+ Math.pow(2,32).
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array Objects";
+var SECTION = "15.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Objects";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length",
+ (Math.pow(2,32)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length")
+ );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr[Math.pow(2,32)-2]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length",
- (Math.pow(2,32)-1),
- eval("var myarr = new Array(); myarr[Math.pow(2,32)-2]='hi'; myarr.length")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length",
- (Math.pow(2,32)-2),
- eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length")
- );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr[Math.pow(2,32)-3]")
+ );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length",
- (Math.pow(2,31)-1),
- eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length")
- );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length",
+ (Math.pow(2,32)-2),
+ eval("var myarr = new Array(); myarr[Math.pow(2,32)-3]='hi'; myarr.length")
+ );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length",
- (Math.pow(2,31)),
- eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length")
- );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr[Math.pow(2,31)-2]")
+ );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length",
+ (Math.pow(2,31)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-2]='hi'; myarr.length")
+ );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length",
- (Math.pow(2,31)+1),
- eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length")
- );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr[Math.pow(2,31)-1]")
+ );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]",
- "hi",
- eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]")
- );
- array[item++] = new TestCase( SECTION,
- "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length",
- (Math.pow(2,30)-1),
- eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length")
- );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length",
+ (Math.pow(2,31)),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)-1]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr[Math.pow(2,31)]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length",
+ (Math.pow(2,31)+1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,31)]='hi'; myarr.length")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]",
+ "hi",
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr[Math.pow(2,30)-2]")
+ );
+
+new TestCase(SECTION,
+ "var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length",
+ (Math.pow(2,30)-1),
+ eval("var myarr = new Array(); myarr[Math.pow(2,30)-2]='hi'; myarr.length")
+ );
+
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Array/15.4-2.js b/mozilla/js/tests/ecma/Array/15.4-2.js
index 54f36305965..ad216f3c004 100644
--- a/mozilla/js/tests/ecma/Array/15.4-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,78 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4-2.js
- ECMA Section: 15.4 Array Objects
+File Name: 15.4-2.js
+ECMA Section: 15.4 Array Objects
- Description: Whenever a property is added whose name is an array
- index, the length property is changed, if necessary,
- to be one more than the numeric value of that array
- index; and whenever the length property is changed,
- every property whose name is an array index whose value
- is not smaller than the new length is automatically
- deleted. This constraint applies only to the Array
- object itself, and is unaffected by length or array
- index properties that may be inherited from its
- prototype.
+Description: Whenever a property is added whose name is an array
+index, the length property is changed, if necessary,
+to be one more than the numeric value of that array
+index; and whenever the length property is changed,
+every property whose name is an array index whose value
+is not smaller than the new length is automatically
+deleted. This constraint applies only to the Array
+object itself, and is unaffected by length or array
+index properties that may be inherited from its
+prototype.
- Author: christine@netscape.com
- Date: 28 october 1997
+Author: christine@netscape.com
+Date: 28 october 1997
*/
- var SECTION = "15.4-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array Objects";
+var SECTION = "15.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Objects";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length",
+ Math.pow(2,16)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length",
+ Math.pow(2,30)-1,
+ eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length", Math.pow(2,16)+1, eval("var arr=new Array(); arr[Math.pow(2,16)] = 'hi'; arr.length") );
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length",
+ Math.pow(2,30),
+ eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length", Math.pow(2,30)-1, eval("var arr=new Array(); arr[Math.pow(2,30)-2] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length", Math.pow(2,30), eval("var arr=new Array(); arr[Math.pow(2,30)-1] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length", Math.pow(2,30)+1, eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") );
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length",
+ Math.pow(2,30)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,30)] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length", Math.pow(2,31)-1, eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length", Math.pow(2,31), eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length", Math.pow(2,31)+1, eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") );
- array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)", "0,1", eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") );
- array[item++] = new TestCase( SECTION, "var arr = new Array(0,1); arr.length = 3; String(arr)", "0,1,", eval("var arr = new Array(0,1); arr.length = 3; String(arr)") );
-// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[0]; arr.length") );
-// array[item++] = new TestCase( SECTION, "var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length", 5, eval("var arr = new Array(0,1,2,3,4,5); delete arr[6]; arr.length") );
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length",
+ Math.pow(2,31)-1,
+ eval("var arr=new Array(); arr[Math.pow(2,31)-2] = 'hi'; arr.length") );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length",
+ Math.pow(2,31),
+ eval("var arr=new Array(); arr[Math.pow(2,31)-1] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length",
+ Math.pow(2,31)+1,
+ eval("var arr=new Array(); arr[Math.pow(2,31)] = 'hi'; arr.length") );
+
+new TestCase( SECTION,
+ "var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)",
+ "0,1",
+ eval("var arr = new Array(0,1,2,3,4,5); arr.length = 2; String(arr)") );
+
+new TestCase( SECTION,
+ "var arr = new Array(0,1); arr.length = 3; String(arr)",
+ "0,1,",
+ eval("var arr = new Array(0,1); arr.length = 3; String(arr)") );
+
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Array/15.4.1.1.js b/mozilla/js/tests/ecma/Array/15.4.1.1.js
index e03ec612e63..824e5b00dbd 100644
--- a/mozilla/js/tests/ecma/Array/15.4.1.1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.1.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,70 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.1.1.js
- ECMA Section: 15.4.1 Array( item0, item1,... )
+ File Name: 15.4.1.1.js
+ ECMA Section: 15.4.1 Array( item0, item1,... )
- Description: When Array is called as a function rather than as a
- constructor, it creates and initializes a new array
- object. Thus, the function call Array(...) is
- equivalent to the object creation new Array(...) with
- the same arguments.
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creation new Array(...) with
+ the same arguments.
- An array is created and returned as if by the expression
- new Array( item0, item1, ... ).
+ An array is created and returned as if by the expression
+ new Array( item0, item1, ... ).
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.1.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array Constructor Called as a Function";
+var SECTION = "15.4.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "typeof Array(1,2)",
+ "object",
+ typeof Array(1,2) );
+
+new TestCase( SECTION,
+ "(Array(1,2)).toString",
+ Array.prototype.toString,
+ (Array(1,2)).toString );
+
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") );
+
+new TestCase( SECTION,
+ "(Array(1,2)).length",
+ 2,
+ (Array(1,2)).length );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); arr[0]",
+ 1,
+ eval("var arr = (Array(1,2)); arr[0]") );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); arr[1]",
+ 2,
+ eval("var arr = (Array(1,2)); arr[1]") );
+
+new TestCase( SECTION,
+ "var arr = (Array(1,2)); String(arr)",
+ "1,2",
+ eval("var arr = (Array(1,2)); String(arr)") );
+
+test();
function ToUint32( n ) {
- n = Number( n );
- if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY ||
- n == Number.NEGATIVE_INFINITY ) {
- return 0;
- }
- var sign = n < 0 ? -1 : 1;
+ n = Number( n );
+ if( isNaN(n) || n == 0 || n == Number.POSITIVE_INFINITY ||
+ n == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+ var sign = n < 0 ? -1 : 1;
- return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32);
+ return ( sign * ( n * Math.floor( Math.abs(n) ) ) ) % Math.pow(2, 32);
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "typeof Array(1,2)", "object", typeof Array(1,2) );
- array[item++] = new TestCase( SECTION, "(Array(1,2)).toString", Array.prototype.toString, (Array(1,2)).toString );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()",
- "[object Array]",
- eval("var arr = Array(1,2,3); arr.toString = Object.prototype.toString; arr.toString()") );
-
-
- array[item++] = new TestCase( SECTION, "(Array(1,2)).length", 2, (Array(1,2)).length );
- array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[0]", 1, eval("var arr = (Array(1,2)); arr[0]") );
- array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); arr[1]", 2, eval("var arr = (Array(1,2)); arr[1]") );
- array[item++] = new TestCase( SECTION, "var arr = (Array(1,2)); String(arr)", "1,2", eval("var arr = (Array(1,2)); String(arr)") );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Array/15.4.1.2.js b/mozilla/js/tests/ecma/Array/15.4.1.2.js
index 490b8548045..3c2d2276f50 100644
--- a/mozilla/js/tests/ecma/Array/15.4.1.2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.1.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,126 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.1.2.js
- ECMA Section: 15.4.1.2 Array(len)
+ File Name: 15.4.1.2.js
+ ECMA Section: 15.4.1.2 Array(len)
- Description: When Array is called as a function rather than as a
- constructor, it creates and initializes a new array
- object. Thus, the function call Array(...) is
- equivalent to the object creationi new Array(...) with
- the same arguments.
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
- An array is created and returned as if by the
- expression new Array(len).
+ An array is created and returned as if by the
+ expression new Array(len).
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.1.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array Constructor Called as a Function: Array(len)";
+var SECTION = "15.4.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function: Array(len)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "(Array()).length",
+ 0,
+ (Array()).length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "(Array(0)).length",
+ 0,
+ (Array(0)).length );
- array[item++] = new TestCase( SECTION, "(Array()).length", 0, (Array()).length );
- array[item++] = new TestCase( SECTION, "(Array(0)).length", 0, (Array(0)).length );
- array[item++] = new TestCase( SECTION, "(Array(1)).length", 1, (Array(1)).length );
- array[item++] = new TestCase( SECTION, "(Array(10)).length", 10, (Array(10)).length );
- array[item++] = new TestCase( SECTION, "(Array('1')).length", 1, (Array('1')).length );
- array[item++] = new TestCase( SECTION, "(Array(1000)).length", 1000, (Array(1000)).length );
- array[item++] = new TestCase( SECTION, "(Array('1000')).length", 1, (Array('1000')).length );
- array[item++] = new TestCase( SECTION, "(Array(4294967295)).length", ToUint32(4294967295), (Array(4294967295)).length );
- array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)-1)).length", ToUint32(Math.pow(2,31)-1), (Array(Math.pow(2,31)-1)).length );
- array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31))).length", ToUint32(Math.pow(2,31)), (Array(Math.pow(2,31))).length );
- array[item++] = new TestCase( SECTION, "(Array(Math.pow(2,31)+1)).length", ToUint32(Math.pow(2,31)+1), (Array(Math.pow(2,31)+1)).length );
- array[item++] = new TestCase( SECTION, "(Array('8589934592')).length", 1, (Array("8589934592")).length );
- array[item++] = new TestCase( SECTION, "(Array('4294967296')).length", 1, (Array("4294967296")).length );
- array[item++] = new TestCase( SECTION, "(Array(1073741823)).length", ToUint32(1073741823), (Array(1073741823)).length );
- array[item++] = new TestCase( SECTION, "(Array(1073741824)).length", ToUint32(1073741824), (Array(1073741824)).length );
- array[item++] = new TestCase( SECTION, "(Array('a string')).length", 1, (Array("a string")).length );
+new TestCase( SECTION,
+ "(Array(1)).length",
+ 1,
+ (Array(1)).length );
+
+new TestCase( SECTION,
+ "(Array(10)).length",
+ 10,
+ (Array(10)).length );
+
+new TestCase( SECTION,
+ "(Array('1')).length",
+ 1,
+ (Array('1')).length );
+
+new TestCase( SECTION,
+ "(Array(1000)).length",
+ 1000,
+ (Array(1000)).length );
+
+new TestCase( SECTION,
+ "(Array('1000')).length",
+ 1,
+ (Array('1000')).length );
+
+new TestCase( SECTION,
+ "(Array(4294967295)).length",
+ ToUint32(4294967295),
+ (Array(4294967295)).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31)-1)).length",
+ ToUint32(Math.pow(2,31)-1),
+ (Array(Math.pow(2,31)-1)).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31))).length",
+ ToUint32(Math.pow(2,31)),
+ (Array(Math.pow(2,31))).length );
+
+new TestCase( SECTION,
+ "(Array(Math.pow(2,31)+1)).length",
+ ToUint32(Math.pow(2,31)+1),
+ (Array(Math.pow(2,31)+1)).length );
+
+new TestCase( SECTION,
+ "(Array('8589934592')).length",
+ 1,
+ (Array("8589934592")).length );
+
+new TestCase( SECTION,
+ "(Array('4294967296')).length",
+ 1,
+ (Array("4294967296")).length );
+
+new TestCase( SECTION,
+ "(Array(1073741823)).length",
+ ToUint32(1073741823),
+ (Array(1073741823)).length );
+
+new TestCase( SECTION,
+ "(Array(1073741824)).length",
+ ToUint32(1073741824),
+ (Array(1073741824)).length );
+
+new TestCase( SECTION,
+ "(Array('a string')).length",
+ 1,
+ (Array("a string")).length );
+
+test();
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
-}
\ No newline at end of file
+ return ( n );
+}
diff --git a/mozilla/js/tests/ecma/Array/15.4.1.3.js b/mozilla/js/tests/ecma/Array/15.4.1.3.js
index d4988acc0ec..ee821716d82 100644
--- a/mozilla/js/tests/ecma/Array/15.4.1.3.js
+++ b/mozilla/js/tests/ecma/Array/15.4.1.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,48 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.1.3.js
- ECMA Section: 15.4.1.3 Array()
+ File Name: 15.4.1.3.js
+ ECMA Section: 15.4.1.3 Array()
- Description: When Array is called as a function rather than as a
- constructor, it creates and initializes a new array
- object. Thus, the function call Array(...) is
- equivalent to the object creationi new Array(...) with
- the same arguments.
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
- An array is created and returned as if by the
- expression new Array(len).
+ An array is created and returned as if by the
+ expression new Array(len).
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.1.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array Constructor Called as a Function: Array()";
+var SECTION = "15.4.1.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array Constructor Called as a Function: Array()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
+new TestCase( SECTION,
+ "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()",
+ "[object Array]",
+ eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "(Array()).length",
+ 0,
+ (Array()).length );
- array[item++] = new TestCase( SECTION,
- "typeof Array()",
- "object",
- typeof Array() );
+new TestCase( SECTION,
+ "Array().toString()",
+ "",
+ Array().toString() );
- array[item++] = new TestCase( SECTION,
- "MYARR = new Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()",
- "[object Array]",
- eval("MYARR = Array();MYARR.getClass = Object.prototype.toString;MYARR.getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "(Array()).length",
- 0, (
- Array()).length );
-
- array[item++] = new TestCase( SECTION,
- "Array().toString()",
- "",
- Array().toString() );
-
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.1.js b/mozilla/js/tests/ecma/Array/15.4.1.js
index 1fb7b3c02f6..355aca504a3 100644
--- a/mozilla/js/tests/ecma/Array/15.4.1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,115 +35,96 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.1.js
- ECMA Section: 15.4.1 The Array Constructor Called as a Function
+ File Name: 15.4.1.js
+ ECMA Section: 15.4.1 The Array Constructor Called as a Function
- Description: When Array is called as a function rather than as a
- constructor, it creates and initializes a new array
- object. Thus, the function call Array(...) is
- equivalent to the object creationi new Array(...) with
- the same arguments.
+ Description: When Array is called as a function rather than as a
+ constructor, it creates and initializes a new array
+ object. Thus, the function call Array(...) is
+ equivalent to the object creationi new Array(...) with
+ the same arguments.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor Called as a Function";
+var SECTION = "15.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Array() +''",
+ "",
+ Array() +"" );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "typeof Array()",
+ "object",
+ typeof Array() );
- array[item++] = new TestCase( SECTION,
- "Array() +''",
- "",
- Array() +"" );
+new TestCase( SECTION,
+ "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
- array[item++] = new TestCase( SECTION,
- "typeof Array()",
- "object",
- typeof Array() );
+new TestCase( SECTION,
+ "var arr = Array(); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(); arr.toString == Array.prototype.toString") );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
- "[object Array]",
- eval("var arr = Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+new TestCase( SECTION,
+ "Array().length",
+ 0,
+ Array().length );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(); arr.toString == Array.prototype.toString",
- true,
- eval("var arr = Array(); arr.toString == Array.prototype.toString") );
+new TestCase( SECTION,
+ "Array(1,2,3) +''",
+ "1,2,3",
+ Array(1,2,3) +"" );
- array[item++] = new TestCase( SECTION,
- "Array().length",
- 0,
- Array().length );
+new TestCase( SECTION,
+ "typeof Array(1,2,3)",
+ "object",
+ typeof Array(1,2,3) );
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
- array[item++] = new TestCase( SECTION,
- "Array(1,2,3) +''",
- "1,2,3",
- Array(1,2,3) +"" );
+new TestCase( SECTION,
+ "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
- array[item++] = new TestCase( SECTION,
- "typeof Array(1,2,3)",
- "object",
- typeof Array(1,2,3) );
+new TestCase( SECTION,
+ "Array(1,2,3).length",
+ 3,
+ Array(1,2,3).length );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
- "[object Array]",
- eval("var arr = Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+new TestCase( SECTION,
+ "typeof Array(12345)",
+ "object",
+ typeof Array(12345) );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(1,2,3); arr.toString == Array.prototype.toString",
- true,
- eval("var arr = Array(1,2,3); arr.toString == Array.prototype.toString") );
+new TestCase( SECTION,
+ "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
- array[item++] = new TestCase( SECTION,
- "Array(1,2,3).length",
- 3,
- Array(1,2,3).length );
+new TestCase( SECTION,
+ "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
+ true,
+ eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
- array[item++] = new TestCase( SECTION,
- "typeof Array(12345)",
- "object",
- typeof Array(12345) );
+new TestCase( SECTION,
+ "Array(12345).length",
+ 12345,
+ Array(12345).length );
- array[item++] = new TestCase( SECTION,
- "var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()",
- "[object Array]",
- eval("var arr = Array(12345); arr.getClass = Object.prototype.toString; arr.getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString",
- true,
- eval("var arr = Array(1,2,3,4,5); arr.toString == Array.prototype.toString") );
-
- array[item++] = new TestCase( SECTION,
- "Array(12345).length",
- 12345,
- Array(12345).length );
-
- return ( array );
-}
-function test() {
- for (tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.1-1.js b/mozilla/js/tests/ecma/Array/15.4.2.1-1.js
index 446210c3929..1d81e57a099 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.1-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,74 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.2.1-1.js
- ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
- Description: This description only applies of the constructor is
- given two or more arguments.
+ File Name: 15.4.2.1-1.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
- The [[Prototype]] property of the newly constructed
- object is set to the original Array prototype object,
- the one that is the initial value of Array.prototype
- (15.4.3.1).
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
- The [[Class]] property of the newly constructed object
- is set to "Array".
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
- The length property of the newly constructed object is
- set to the number of arguments.
+ The length property of the newly constructed object is
+ set to the number of arguments.
- The 0 property of the newly constructed object is set
- to item0... in general, for as many arguments as there
- are, the k property of the newly constructed object is
- set to argument k, where the first argument is
- considered to be argument number 0.
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
- This file tests the typeof the newly constructed object.
+ This file tests the typeof the newly constructed object.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+var SECTION = "15.4.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "typeof new Array(1,2)",
+ "object",
+ typeof new Array(1,2) );
+new TestCase( SECTION,
+ "(new Array(1,2)).toString",
+ Array.prototype.toString,
+ (new Array(1,2)).toString );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
- array[item++] = new TestCase( SECTION, "typeof new Array(1,2)", "object", typeof new Array(1,2) );
- array[item++] = new TestCase( SECTION, "(new Array(1,2)).toString", Array.prototype.toString, (new Array(1,2)).toString );
- array[item++] = new TestCase( SECTION,
- "var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()",
- "[object Array]",
- eval("var arr = new Array(1,2,3); arr.getClass = Object.prototype.toString; arr.getClass()") );
+new TestCase( SECTION,
+ "(new Array(1,2)).length",
+ 2,
+ (new Array(1,2)).length );
- array[item++] = new TestCase( SECTION, "(new Array(1,2)).length", 2, (new Array(1,2)).length );
- array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[0]", 1, eval("var arr = (new Array(1,2)); arr[0]") );
- array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); arr[1]", 2, eval("var arr = (new Array(1,2)); arr[1]") );
- array[item++] = new TestCase( SECTION, "var arr = (new Array(1,2)); String(arr)", "1,2", eval("var arr = (new Array(1,2)); String(arr)") );
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); arr[0]",
+ 1,
+ eval("var arr = (new Array(1,2)); arr[0]") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); arr[1]",
+ 2,
+ eval("var arr = (new Array(1,2)); arr[1]") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "var arr = (new Array(1,2)); String(arr)",
+ "1,2",
+ eval("var arr = (new Array(1,2)); String(arr)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.1-2.js b/mozilla/js/tests/ecma/Array/15.4.2.1-2.js
index 202afbbdbf9..d71c6cd8006 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.1-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,65 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.2.1-2.js
- ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
- Description: This description only applies of the constructor is
- given two or more arguments.
+ File Name: 15.4.2.1-2.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
- The [[Prototype]] property of the newly constructed
- object is set to the original Array prototype object,
- the one that is the initial value of Array.prototype
- (15.4.3.1).
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
- The [[Class]] property of the newly constructed object
- is set to "Array".
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
- The length property of the newly constructed object is
- set to the number of arguments.
+ The length property of the newly constructed object is
+ set to the number of arguments.
- The 0 property of the newly constructed object is set
- to item0... in general, for as many arguments as there
- are, the k property of the newly constructed object is
- set to argument k, where the first argument is
- considered to be argument number 0.
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+var SECTION = "15.4.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- testcases = getTestCases();
- test();
+var TEST_STRING = "new Array(";
+var ARGUMENTS = ""
+var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
-function getTestCases() {
- var array = new Array();
-
- var TEST_STRING = "new Array(";
- var ARGUMENTS = ""
- var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
-
- for ( var index = 0; index < TEST_LENGTH; index++ ) {
- ARGUMENTS += index;
- ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
- }
-
- TEST_STRING += ARGUMENTS + ")";
-
- TEST_ARRAY = eval( TEST_STRING );
-
- for ( item = 0; item < TEST_LENGTH; item++ ) {
- array[item] = new TestCase( SECTION, "["+item+"]", item, TEST_ARRAY[item] );
- }
-
- array[item++ ] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" );
-
- return ( array );
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
}
+
+TEST_STRING += ARGUMENTS + ")";
+
+TEST_ARRAY = eval( TEST_STRING );
+
+for ( var item = 0; item < TEST_LENGTH; item++ ) {
+ new TestCase( SECTION,
+ "["+item+"]",
+ item,
+ TEST_ARRAY[item] );
+}
+
+new TestCase( SECTION,
+ "new Array( ["+TEST_LENGTH+" arguments] ) +''",
+ ARGUMENTS,
+ TEST_ARRAY +"" );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.1-3.js b/mozilla/js/tests/ecma/Array/15.4.2.1-3.js
index aebc165cc5c..75fa8dcb0f5 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.1-3.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,94 +35,101 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.2.1-3.js
- ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
- Description: This description only applies of the constructor is
- given two or more arguments.
+ File Name: 15.4.2.1-3.js
+ ECMA Section: 15.4.2.1 new Array( item0, item1, ... )
+ Description: This description only applies of the constructor is
+ given two or more arguments.
- The [[Prototype]] property of the newly constructed
- object is set to the original Array prototype object,
- the one that is the initial value of Array.prototype
- (15.4.3.1).
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype
+ (15.4.3.1).
- The [[Class]] property of the newly constructed object
- is set to "Array".
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
- The length property of the newly constructed object is
- set to the number of arguments.
+ The length property of the newly constructed object is
+ set to the number of arguments.
- The 0 property of the newly constructed object is set
- to item0... in general, for as many arguments as there
- are, the k property of the newly constructed object is
- set to argument k, where the first argument is
- considered to be argument number 0.
+ The 0 property of the newly constructed object is set
+ to item0... in general, for as many arguments as there
+ are, the k property of the newly constructed object is
+ set to argument k, where the first argument is
+ considered to be argument number 0.
- This test stresses the number of arguments presented to
- the Array constructor. Should support up to Math.pow
- (2,32) arguments, since that is the maximum length of an
- ECMAScript array.
+ This test stresses the number of arguments presented to
+ the Array constructor. Should support up to Math.pow
+ (2,32) arguments, since that is the maximum length of an
+ ECMAScript array.
- ***Change TEST_LENGTH to Math.pow(2,32) when larger array
- lengths are supported.
+ ***Change TEST_LENGTH to Math.pow(2,32) when larger array
+ lengths are supported.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
+var SECTION = "15.4.2.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( item0, item1, ...)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var TEST_STRING = "new Array(";
+var ARGUMENTS = ""
+var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
-function getTestCases() {
- var array = new Array();
-
- var TEST_STRING = "new Array(";
- var ARGUMENTS = ""
- var TEST_LENGTH = Math.pow(2,10); //Math.pow(2,32);
-
- for ( var index = 0; index < TEST_LENGTH; index++ ) {
- ARGUMENTS += index;
- ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
- }
-
- TEST_STRING += ARGUMENTS + ")";
-
- TEST_ARRAY = eval( TEST_STRING );
-
- for ( item = 0; item < TEST_LENGTH; item++ ) {
- array[item] = new TestCase( SECTION, "TEST_ARRAY["+item+"]", item, TEST_ARRAY[item] );
- }
-
- array[item++] = new TestCase( SECTION, "new Array( ["+TEST_LENGTH+" arguments] ) +''", ARGUMENTS, TEST_ARRAY +"" );
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.toString", Array.prototype.toString, TEST_ARRAY.toString );
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.join", Array.prototype.join, TEST_ARRAY.join );
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.sort", Array.prototype.sort, TEST_ARRAY.sort );
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.reverse", Array.prototype.reverse, TEST_ARRAY.reverse );
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.length", TEST_LENGTH, TEST_ARRAY.length );
- array[item++] = new TestCase( SECTION,
- "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()",
- "[object Array]",
- eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") );
-
- return ( array );
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += (index == (TEST_LENGTH-1) ) ? "" : ",";
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+TEST_STRING += ARGUMENTS + ")";
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+TEST_ARRAY = eval( TEST_STRING );
+
+for ( var item = 0; item < TEST_LENGTH; item++ ) {
+ new TestCase( SECTION,
+ "TEST_ARRAY["+item+"]",
+ item,
+ TEST_ARRAY[item] );
}
+
+new TestCase( SECTION,
+ "new Array( ["+TEST_LENGTH+" arguments] ) +''",
+ ARGUMENTS,
+ TEST_ARRAY +"" );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.toString",
+ Array.prototype.toString,
+ TEST_ARRAY.toString );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.join",
+ Array.prototype.join,
+ TEST_ARRAY.join );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.sort",
+ Array.prototype.sort,
+ TEST_ARRAY.sort );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.reverse",
+ Array.prototype.reverse,
+ TEST_ARRAY.reverse );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.length",
+ TEST_LENGTH,
+ TEST_ARRAY.length );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()",
+ "[object Array]",
+ eval("TEST_ARRAY.toString = Object.prototype.toString; TEST_ARRAY.toString()") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.2-1.js b/mozilla/js/tests/ecma/Array/15.4.2.2-1.js
index 3e2369a62bd..39aa9217eb6 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.2-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,147 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.2.2-1.js
- ECMA Section: 15.4.2.2 new Array(len)
+ File Name: 15.4.2.2-1.js
+ ECMA Section: 15.4.2.2 new Array(len)
- Description: This description only applies of the constructor is
- given two or more arguments.
+ Description: This description only applies of the constructor is
+ given two or more arguments.
- The [[Prototype]] property of the newly constructed
- object is set to the original Array prototype object,
- the one that is the initial value of Array.prototype(0)
- (15.4.3.1).
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
- The [[Class]] property of the newly constructed object
- is set to "Array".
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
- If the argument len is a number, then the length
- property of the newly constructed object is set to
- ToUint32(len).
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
- If the argument len is not a number, then the length
- property of the newly constructed object is set to 1
- and the 0 property of the newly constructed object is
- set to len.
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
- This file tests cases where len is a number.
+ This file tests cases where len is a number.
- The cases in this test need to be updated since the
- ToUint32 description has changed.
+ The cases in this test need to be updated since the
+ ToUint32 description has changed.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array( len )";
+var SECTION = "15.4.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( len )";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "new Array(0)",
+ "",
+ (new Array(0)).toString() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "typeof new Array(0)",
+ "object",
+ (typeof new Array(0)) );
- array[item++] = new TestCase( SECTION, "new Array(0)", "", (new Array(0)).toString() );
- array[item++] = new TestCase( SECTION, "typeof new Array(0)", "object", (typeof new Array(0)) );
- array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length );
- array[item++] = new TestCase( SECTION, "(new Array(0)).toString", Array.prototype.toString, (new Array(0)).toString );
+new TestCase( SECTION,
+ "(new Array(0)).length",
+ 0,
+ (new Array(0)).length );
- array[item++] = new TestCase( SECTION, "new Array(1)", "", (new Array(1)).toString() );
- array[item++] = new TestCase( SECTION, "new Array(1).length", 1, (new Array(1)).length );
- array[item++] = new TestCase( SECTION, "(new Array(1)).toString", Array.prototype.toString, (new Array(1)).toString );
+new TestCase( SECTION,
+ "(new Array(0)).toString",
+ Array.prototype.toString,
+ (new Array(0)).toString );
- array[item++] = new TestCase( SECTION, "(new Array(-0)).length", 0, (new Array(-0)).length );
- array[item++] = new TestCase( SECTION, "(new Array(0)).length", 0, (new Array(0)).length );
+new TestCase( SECTION,
+ "new Array(1)",
+ "",
+ (new Array(1)).toString() );
- array[item++] = new TestCase( SECTION, "(new Array(10)).length", 10, (new Array(10)).length );
- array[item++] = new TestCase( SECTION, "(new Array('1')).length", 1, (new Array('1')).length );
- array[item++] = new TestCase( SECTION, "(new Array(1000)).length", 1000, (new Array(1000)).length );
- array[item++] = new TestCase( SECTION, "(new Array('1000')).length", 1, (new Array('1000')).length );
+new TestCase( SECTION,
+ "new Array(1).length",
+ 1,
+ (new Array(1)).length );
- array[item++] = new TestCase( SECTION, "(new Array(4294967295)).length", ToUint32(4294967295), (new Array(4294967295)).length );
+new TestCase( SECTION,
+ "(new Array(1)).toString",
+ Array.prototype.toString,
+ (new Array(1)).toString );
- array[item++] = new TestCase( SECTION, "(new Array('8589934592')).length", 1, (new Array("8589934592")).length );
- array[item++] = new TestCase( SECTION, "(new Array('4294967296')).length", 1, (new Array("4294967296")).length );
- array[item++] = new TestCase( SECTION, "(new Array(1073741824)).length", ToUint32(1073741824), (new Array(1073741824)).length );
+new TestCase( SECTION,
+ "(new Array(-0)).length",
+ 0,
+ (new Array(-0)).length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "(new Array(0)).length",
+ 0,
+ (new Array(0)).length );
+
+new TestCase( SECTION,
+ "(new Array(10)).length",
+ 10,
+ (new Array(10)).length );
+
+new TestCase( SECTION,
+ "(new Array('1')).length",
+ 1,
+ (new Array('1')).length );
+
+new TestCase( SECTION,
+ "(new Array(1000)).length",
+ 1000,
+ (new Array(1000)).length );
+
+new TestCase( SECTION,
+ "(new Array('1000')).length",
+ 1,
+ (new Array('1000')).length );
+
+new TestCase( SECTION,
+ "(new Array(4294967295)).length",
+ ToUint32(4294967295),
+ (new Array(4294967295)).length );
+
+new TestCase( SECTION,
+ "(new Array('8589934592')).length",
+ 1,
+ (new Array("8589934592")).length );
+
+new TestCase( SECTION,
+ "(new Array('4294967296')).length",
+ 1,
+ (new Array("4294967296")).length );
+
+new TestCase( SECTION,
+ "(new Array(1073741824)).length",
+ ToUint32(1073741824),
+ (new Array(1073741824)).length );
+
+test();
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
-}
\ No newline at end of file
+ return ( n );
+}
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.2-2.js b/mozilla/js/tests/ecma/Array/15.4.2.2-2.js
index baa80751b63..8a92fc5073d 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.2-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,82 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.2.2-2.js
- ECMA Section: 15.4.2.2 new Array(len)
+ File Name: 15.4.2.2-2.js
+ ECMA Section: 15.4.2.2 new Array(len)
- Description: This description only applies of the constructor is
- given two or more arguments.
+ Description: This description only applies of the constructor is
+ given two or more arguments.
- The [[Prototype]] property of the newly constructed
- object is set to the original Array prototype object,
- the one that is the initial value of Array.prototype(0)
- (15.4.3.1).
+ The [[Prototype]] property of the newly constructed
+ object is set to the original Array prototype object,
+ the one that is the initial value of Array.prototype(0)
+ (15.4.3.1).
- The [[Class]] property of the newly constructed object
- is set to "Array".
+ The [[Class]] property of the newly constructed object
+ is set to "Array".
- If the argument len is a number, then the length
- property of the newly constructed object is set to
- ToUint32(len).
+ If the argument len is a number, then the length
+ property of the newly constructed object is set to
+ ToUint32(len).
- If the argument len is not a number, then the length
- property of the newly constructed object is set to 1
- and the 0 property of the newly constructed object is
- set to len.
+ If the argument len is not a number, then the length
+ property of the newly constructed object is set to 1
+ and the 0 property of the newly constructed object is
+ set to len.
- This file tests length of the newly constructed array
- when len is not a number.
+ This file tests length of the newly constructed array
+ when len is not a number.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array( len )";
+var SECTION = "15.4.2.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array( len )";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "(new Array(new Number(1073741823))).length",
+ 1,
+ (new Array(new Number(1073741823))).length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "(new Array(new Number(0))).length",
+ 1,
+ (new Array(new Number(0))).length );
- array[item++] = new TestCase( SECTION, "(new Array(new Number(1073741823))).length", 1, (new Array(new Number(1073741823))).length );
- array[item++] = new TestCase( SECTION, "(new Array(new Number(0))).length", 1, (new Array(new Number(0))).length );
- array[item++] = new TestCase( SECTION, "(new Array(new Number(1000))).length", 1, (new Array(new Number(1000))).length );
- array[item++] = new TestCase( SECTION, "(new Array('mozilla, larryzilla, curlyzilla')).length", 1, (new Array('mozilla, larryzilla, curlyzilla')).length );
- array[item++] = new TestCase( SECTION, "(new Array(true)).length", 1, (new Array(true)).length );
- array[item++] = new TestCase( SECTION, "(new Array(false)).length", 1, (new Array(false)).length);
- array[item++] = new TestCase( SECTION, "(new Array(new Boolean(true)).length", 1, (new Array(new Boolean(true))).length );
- array[item++] = new TestCase( SECTION, "(new Array(new Boolean(false)).length", 1, (new Array(new Boolean(false))).length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "(new Array(new Number(1000))).length",
+ 1,
+ (new Array(new Number(1000))).length );
+
+new TestCase( SECTION,
+ "(new Array('mozilla, larryzilla, curlyzilla')).length",
+ 1,
+ (new Array('mozilla, larryzilla, curlyzilla')).length );
+
+new TestCase( SECTION,
+ "(new Array(true)).length",
+ 1,
+ (new Array(true)).length );
+
+new TestCase( SECTION,
+ "(new Array(false)).length",
+ 1,
+ (new Array(false)).length);
+
+new TestCase( SECTION,
+ "(new Array(new Boolean(true)).length",
+ 1,
+ (new Array(new Boolean(true))).length );
+
+new TestCase( SECTION,
+ "(new Array(new Boolean(false)).length",
+ 1,
+ (new Array(new Boolean(false))).length );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.2.3.js b/mozilla/js/tests/ecma/Array/15.4.2.3.js
index 24170913cbd..c17e6d178e7 100644
--- a/mozilla/js/tests/ecma/Array/15.4.2.3.js
+++ b/mozilla/js/tests/ecma/Array/15.4.2.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,65 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.2.3.js
- ECMA Section: 15.4.2.3 new Array()
- Description: The [[Prototype]] property of the newly constructed
- object is set to the origianl Array prototype object,
- the one that is the initial value of Array.prototype.
- The [[Class]] property of the new object is set to
- "Array". The length of the object is set to 0.
- Author: christine@netscape.com
- Date: 7 october 1997
+/**
+ File Name: 15.4.2.3.js
+ ECMA Section: 15.4.2.3 new Array()
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the origianl Array prototype object,
+ the one that is the initial value of Array.prototype.
+ The [[Class]] property of the new object is set to
+ "Array". The length of the object is set to 0.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.2.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Array Constructor: new Array()";
+var SECTION = "15.4.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Array Constructor: new Array()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "new Array() +''",
+ "",
+ (new Array()) +"" );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "new Array() +''", "", (new Array()) +"" );
- array[item++] = new TestCase( SECTION, "typeof new Array()", "object", (typeof new Array()) );
- array[item++] = new TestCase( SECTION,
- "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
- "[object Array]",
- eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
+new TestCase( SECTION,
+ "typeof new Array()",
+ "object",
+ (typeof new Array()) );
- array[item++] = new TestCase( SECTION, "(new Array()).length", 0, (new Array()).length );
- array[item++] = new TestCase( SECTION, "(new Array()).toString == Array.prototype.toString", true, (new Array()).toString == Array.prototype.toString );
- array[item++] = new TestCase( SECTION, "(new Array()).join == Array.prototype.join", true, (new Array()).join == Array.prototype.join );
- array[item++] = new TestCase( SECTION, "(new Array()).reverse == Array.prototype.reverse", true, (new Array()).reverse == Array.prototype.reverse );
- array[item++] = new TestCase( SECTION, "(new Array()).sort == Array.prototype.sort", true, (new Array()).sort == Array.prototype.sort );
+new TestCase( SECTION,
+ "var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()",
+ "[object Array]",
+ eval("var arr = new Array(); arr.getClass = Object.prototype.toString; arr.getClass()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION,
+ "(new Array()).length",
+ 0,
+ (new Array()).length );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "(new Array()).toString == Array.prototype.toString",
+ true,
+ (new Array()).toString == Array.prototype.toString );
+
+new TestCase( SECTION,
+ "(new Array()).join == Array.prototype.join",
+ true,
+ (new Array()).join == Array.prototype.join );
+
+new TestCase( SECTION,
+ "(new Array()).reverse == Array.prototype.reverse",
+ true,
+ (new Array()).reverse == Array.prototype.reverse );
+
+new TestCase( SECTION,
+ "(new Array()).sort == Array.prototype.sort",
+ true,
+ (new Array()).sort == Array.prototype.sort );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.3.1-2.js b/mozilla/js/tests/ecma/Array/15.4.3.1-2.js
index 8b5a119a1e6..7f4e25dcd90 100644
--- a/mozilla/js/tests/ecma/Array/15.4.3.1-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,45 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.3.1-1.js
- ECMA Section: 15.4.3.1 Array.prototype
- Description: The initial value of Array.prototype is the built-in
- Array prototype object (15.4.4).
- Author: christine@netscape.com
- Date: 7 october 1997
+/**
+ File Name: 15.4.3.1-1.js
+ ECMA Section: 15.4.3.1 Array.prototype
+ Description: The initial value of Array.prototype is the built-in
+ Array prototype object (15.4.4).
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.3.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype";
+var SECTION = "15.4.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- var ARRAY_PROTO = Array.prototype;
+var ARRAY_PROTO = Array.prototype;
- array[item++] = new TestCase( SECTION, "var props = ''; for ( p in Array ) { props += p } props", "", eval("var props = ''; for ( p in Array ) { props += p } props") );
+new TestCase( SECTION,
+ "var props = ''; for ( p in Array ) { props += p } props",
+ "",
+ eval("var props = ''; for ( p in Array ) { props += p } props") );
- array[item++] = new TestCase( SECTION, "Array.prototype = null; Array.prototype", ARRAY_PROTO, eval("Array.prototype = null; Array.prototype") );
+new TestCase( SECTION,
+ "Array.prototype = null; Array.prototype",
+ ARRAY_PROTO,
+ eval("Array.prototype = null; Array.prototype") );
- array[item++] = new TestCase( SECTION, "delete Array.prototype", false, delete Array.prototype );
- array[item++] = new TestCase( SECTION, "delete Array.prototype; Array.prototype", ARRAY_PROTO, eval("delete Array.prototype; Array.prototype") );
+new TestCase( SECTION,
+ "delete Array.prototype",
+ false,
+ delete Array.prototype );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "delete Array.prototype; Array.prototype",
+ ARRAY_PROTO,
+ eval("delete Array.prototype; Array.prototype") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.3.2.js b/mozilla/js/tests/ecma/Array/15.4.3.2.js
index ac93ea684fd..aa3caa319c4 100644
--- a/mozilla/js/tests/ecma/Array/15.4.3.2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.3.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,39 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.3.2.js
- ECMA Section: 15.4.3.2 Array.length
- Description: The length property is 1.
- Author: christine@netscape.com
- Date: 7 october 1997
+/**
+ File Name: 15.4.3.2.js
+ ECMA Section: 15.4.3.2 Array.length
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.3.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.length";
+var SECTION = "15.4.3.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Array.length",
+ 1,
+ Array.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Array.length", 1, Array.length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.3.js b/mozilla/js/tests/ecma/Array/15.4.3.js
index c3385fc68a3..2370098de3d 100644
--- a/mozilla/js/tests/ecma/Array/15.4.3.js
+++ b/mozilla/js/tests/ecma/Array/15.4.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.3.js
- ECMA Section: 15.4.3 Properties of the Array Constructor
- Description: The value of the internal [[Prototype]] property of the
- Array constructor is the Function prototype object.
- Author: christine@netscape.com
- Date: 7 october 1997
+/**
+ File Name: 15.4.3.js
+ ECMA Section: 15.4.3 Properties of the Array Constructor
+ Description: The value of the internal [[Prototype]] property of the
+ Array constructor is the Function prototype object.
+
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.3";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "Properties of the Array Constructor";
+var SECTION = "15.4.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Array Constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Array.__proto__",
+ Function.prototype,
+ Array.__proto__ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
-
- return ( array );
-}
-function test() {
- for (tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
-
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.1.js b/mozilla/js/tests/ecma/Array/15.4.4.1.js
index 917b1aa0b05..8b7fca4f3e0 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,39 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.1.js
- ECMA Section: 15.4.4.1 Array.prototype.constructor
- Description: The initial value of Array.prototype.constructor
- is the built-in Array constructor.
- Author: christine@netscape.com
- Date: 7 october 1997
+ File Name: 15.4.4.1.js
+ ECMA Section: 15.4.4.1 Array.prototype.constructor
+ Description: The initial value of Array.prototype.constructor
+ is the built-in Array constructor.
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype.constructor";
+var SECTION = "15.4.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Array.prototype.constructor == Array", true, Array.prototype.constructor == Array);
- return ( array );
-}
-function test() {
- for (tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Array.prototype.constructor == Array",
+ true,
+ Array.prototype.constructor == Array);
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.2.js b/mozilla/js/tests/ecma/Array/15.4.4.2.js
index 9b52442d2cf..68fc709b32c 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.2.js
- ECMA Section: 15.4.4.2 Array.prototype.toString()
- Description: The elements of this object are converted to strings
- and these strings are then concatenated, separated by
- comma characters. The result is the same as if the
- built-in join method were invoiked for this object
- with no argument.
- Author: christine@netscape.com
- Date: 7 october 1997
+ File Name: 15.4.4.2.js
+ ECMA Section: 15.4.4.2 Array.prototype.toString()
+ Description: The elements of this object are converted to strings
+ and these strings are then concatenated, separated by
+ comma characters. The result is the same as if the
+ built-in join method were invoiked for this object
+ with no argument.
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.4.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype.toString";
+var SECTION = "15.4.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Array.prototype.toString.length",
+ 0,
+ Array.prototype.toString.length );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "(new Array()).toString()",
+ "",
+ (new Array()).toString() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "(new Array(2)).toString()",
+ ",",
+ (new Array(2)).toString() );
- array[item++] = new TestCase( SECTION, "Array.prototype.toString.length", 0, Array.prototype.toString.length );
+new TestCase( SECTION,
+ "(new Array(0,1)).toString()",
+ "0,1",
+ (new Array(0,1)).toString() );
- array[item++] = new TestCase( SECTION, "(new Array()).toString()", "", (new Array()).toString() );
- array[item++] = new TestCase( SECTION, "(new Array(2)).toString()", ",", (new Array(2)).toString() );
- array[item++] = new TestCase( SECTION, "(new Array(0,1)).toString()", "0,1", (new Array(0,1)).toString() );
- array[item++] = new TestCase( SECTION, "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()", "NaN,Infinity,-Infinity", (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() );
+new TestCase( SECTION,
+ "(new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString()",
+ "NaN,Infinity,-Infinity",
+ (new Array( Number.NaN, Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY)).toString() );
- array[item++] = new TestCase( SECTION, "(new Array( Boolean(1), Boolean(0))).toString()", "true,false", (new Array(Boolean(1),Boolean(0))).toString() );
- array[item++] = new TestCase( SECTION, "(new Array(void 0,null)).toString()", ",", (new Array(void 0,null)).toString() );
+new TestCase( SECTION,
+ "(new Array( Boolean(1), Boolean(0))).toString()",
+ "true,false",
+ (new Array(Boolean(1),Boolean(0))).toString() );
- var EXPECT_STRING = "";
- var MYARR = new Array();
+new TestCase( SECTION,
+ "(new Array(void 0,null)).toString()",
+ ",",
+ (new Array(void 0,null)).toString() );
- for ( var i = -50; i < 50; i+= 0.25 ) {
- MYARR[MYARR.length] = i;
- EXPECT_STRING += i +",";
- }
+var EXPECT_STRING = "";
+var MYARR = new Array();
- EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 );
-
- array[item++] = new TestCase( SECTION, "MYARR.toString()", EXPECT_STRING, MYARR.toString() );
-
-
- return ( array );
-}
-function test() {
- for ( tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( var i = -50; i < 50; i+= 0.25 ) {
+ MYARR[MYARR.length] = i;
+ EXPECT_STRING += i +",";
}
+
+EXPECT_STRING = EXPECT_STRING.substring( 0, EXPECT_STRING.length -1 );
+
+new TestCase( SECTION,
+ "MYARR.toString()",
+ EXPECT_STRING,
+ MYARR.toString() );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.3-1.js b/mozilla/js/tests/ecma/Array/15.4.4.3-1.js
index c8cff0ecaec..46d1f48be13 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.3-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,141 +35,127 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.3-1.js
- ECMA Section: 15.4.4.3-1 Array.prototype.join()
- Description: The elements of this object are converted to strings and
- these strings are then concatenated, separated by comma
- characters. The result is the same as if the built-in join
- method were invoiked for this object with no argument.
- Author: christine@netscape.com, pschwartau@netscape.com
- Date: 07 October 1997
- Modified: 14 July 2002
- Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285
- ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join()
- Step 3: If |separator| is |undefined|, let |separator|
- be the single-character string ","
-*
-*/
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.join()
+ Description: The elements of this object are converted to strings and
+ these strings are then concatenated, separated by comma
+ characters. The result is the same as if the built-in join
+ method were invoiked for this object with no argument.
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 07 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155285
+ ECMA-262 Ed.3 Section 15.4.4.5 Array.prototype.join()
+ Step 3: If |separator| is |undefined|, let |separator|
+ be the single-character string ","
+ *
+ */
- var SECTION = "15.4.4.3-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.4.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Array.prototype.join()");
+writeHeaderToLog( SECTION + " Array.prototype.join()");
- var testcases = getTestCases();
- test();
+var ARR_PROTOTYPE = Array.prototype;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length );
+new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length );
+new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") );
- var ARR_PROTOTYPE = Array.prototype;
+// case where array length is 0
- array[item++] = new TestCase( SECTION, "Array.prototype.join.length", 1, Array.prototype.join.length );
- array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length", false, delete Array.prototype.join.length );
- array[item++] = new TestCase( SECTION, "delete Array.prototype.join.length; Array.prototype.join.length", 1, eval("delete Array.prototype.join.length; Array.prototype.join.length") );
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join()",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") );
- // case where array length is 0
+// array length is 0, but spearator is specified
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(); TEST_ARRAY.join()",
- "",
- eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join()") );
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')",
+ "",
+ eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") );
- // array length is 0, but spearator is specified
+// length is greater than 0, separator is supplied
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')",
+ "&&true&false&123&[object Object]&true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") );
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')",
- "",
- eval("var TEST_ARRAY = new Array(); TEST_ARRAY.join(' ')") );
+// length is greater than 0, separator is empty string
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')",
+ "truefalse123[object Object]true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") );
- // length is greater than 0, separator is supplied
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')",
- "&&true&false&123&[object Object]&true",
- eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('&')") );
+// length is greater than 0, separator is undefined
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") );
- // length is greater than 0, separator is empty string
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')",
- "truefalse123[object Object]true",
- eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('')") );
- // length is greater than 0, separator is undefined
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)",
- ",,true,false,123,[object Object],true",
- eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join(void 0)") );
+// length is greater than 0, separator is not supplied
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()",
+ ",,true,false,123,[object Object],true",
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") );
- // length is greater than 0, separator is not supplied
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()",
- ",,true,false,123,[object Object],true",
- eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join()") );
+// separator is a control character
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')",
+ unescape("%u000B%u000Btrue%u000Bfalse%u000B123%u000B[object Object]%u000Btrue"),
+ eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") );
- // separator is a control character
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')",
- unescape("%u000B%u000Btrue%u000Bfalse%u000B123%u000B[object Object]%u000Btrue"),
- eval("var TEST_ARRAY = new Array(null, void 0, true, false, 123, new Object(), new Boolean(true) ); TEST_ARRAY.join('\v')") );
-
- // length of array is 1
- array[item++] = new TestCase( SECTION,
- "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')",
- "true",
- eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") );
+// length of array is 1
+new TestCase( SECTION,
+ "var TEST_ARRAY = new Array(true) ); TEST_ARRAY.join('\v')",
+ "true",
+ eval("var TEST_ARRAY = new Array(true); TEST_ARRAY.join('\v')") );
- SEPARATOR = "\t"
- TEST_LENGTH = 100;
- TEST_STRING = "";
- ARGUMENTS = "";
- TEST_RESULT = "";
+SEPARATOR = "\t"
+TEST_LENGTH = 100;
+TEST_STRING = "";
+ARGUMENTS = "";
+TEST_RESULT = "";
- for ( var index = 0; index < TEST_LENGTH; index++ ) {
- ARGUMENTS += index;
- ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ",";
+for ( var index = 0; index < TEST_LENGTH; index++ ) {
+ ARGUMENTS += index;
+ ARGUMENTS += ( index == TEST_LENGTH -1 ) ? "" : ",";
- TEST_RESULT += index;
- TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR;
- }
-
- TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" );
-
- array[item++] = new TestCase( SECTION, "TEST_ARRAY.join("+SEPARATOR+")", TEST_RESULT, TEST_ARRAY.join( SEPARATOR ) );
-
- array[item++] = new TestCase( SECTION, "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()",
- "true,false,,,1e+21,1e-7",
- (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() );
-
- // this is not an Array object
- array[item++] = new TestCase( SECTION,
- "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')",
- "true:false:111:0.5:1230000:NaN::",
- eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") );
-
-
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ TEST_RESULT += index;
+ TEST_RESULT += ( index == TEST_LENGTH -1 ) ? "" : SEPARATOR;
}
+
+TEST_ARRAY = eval( "new Array( "+ARGUMENTS +")" );
+
+new TestCase( SECTION,
+ "TEST_ARRAY.join("+SEPARATOR+")",
+ TEST_RESULT,
+ TEST_ARRAY.join( SEPARATOR ) );
+
+new TestCase( SECTION,
+ "(new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join()",
+ "true,false,,,1e+21,1e-7",
+ (new Array( Boolean(true), Boolean(false), null, void 0, Number(1e+21), Number(1e-7))).join() );
+
+// this is not an Array object
+new TestCase( SECTION,
+ "var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')",
+ "true:false:111:0.5:1230000:NaN::",
+ eval("var OB = new Object_1('true,false,111,0.5,1.23e6,NaN,void 0,null'); OB.join(':')") );
+
+test();
+
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = eval(this.array[i]);
- }
- this.join = Array.prototype.join;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.join;
+ this.getClass = Object.prototype.toString;
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.4-1.js b/mozilla/js/tests/ecma/Array/15.4.4.4-1.js
index 3e09fd3631a..ca8271b571c 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.4-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,12 +36,12 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.4.4.3-1.js
- ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
- Description:
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
- The elements of the array are rearranged so as to reverse their order.
- This object is returned as the result of the call.
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
1. Call the [[Get]] method of this object with argument "length".
2. Call ToUint32(Result(1)).
@@ -51,237 +52,240 @@
7. Call ToString(k).
8. ToString(Result(6)).
9. Call the [[Get]] method of this object with argument Result(7).
- 10. Call the [[Get]] method of this object with argument Result(8).
- 11. If this object has a property named by Result(8), go to step 12; but
- if this object has no property named by Result(8), then go to either
- step 12 or step 14, depending on the implementation.
- 12. Call the [[Put]] method of this object with arguments Result(7) and
- Result(10).
- 13. Go to step 15.
- 14. Call the [[Delete]] method on this object, providing Result(7) as the
- name of the property to delete.
- 15. If this object has a property named by Result(7), go to step 16; but if
- this object has no property named by Result(7), then go to either step 16
- or step 18, depending on the implementation.
- 16. Call the [[Put]] method of this object with arguments Result(8) and
- Result(9).
- 17. Go to step 19.
- 18. Call the [[Delete]] method on this object, providing Result(8) as the
- name of the property to delete.
- 19. Increase k by 1.
- 20. Go to step 5.
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
-Note that the reverse function is intentionally generic; it does not require
-that its this value be an Array object. Therefore it can be transferred to other
-kinds of objects for use as a method. Whether the reverse function can be applied
-successfully to a host object is implementation dependent.
+ Note that the reverse function is intentionally generic; it does not require
+ that its this value be an Array object. Therefore it can be transferred to other
+ kinds of objects for use as a method. Whether the reverse function can be applied
+ successfully to a host object is implementation dependent.
- Note: Array.prototype.reverse allows some flexibility in implementation
- regarding array indices that have not been populated. This test covers the
- cases in which unpopulated indices are not deleted, since the JavaScript
- implementation does not delete uninitialzed indices.
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.4.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var BUGNUMBER="123724";
+var SECTION = "15.4.4.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var BUGNUMBER="123724";
- writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+writeHeaderToLog( SECTION + " Array.prototype.reverse()");
- var testcases = new Array();
- getTestCases();
- test();
+var ARR_PROTOTYPE = Array.prototype;
-function getTestCases() {
- var ARR_PROTOTYPE = Array.prototype;
+new TestCase( SECTION,
+ "Array.prototype.reverse.length",
+ 0,
+ Array.prototype.reverse.length );
- testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
- testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
- testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+new TestCase( SECTION,
+ "delete Array.prototype.reverse.length",
+ false,
+ delete Array.prototype.reverse.length );
- // length of array is 0
- testcases[testcases.length] = new TestCase( SECTION,
- "var A = new Array(); A.reverse(); A.length",
- 0,
- eval("var A = new Array(); A.reverse(); A.length") );
+new TestCase( SECTION,
+ "delete Array.prototype.reverse.length; Array.prototype.reverse.length",
+ 0,
+ eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
- // length of array is 1
- var A = new Array(true);
- var R = Reverse(A);
+// length of array is 0
+new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
- testcases[testcases.length] = new TestCase( SECTION,
- "var A = new Array(true); A.reverse(); A.length",
- R.length,
- eval("var A = new Array(true); A.reverse(); A.length") );
- CheckItems( R, A );
+// length of array is 1
+var A = new Array(true);
+var R = Reverse(A);
- // length of array is 2
- var S = "var A = new Array( true,false )";
- eval(S);
- var R = Reverse(A);
+new TestCase( SECTION,
+ "var A = new Array(true); A.reverse(); A.length",
+ R.length,
+ eval("var A = new Array(true); A.reverse(); A.length") );
- testcases[testcases.length] = new TestCase(
- SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
+CheckItems( R, A );
- CheckItems( R, A );
+// length of array is 2
+var S = "var A = new Array( true,false )";
+eval(S);
+var R = Reverse(A);
- // length of array is 3
- var S = "var A = new Array( true,false,null )";
- eval(S);
- var R = Reverse(A);
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
+CheckItems( R, A );
- // length of array is 4
- var S = "var A = new Array( true,false,null,void 0 )";
- eval(S);
- var R = Reverse(A);
+// length of array is 3
+var S = "var A = new Array( true,false,null )";
+eval(S);
+var R = Reverse(A);
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+// length of array is 4
+var S = "var A = new Array( true,false,null,void 0 )";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+CheckItems( R, A );
- // some array indexes have not been set
- var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'";
- eval(S);
- var R = Reverse(A);
+// some array indexes have not been set
+var S = "var A = new Array(); A[8] = 'hi', A[3] = 'yo'";
+eval(S);
+var R = Reverse(A);
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
- var OBJECT_OBJECT = new Object();
- var FUNCTION_OBJECT = new Function( 'return this' );
- var BOOLEAN_OBJECT = new Boolean;
- var DATE_OBJECT = new Date(0);
- var STRING_OBJECT = new String('howdy');
- var NUMBER_OBJECT = new Number(Math.PI);
- var ARRAY_OBJECT= new Array(1000);
+var OBJECT_OBJECT = new Object();
+var FUNCTION_OBJECT = new Function( 'return this' );
+var BOOLEAN_OBJECT = new Boolean;
+var DATE_OBJECT = new Date(0);
+var STRING_OBJECT = new String('howdy');
+var NUMBER_OBJECT = new Number(Math.PI);
+var ARRAY_OBJECT= new Array(1000);
- var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+
- "ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'";
+var args = "null, void 0, Math.pow(2,32), 1.234e-32, OBJECT_OBJECT, BOOLEAN_OBJECT, FUNCTION_OBJECT, DATE_OBJECT, STRING_OBJECT,"+
+"ARRAY_OBJECT, NUMBER_OBJECT, Math, true, false, 123, '90210'";
- var S = "var A = new Array("+args+")";
- eval(S);
- var R = Reverse(A);
+var S = "var A = new Array("+args+")";
+eval(S);
+var R = Reverse(A);
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
- var limit = 1000;
- var args = "";
- for (var i = 0; i < limit; i++ ) {
- args += i +"";
- if ( i + 1 < limit ) {
- args += ",";
- }
- }
+CheckItems( R, A );
- var S = "var A = new Array("+args+")";
- eval(S);
- var R = Reverse(A);
-
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
-
- var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )";
- eval(S);
- var R = Reverse( A );
-
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.reverse(); A.length",
- R.length,
- eval( S + "; A.reverse(); A.length") );
- CheckItems( R, A );
-
- return ( testcases );
+var limit = 1000;
+var args = "";
+for (var i = 0; i < limit; i++ ) {
+ args += i +"";
+ if ( i + 1 < limit ) {
+ args += ",";
+ }
}
+
+var S = "var A = new Array("+args+")";
+eval(S);
+var R = Reverse(A);
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+var S = "var MYOBJECT = new Object_1( \"void 0, 1, null, 2, \'\'\" )";
+eval(S);
+var R = Reverse( A );
+
+new TestCase( SECTION,
+ S +"; A.reverse(); A.length",
+ R.length,
+ eval( S + "; A.reverse(); A.length") );
+
+CheckItems( R, A );
+
+test();
+
function CheckItems( R, A ) {
- for ( var i = 0; i < R.length; i++ ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "A["+i+ "]",
- R[i],
- A[i] );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( var i = 0; i < R.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
}
+
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = eval(this.array[i]);
- }
- this.join = Array.prototype.reverse;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
}
+
function Reverse( array ) {
- var r2 = array.length;
- var k = 0;
- var r3 = Math.floor( r2/2 );
- if ( r3 == k ) {
- return array;
- }
-
- for ( k = 0; k < r3; k++ ) {
- var r6 = r2 - k - 1;
-// var r7 = String( k );
- var r7 = k;
- var r8 = String( r6 );
-
- var r9 = array[r7];
- var r10 = array[r8];
-
- array[r7] = r10;
- array[r8] = r9;
- }
-
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
}
+
function Iterate( array ) {
- for ( var i = 0; i < array.length; i++ ) {
+ for ( var i = 0; i < array.length; i++ ) {
// print( i+": "+ array[String(i)] );
- }
+ }
}
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = this.array[i];
- }
- this.reverse = Array.prototype.reverse;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.4-2.js b/mozilla/js/tests/ecma/Array/15.4.4.4-2.js
index 9684e521d2c..37252e0a9cd 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.4-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,13 +35,14 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.4.3-1.js
- ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
- Description:
- The elements of the array are rearranged so as to reverse their order.
- This object is returned as the result of the call.
+/**
+ File Name: 15.4.4.3-1.js
+ ECMA Section: 15.4.4.3-1 Array.prototype.reverse()
+ Description:
+
+ The elements of the array are rearranged so as to reverse their order.
+ This object is returned as the result of the call.
1. Call the [[Get]] method of this object with argument "length".
2. Call ToUint32(Result(1)).
@@ -51,128 +53,115 @@
7. Call ToString(k).
8. ToString(Result(6)).
9. Call the [[Get]] method of this object with argument Result(7).
- 10. Call the [[Get]] method of this object with argument Result(8).
- 11. If this object has a property named by Result(8), go to step 12; but
- if this object has no property named by Result(8), then go to either
- step 12 or step 14, depending on the implementation.
- 12. Call the [[Put]] method of this object with arguments Result(7) and
- Result(10).
- 13. Go to step 15.
- 14. Call the [[Delete]] method on this object, providing Result(7) as the
- name of the property to delete.
- 15. If this object has a property named by Result(7), go to step 16; but if
- this object has no property named by Result(7), then go to either step 16
- or step 18, depending on the implementation.
- 16. Call the [[Put]] method of this object with arguments Result(8) and
- Result(9).
- 17. Go to step 19.
- 18. Call the [[Delete]] method on this object, providing Result(8) as the
- name of the property to delete.
- 19. Increase k by 1.
- 20. Go to step 5.
+ 10. Call the [[Get]] method of this object with argument Result(8).
+ 11. If this object has a property named by Result(8), go to step 12; but
+ if this object has no property named by Result(8), then go to either
+ step 12 or step 14, depending on the implementation.
+ 12. Call the [[Put]] method of this object with arguments Result(7) and
+ Result(10).
+ 13. Go to step 15.
+ 14. Call the [[Delete]] method on this object, providing Result(7) as the
+ name of the property to delete.
+ 15. If this object has a property named by Result(7), go to step 16; but if
+ this object has no property named by Result(7), then go to either step 16
+ or step 18, depending on the implementation.
+ 16. Call the [[Put]] method of this object with arguments Result(8) and
+ Result(9).
+ 17. Go to step 19.
+ 18. Call the [[Delete]] method on this object, providing Result(8) as the
+ name of the property to delete.
+ 19. Increase k by 1.
+ 20. Go to step 5.
-Note that the reverse function is intentionally generic; it does not require
-that its this value be an Array object. Therefore it can be transferred to other
-kinds of objects for use as a method. Whether the reverse function can be applied
-successfully to a host object is implementation dependent.
+ Note that the reverse function is intentionally generic; it does not require
+ that its this value be an Array object. Therefore it can be transferred to other
+ kinds of objects for use as a method. Whether the reverse function can be applied
+ successfully to a host object is implementation dependent.
- Note: Array.prototype.reverse allows some flexibility in implementation
- regarding array indices that have not been populated. This test covers the
- cases in which unpopulated indices are not deleted, since the JavaScript
- implementation does not delete uninitialzed indices.
+ Note: Array.prototype.reverse allows some flexibility in implementation
+ regarding array indices that have not been populated. This test covers the
+ cases in which unpopulated indices are not deleted, since the JavaScript
+ implementation does not delete uninitialzed indices.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.4.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = new Array();
+var SECTION = "15.4.4.4-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Array.prototype.reverse()");
+writeHeaderToLog( SECTION + " Array.prototype.reverse()");
- getTestCases();
- test();
+var ARR_PROTOTYPE = Array.prototype;
-function getTestCases() {
- var ARR_PROTOTYPE = Array.prototype;
+new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
+new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
+new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
- testcases[testcases.length] = new TestCase( SECTION, "Array.prototype.reverse.length", 0, Array.prototype.reverse.length );
- testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length", false, delete Array.prototype.reverse.length );
- testcases[testcases.length] = new TestCase( SECTION, "delete Array.prototype.reverse.length; Array.prototype.reverse.length", 0, eval("delete Array.prototype.reverse.length; Array.prototype.reverse.length") );
+// length of array is 0
+new TestCase( SECTION,
+ "var A = new Array(); A.reverse(); A.length",
+ 0,
+ eval("var A = new Array(); A.reverse(); A.length") );
+
+test();
- // length of array is 0
- testcases[testcases.length] = new TestCase( SECTION,
- "var A = new Array(); A.reverse(); A.length",
- 0,
- eval("var A = new Array(); A.reverse(); A.length") );
- return ( testcases );
-}
function CheckItems( R, A ) {
- for ( var i = 0; i < R.length; i++ ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "A["+i+ "]",
- R[i],
- A[i] );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( var i = 0; i < R.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "]",
+ R[i],
+ A[i] );
+ }
}
+test();
+
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = eval(this.array[i]);
- }
- this.join = Array.prototype.reverse;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.join = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
}
function Reverse( array ) {
- var r2 = array.length;
- var k = 0;
- var r3 = Math.floor( r2/2 );
- if ( r3 == k ) {
- return array;
- }
-
- for ( k = 0; k < r3; k++ ) {
- var r6 = r2 - k - 1;
-// var r7 = String( k );
- var r7 = k;
- var r8 = String( r6 );
-
- var r9 = array[r7];
- var r10 = array[r8];
-
- array[r7] = r10;
- array[r8] = r9;
- }
-
+ var r2 = array.length;
+ var k = 0;
+ var r3 = Math.floor( r2/2 );
+ if ( r3 == k ) {
return array;
+ }
+
+ for ( k = 0; k < r3; k++ ) {
+ var r6 = r2 - k - 1;
+// var r7 = String( k );
+ var r7 = k;
+ var r8 = String( r6 );
+
+ var r9 = array[r7];
+ var r10 = array[r8];
+
+ array[r7] = r10;
+ array[r8] = r9;
+ }
+
+ return array;
}
function Iterate( array ) {
- for ( var i = 0; i < array.length; i++ ) {
+ for ( var i = 0; i < array.length; i++ ) {
// print( i+": "+ array[String(i)] );
- }
+ }
}
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = this.array[i];
- }
- this.reverse = Array.prototype.reverse;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = this.array[i];
+ }
+ this.reverse = Array.prototype.reverse;
+ this.getClass = Object.prototype.toString;
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.5-1.js b/mozilla/js/tests/ecma/Array/15.4.4.5-1.js
index d117f1510d0..cf082b3cb63 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.5-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,205 +35,187 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.5.js
- ECMA Section: Array.prototype.sort(comparefn)
- Description:
+ File Name: 15.4.4.5.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
- This test file tests cases in which the compare function is not supplied.
+ This test file tests cases in which the compare function is not supplied.
- The elements of this array are sorted. The sort is not necessarily stable.
- If comparefn is provided, it should be a function that accepts two arguments
- x and y and returns a negative value if x < y, zero if x = y, or a positive
- value if x > y.
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
1. Call the [[Get]] method of this object with argument "length".
2. Call ToUint32(Result(1)).
- 1. Perform an implementation-dependent sequence of calls to the
- [[Get]] , [[Put]], and [[Delete]] methods of this object and
- toSortCompare (described below), where the first argument for each call
- to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
- than Result(2) and where the arguments for calls to SortCompare are
- results of previous calls to the [[Get]] method. After this sequence
- is complete, this object must have the following two properties.
- (1) There must be some mathematical permutation of the nonnegative
- integers less than Result(2), such that for every nonnegative integer
- j less than Result(2), if property old[j] existed, then new[(j)] is
- exactly the same value as old[j],. but if property old[j] did not exist,
- then new[(j)] either does not exist or exists with value undefined.
- (2) If comparefn is not supplied or is a consistent comparison
- function for the elements of this array, then for all nonnegative
- integers j and k, each less than Result(2), if old[j] compares less
- than old[k] (see SortCompare below), then (j) < (k). Here we use the
- notation old[j] to refer to the hypothetical result of calling the [
- [Get]] method of this object with argument j before this step is
- executed, and the notation new[j] to refer to the hypothetical result
- of calling the [[Get]] method of this object with argument j after this
- step has been completely executed. A function is a consistent
- comparison function for a set of values if (a) for any two of those
- values (possibly the same value) considered as an ordered pair, it
- always returns the same value when given that pair of values as its
- two arguments, and the result of applying ToNumber to this value is
- not NaN; (b) when considered as a relation, where the pair (x, y) is
- considered to be in the relation if and only if applying the function
- to x and y and then applying ToNumber to the result produces a
- negative value, this relation is a partial order; and (c) when
- considered as a different relation, where the pair (x, y) is considered
- to be in the relation if and only if applying the function to x and y
- and then applying ToNumber to the result produces a zero value (of either
- sign), this relation is an equivalence relation. In this context, the
- phrase "x compares less than y" means applying Result(2) to x and y and
- then applying ToNumber to the result produces a negative value.
- 3.Return this object.
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
- When the SortCompare operator is called with two arguments x and y, the following steps are taken:
- 1.If x and y are both undefined, return +0.
- 2.If x is undefined, return 1.
- 3.If y is undefined, return 1.
- 4.If the argument comparefn was not provided in the call to sort, go to step 7.
- 5.Call comparefn with arguments x and y.
- 6.Return Result(5).
- 7.Call ToString(x).
- 8.Call ToString(y).
- 9.If Result(7) < Result(8), return 1.
- 10.If Result(7) > Result(8), return 1.
- 11.Return +0.
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
-Note that, because undefined always compared greater than any other value, undefined and nonexistent
-property values always sort to the end of the result. It is implementation-dependent whether or not such
-properties will exist or not at the end of the array when the sort is concluded.
+ Note that, because undefined always compared greater than any other value, undefined and nonexistent
+ property values always sort to the end of the result. It is implementation-dependent whether or not such
+ properties will exist or not at the end of the array when the sort is concluded.
-Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
-Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
-applied successfully to a host object is implementation dependent .
+ Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+ Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+ applied successfully to a host object is implementation dependent .
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.4.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype.sort(comparefn)";
+var SECTION = "15.4.4.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+var S = new Array();
+var item = 0;
- var testcases = new Array();
- getTestCases();
- test();
+// array is empty.
+S[item++] = "var A = new Array()";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// array contains one item
+S[item++] = "var A = new Array( true )";
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+// length of array is 2
+S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+S[item] = "var A = new Array( ";
+
+var limit = 0x0061;
+for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
}
-function getTestCases() {
- var S = new Array();
- var item = 0;
- // array is empty.
- S[item++] = "var A = new Array()";
+S[item] += ")";
- // array contains one item
- S[item++] = "var A = new Array( true )";
+item++;
- // length of array is 2
- S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
-
- S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
-
- S[item] = "var A = new Array( ";
-
- var limit = 0x0061;
- for ( var i = 0x007A; i >= limit; i-- ) {
- S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
- if ( i > limit ) {
- S[item] += ",";
- }
- }
-
- S[item] += ")";
-
- item++;
-
- for ( var i = 0; i < S.length; i++ ) {
- CheckItems( S[i] );
- }
+for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
}
+
function CheckItems( S ) {
- eval( S );
- var E = Sort( A );
+ eval( S );
+ var E = Sort( A );
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.sort(); A.length",
- E.length,
- eval( S + "; A.sort(); A.length") );
+ new TestCase( SECTION,
+ S +"; A.sort(); A.length",
+ E.length,
+ eval( S + "; A.sort(); A.length") );
- for ( var i = 0; i < E.length; i++ ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "A["+i+ "].toString()",
- E[i] +"",
- A[i] +"");
+ for ( var i = 0; i < E.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
- if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "typeof A["+i+ "]",
- typeof E[i],
- typeof A[i] );
- }
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
}
+ }
}
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = eval(this.array[i]);
- }
- this.sort = Array.prototype.sort;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
}
function Sort( a ) {
- for ( i = 0; i < a.length; i++ ) {
- for ( j = i+1; j < a.length; j++ ) {
- var lo = a[i];
- var hi = a[j];
- var c = Compare( lo, hi );
- if ( c == 1 ) {
- a[i] = hi;
- a[j] = lo;
- }
- }
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
}
- return a;
+ }
+ return a;
}
function Compare( x, y ) {
- if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
- return +0;
- }
- if ( x == void 0 && typeof x == "undefined" ) {
- return 1;
- }
- if ( y == void 0 && typeof y == "undefined" ) {
- return -1;
- }
- x = String(x);
- y = String(y);
- if ( x < y ) {
- return -1;
- }
- if ( x > y ) {
- return 1;
- }
- return 0;
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return -1;
+ }
+ if ( x > y ) {
+ return 1;
+ }
+ return 0;
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.5-2.js b/mozilla/js/tests/ecma/Array/15.4.4.5-2.js
index a406a6f05be..1b8facc03a1 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.5-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,206 +35,191 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.5-2.js
- ECMA Section: Array.prototype.sort(comparefn)
- Description:
+ File Name: 15.4.4.5-2.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
- This test file tests cases in which the compare function is supplied.
- In this cases, the sort creates a reverse sort.
+ This test file tests cases in which the compare function is supplied.
+ In this cases, the sort creates a reverse sort.
- The elements of this array are sorted. The sort is not necessarily stable.
- If comparefn is provided, it should be a function that accepts two arguments
- x and y and returns a negative value if x < y, zero if x = y, or a positive
- value if x > y.
+ The elements of this array are sorted. The sort is not necessarily stable.
+ If comparefn is provided, it should be a function that accepts two arguments
+ x and y and returns a negative value if x < y, zero if x = y, or a positive
+ value if x > y.
1. Call the [[Get]] method of this object with argument "length".
2. Call ToUint32(Result(1)).
- 1. Perform an implementation-dependent sequence of calls to the
- [[Get]] , [[Put]], and [[Delete]] methods of this object and
- toSortCompare (described below), where the first argument for each call
- to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
- than Result(2) and where the arguments for calls to SortCompare are
- results of previous calls to the [[Get]] method. After this sequence
- is complete, this object must have the following two properties.
- (1) There must be some mathematical permutation of the nonnegative
- integers less than Result(2), such that for every nonnegative integer
- j less than Result(2), if property old[j] existed, then new[(j)] is
- exactly the same value as old[j],. but if property old[j] did not exist,
- then new[(j)] either does not exist or exists with value undefined.
- (2) If comparefn is not supplied or is a consistent comparison
- function for the elements of this array, then for all nonnegative
- integers j and k, each less than Result(2), if old[j] compares less
- than old[k] (see SortCompare below), then (j) < (k). Here we use the
- notation old[j] to refer to the hypothetical result of calling the [
- [Get]] method of this object with argument j before this step is
- executed, and the notation new[j] to refer to the hypothetical result
- of calling the [[Get]] method of this object with argument j after this
- step has been completely executed. A function is a consistent
- comparison function for a set of values if (a) for any two of those
- values (possibly the same value) considered as an ordered pair, it
- always returns the same value when given that pair of values as its
- two arguments, and the result of applying ToNumber to this value is
- not NaN; (b) when considered as a relation, where the pair (x, y) is
- considered to be in the relation if and only if applying the function
- to x and y and then applying ToNumber to the result produces a
- negative value, this relation is a partial order; and (c) when
- considered as a different relation, where the pair (x, y) is considered
- to be in the relation if and only if applying the function to x and y
- and then applying ToNumber to the result produces a zero value (of either
- sign), this relation is an equivalence relation. In this context, the
- phrase "x compares less than y" means applying Result(2) to x and y and
- then applying ToNumber to the result produces a negative value.
- 3.Return this object.
+ 1. Perform an implementation-dependent sequence of calls to the
+ [[Get]] , [[Put]], and [[Delete]] methods of this object and
+ toSortCompare (described below), where the first argument for each call
+ to [[Get]], [[Put]] , or [[Delete]] is a nonnegative integer less
+ than Result(2) and where the arguments for calls to SortCompare are
+ results of previous calls to the [[Get]] method. After this sequence
+ is complete, this object must have the following two properties.
+ (1) There must be some mathematical permutation of the nonnegative
+ integers less than Result(2), such that for every nonnegative integer
+ j less than Result(2), if property old[j] existed, then new[(j)] is
+ exactly the same value as old[j],. but if property old[j] did not exist,
+ then new[(j)] either does not exist or exists with value undefined.
+ (2) If comparefn is not supplied or is a consistent comparison
+ function for the elements of this array, then for all nonnegative
+ integers j and k, each less than Result(2), if old[j] compares less
+ than old[k] (see SortCompare below), then (j) < (k). Here we use the
+ notation old[j] to refer to the hypothetical result of calling the [
+ [Get]] method of this object with argument j before this step is
+ executed, and the notation new[j] to refer to the hypothetical result
+ of calling the [[Get]] method of this object with argument j after this
+ step has been completely executed. A function is a consistent
+ comparison function for a set of values if (a) for any two of those
+ values (possibly the same value) considered as an ordered pair, it
+ always returns the same value when given that pair of values as its
+ two arguments, and the result of applying ToNumber to this value is
+ not NaN; (b) when considered as a relation, where the pair (x, y) is
+ considered to be in the relation if and only if applying the function
+ to x and y and then applying ToNumber to the result produces a
+ negative value, this relation is a partial order; and (c) when
+ considered as a different relation, where the pair (x, y) is considered
+ to be in the relation if and only if applying the function to x and y
+ and then applying ToNumber to the result produces a zero value (of either
+ sign), this relation is an equivalence relation. In this context, the
+ phrase "x compares less than y" means applying Result(2) to x and y and
+ then applying ToNumber to the result produces a negative value.
+ 3.Return this object.
- When the SortCompare operator is called with two arguments x and y, the following steps are taken:
- 1.If x and y are both undefined, return +0.
- 2.If x is undefined, return 1.
- 3.If y is undefined, return 1.
- 4.If the argument comparefn was not provided in the call to sort, go to step 7.
- 5.Call comparefn with arguments x and y.
- 6.Return Result(5).
- 7.Call ToString(x).
- 8.Call ToString(y).
- 9.If Result(7) < Result(8), return 1.
- 10.If Result(7) > Result(8), return 1.
- 11.Return +0.
+ When the SortCompare operator is called with two arguments x and y, the following steps are taken:
+ 1.If x and y are both undefined, return +0.
+ 2.If x is undefined, return 1.
+ 3.If y is undefined, return 1.
+ 4.If the argument comparefn was not provided in the call to sort, go to step 7.
+ 5.Call comparefn with arguments x and y.
+ 6.Return Result(5).
+ 7.Call ToString(x).
+ 8.Call ToString(y).
+ 9.If Result(7) < Result(8), return 1.
+ 10.If Result(7) > Result(8), return 1.
+ 11.Return +0.
-Note that, because undefined always compared greater than any other value, undefined and nonexistent
-property values always sort to the end of the result. It is implementation-dependent whether or not such
-properties will exist or not at the end of the array when the sort is concluded.
+ Note that, because undefined always compared greater than any other value, undefined and nonexistent
+ property values always sort to the end of the result. It is implementation-dependent whether or not such
+ properties will exist or not at the end of the array when the sort is concluded.
-Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
-Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
-applied successfully to a host object is implementation dependent .
+ Note that the sort function is intentionally generic; it does not require that its this value be an Array object.
+ Therefore it can be transferred to other kinds of objects for use as a method. Whether the sort function can be
+ applied successfully to a host object is implementation dependent .
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.4.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype.sort(comparefn)";
+var SECTION = "15.4.4.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+var S = new Array();
+var item = 0;
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+// array is empty.
+S[item++] = "var A = new Array()";
+
+// array contains one item
+S[item++] = "var A = new Array( true )";
+
+// length of array is 2
+S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
+
+S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
+
+S[item] = "var A = new Array( ";
+
+var limit = 0x0061;
+for ( var i = 0x007A; i >= limit; i-- ) {
+ S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
+ if ( i > limit ) {
+ S[item] += ",";
+ }
}
-function getTestCases() {
- var S = new Array();
- var item = 0;
- // array is empty.
- S[item++] = "var A = new Array()";
-
- // array contains one item
- S[item++] = "var A = new Array( true )";
-
- // length of array is 2
- S[item++] = "var A = new Array( true, false, new Boolean(true), new Boolean(false), 'true', 'false' )";
-
- S[item++] = "var A = new Array(); A[3] = 'undefined'; A[6] = null; A[8] = 'null'; A[0] = void 0";
-
- S[item] = "var A = new Array( ";
-
- var limit = 0x0061;
- for ( var i = 0x007A; i >= limit; i-- ) {
- S[item] += "\'"+ String.fromCharCode(i) +"\'" ;
- if ( i > limit ) {
- S[item] += ",";
- }
- }
-
- S[item] += ")";
-
- for ( var i = 0; i < S.length; i++ ) {
- CheckItems( S[i] );
- }
+S[item] += ")";
+for ( var i = 0; i < S.length; i++ ) {
+ CheckItems( S[i] );
}
+
+test();
+
function CheckItems( S ) {
- eval( S );
- var E = Sort( A );
+ eval( S );
+ var E = Sort( A );
- testcases[testcases.length] = new TestCase( SECTION,
- S +"; A.sort(Compare); A.length",
- E.length,
- eval( S + "; A.sort(Compare); A.length") );
+ new TestCase( SECTION,
+ S +"; A.sort(Compare); A.length",
+ E.length,
+ eval( S + "; A.sort(Compare); A.length") );
- for ( var i = 0; i < E.length; i++ ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "A["+i+ "].toString()",
- E[i] +"",
- A[i] +"");
+ for ( var i = 0; i < E.length; i++ ) {
+ new TestCase(
+ SECTION,
+ "A["+i+ "].toString()",
+ E[i] +"",
+ A[i] +"");
- if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
- testcases[testcases.length] = new TestCase(
- SECTION,
- "typeof A["+i+ "]",
- typeof E[i],
- typeof A[i] );
- }
+ if ( A[i] == void 0 && typeof A[i] == "undefined" ) {
+ new TestCase(
+ SECTION,
+ "typeof A["+i+ "]",
+ typeof E[i],
+ typeof A[i] );
}
+ }
}
function Object_1( value ) {
- this.array = value.split(",");
- this.length = this.array.length;
- for ( var i = 0; i < this.length; i++ ) {
- this[i] = eval(this.array[i]);
- }
- this.sort = Array.prototype.sort;
- this.getClass = Object.prototype.toString;
+ this.array = value.split(",");
+ this.length = this.array.length;
+ for ( var i = 0; i < this.length; i++ ) {
+ this[i] = eval(this.array[i]);
+ }
+ this.sort = Array.prototype.sort;
+ this.getClass = Object.prototype.toString;
}
function Sort( a ) {
- var r1 = a.length;
- for ( i = 0; i < a.length; i++ ) {
- for ( j = i+1; j < a.length; j++ ) {
- var lo = a[i];
- var hi = a[j];
- var c = Compare( lo, hi );
- if ( c == 1 ) {
- a[i] = hi;
- a[j] = lo;
- }
- }
+ var r1 = a.length;
+ for ( i = 0; i < a.length; i++ ) {
+ for ( j = i+1; j < a.length; j++ ) {
+ var lo = a[i];
+ var hi = a[j];
+ var c = Compare( lo, hi );
+ if ( c == 1 ) {
+ a[i] = hi;
+ a[j] = lo;
+ }
}
- return a;
+ }
+ return a;
}
function Compare( x, y ) {
- if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
- return +0;
- }
- if ( x == void 0 && typeof x == "undefined" ) {
- return 1;
- }
- if ( y == void 0 && typeof y == "undefined" ) {
- return -1;
- }
- x = String(x);
- y = String(y);
- if ( x < y ) {
- return 1;
- }
- if ( x > y ) {
- return -1;
- }
- return 0;
+ if ( x == void 0 && y == void 0 && typeof x == "undefined" && typeof y == "undefined" ) {
+ return +0;
+ }
+ if ( x == void 0 && typeof x == "undefined" ) {
+ return 1;
+ }
+ if ( y == void 0 && typeof y == "undefined" ) {
+ return -1;
+ }
+ x = String(x);
+ y = String(y);
+ if ( x < y ) {
+ return 1;
+ }
+ if ( x > y ) {
+ return -1;
+ }
+ return 0;
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.5-3.js b/mozilla/js/tests/ecma/Array/15.4.4.5-3.js
index aedb9d597a3..7b98fa112b1 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.5-3.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.5-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,163 +35,146 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.5-3.js
- ECMA Section: Array.prototype.sort(comparefn)
- Description:
+ File Name: 15.4.4.5-3.js
+ ECMA Section: Array.prototype.sort(comparefn)
+ Description:
- This is a regression test for
- http://scopus/bugsplat/show_bug.cgi?id=117144
+ This is a regression test for
+ http://scopus/bugsplat/show_bug.cgi?id=117144
- Verify that sort is successfull, even if the sort compare function returns
- a very large negative or positive value.
+ Verify that sort is successfull, even if the sort compare function returns
+ a very large negative or positive value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.4.5-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.prototype.sort(comparefn)";
+var SECTION = "15.4.4.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.prototype.sort(comparefn)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- getTestCases();
- test();
+var array = new Array();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+array[array.length] = new Date( TIME_2000 * Math.PI );
+array[array.length] = new Date( TIME_2000 * 10 );
+array[array.length] = new Date( TIME_1900 + TIME_1900 );
+array[array.length] = new Date(0);
+array[array.length] = new Date( TIME_2000 );
+array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 );
+array[array.length] = new Date( TIME_1900 * Math.PI );
+array[array.length] = new Date( TIME_1900 * 10 );
+array[array.length] = new Date( TIME_1900 );
+array[array.length] = new Date( TIME_2000 + TIME_2000 );
+array[array.length] = new Date( 1899, 0, 1 );
+array[array.length] = new Date( 2000, 1, 29 );
+array[array.length] = new Date( 2000, 0, 1 );
+array[array.length] = new Date( 1999, 11, 31 );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+var testarr1 = new Array();
+clone( array, testarr1 );
+testarr1.sort( comparefn1 );
+
+var testarr2 = new Array();
+clone( array, testarr2 );
+testarr2.sort( comparefn2 );
+
+testarr3 = new Array();
+clone( array, testarr3 );
+testarr3.sort( comparefn3 );
+
+// when there's no sort function, sort sorts by the toString value of Date.
+
+var testarr4 = new Array();
+clone( array, testarr4 );
+testarr4.sort();
+
+var realarr = new Array();
+clone( array, realarr );
+realarr.sort( realsort );
+
+var stringarr = new Array();
+clone( array, stringarr );
+stringarr.sort( stringsort );
+
+for ( var i = 0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr1["+i+"]",
+ realarr[i],
+ testarr1[i] );
}
-function getTestCases() {
- var array = new Array();
-
- array[array.length] = new Date( TIME_2000 * Math.PI );
- array[array.length] = new Date( TIME_2000 * 10 );
- array[array.length] = new Date( TIME_1900 + TIME_1900 );
- array[array.length] = new Date(0);
- array[array.length] = new Date( TIME_2000 );
- array[array.length] = new Date( TIME_1900 + TIME_1900 +TIME_1900 );
- array[array.length] = new Date( TIME_1900 * Math.PI );
- array[array.length] = new Date( TIME_1900 * 10 );
- array[array.length] = new Date( TIME_1900 );
- array[array.length] = new Date( TIME_2000 + TIME_2000 );
- array[array.length] = new Date( 1899, 0, 1 );
- array[array.length] = new Date( 2000, 1, 29 );
- array[array.length] = new Date( 2000, 0, 1 );
- array[array.length] = new Date( 1999, 11, 31 );
-
- var testarr1 = new Array()
- clone( array, testarr1 );
- testarr1.sort( comparefn1 );
-
- var testarr2 = new Array()
- clone( array, testarr2 );
- testarr2.sort( comparefn2 );
-
- testarr3 = new Array();
- clone( array, testarr3 );
- testarr3.sort( comparefn3 );
-
- // when there's no sort function, sort sorts by the toString value of Date.
-
- var testarr4 = new Array()
- clone( array, testarr4 );
- testarr4.sort();
-
- var realarr = new Array();
- clone( array, realarr );
- realarr.sort( realsort );
-
- var stringarr = new Array();
- clone( array, stringarr );
- stringarr.sort( stringsort );
-
- for ( var i = 0, tc = 0; i < array.length; i++, tc++) {
- testcases[tc] = new TestCase(
- SECTION,
- "testarr1["+i+"]",
- realarr[i],
- testarr1[i] );
- }
-
- for ( var i=0; i < array.length; i++, tc++) {
- testcases[tc] = new TestCase(
- SECTION,
- "testarr2["+i+"]",
- realarr[i],
- testarr2[i] );
- }
-
- for ( var i=0; i < array.length; i++, tc++) {
- testcases[tc] = new TestCase(
- SECTION,
- "testarr3["+i+"]",
- realarr[i],
- testarr3[i] );
- }
-
- for ( var i=0; i < array.length; i++, tc++) {
- testcases[tc] = new TestCase(
- SECTION,
- "testarr4["+i+"]",
- stringarr[i].toString(),
- testarr4[i].toString() );
- }
-
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr2["+i+"]",
+ realarr[i],
+ testarr2[i] );
}
+
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr3["+i+"]",
+ realarr[i],
+ testarr3[i] );
+}
+
+for ( var i=0; i < array.length; i++) {
+ new TestCase(
+ SECTION,
+ "testarr4["+i+"]",
+ stringarr[i].toString(),
+ testarr4[i].toString() );
+}
+
+test();
+
function comparefn1( x, y ) {
- return x - y;
+ return x - y;
}
function comparefn2( x, y ) {
- return x.valueOf() - y.valueOf();
+ return x.valueOf() - y.valueOf();
}
function realsort( x, y ) {
- return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) );
+ return ( x.valueOf() == y.valueOf() ? 0 : ( x.valueOf() > y.valueOf() ? 1 : -1 ) );
}
function comparefn3( x, y ) {
- return ( x == y ? 0 : ( x > y ? 1: -1 ) );
+ return ( x == y ? 0 : ( x > y ? 1: -1 ) );
}
function clone( source, target ) {
- for (i = 0; i < source.length; i++ ) {
- target[i] = source[i];
- }
+ for (i = 0; i < source.length; i++ ) {
+ target[i] = source[i];
+ }
}
function stringsort( x, y ) {
- for ( var i = 0; i < x.toString().length; i++ ) {
- var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i);
- if ( d > 0 ) {
- return 1;
- } else {
- if ( d < 0 ) {
- return -1;
- } else {
- continue;
- }
- }
+ for ( var i = 0; i < x.toString().length; i++ ) {
+ var d = (x.toString()).charCodeAt(i) - (y.toString()).charCodeAt(i);
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ } else {
+ continue;
+ }
+ }
- var d = x.length - y.length;
+ var d = x.length - y.length;
- if ( d > 0 ) {
- return 1;
- } else {
- if ( d < 0 ) {
- return -1;
- }
- }
- }
- return 0;
-}
\ No newline at end of file
+ if ( d > 0 ) {
+ return 1;
+ } else {
+ if ( d < 0 ) {
+ return -1;
+ }
+ }
+ }
+ return 0;
+}
diff --git a/mozilla/js/tests/ecma/Array/15.4.4.js b/mozilla/js/tests/ecma/Array/15.4.4.js
index eb1b96d1e2e..6d930dfcf5f 100644
--- a/mozilla/js/tests/ecma/Array/15.4.4.js
+++ b/mozilla/js/tests/ecma/Array/15.4.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,59 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.4.js
- ECMA Section: 15.4.4 Properties of the Array Prototype Object
- Description: The value of the internal [[Prototype]] property of
- the Array prototype object is the Object prototype
- object.
+ File Name: 15.4.4.js
+ ECMA Section: 15.4.4 Properties of the Array Prototype Object
+ Description: The value of the internal [[Prototype]] property of
+ the Array prototype object is the Object prototype
+ object.
- Note that the Array prototype object is itself an
- array; it has a length property (whose initial value
- is (0) and the special [[Put]] method.
+ Note that the Array prototype object is itself an
+ array; it has a length property (whose initial value
+ is (0) and the special [[Put]] method.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.4.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Array Prototype Object";
+var SECTION = "15.4.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Array Prototype Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
-// these testcases are ECMA_2
-// array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
-// array[item++] = new TestCase( SECTION, "Array.__proto__.valueOf == Object.__proto__.valueOf", true, (Array.__proto__.valueOf == Object.__proto__.valueOf) );
-
- array[item++] = new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length );
+new TestCase( SECTION, "Array.prototype.length", 0, Array.prototype.length );
// verify that prototype object is an Array object.
- array[item++] = new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype );
+new TestCase( SECTION, "typeof Array.prototype", "object", typeof Array.prototype );
- array[item++] = new TestCase( SECTION,
- "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()",
- "[object Array]",
- eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") );
+new TestCase( SECTION,
+ "Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()",
+ "[object Array]",
+ eval("Array.prototype.toString = Object.prototype.toString; Array.prototype.toString()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.5.1-1.js b/mozilla/js/tests/ecma/Array/15.4.5.1-1.js
index 11f129054fa..8ead61349e4 100644
--- a/mozilla/js/tests/ecma/Array/15.4.5.1-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.5.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,154 +35,134 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.5.1-1.js
- ECMA Section: [[ Put]] (P, V)
- Description:
- Array objects use a variation of the [[Put]] method used for other native
- ECMAScript objects (section 8.6.2.2).
+ File Name: 15.4.5.1-1.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
- Assume A is an Array object and P is a string.
+ Assume A is an Array object and P is a string.
- When the [[Put]] method of A is called with property P and value V, the
- following steps are taken:
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
- 1. Call the [[CanPut]] method of A with name P.
- 2. If Result(1) is false, return.
- 3. If A doesn't have a property with name P, go to step 7.
- 4. If P is "length", go to step 12.
- 5. Set the value of property P of A to V.
- 6. Go to step 8.
- 7. Create a property with name P, set its value to V and give it empty
- attributes.
- 8. If P is not an array index, return.
- 9. If A itself has a property (not an inherited property) named "length",
- andToUint32(P) is less than the value of the length property of A, then
- return.
- 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
- 11. Return.
- 12. Compute ToUint32(V).
- 13. For every integer k that is less than the value of the length property
- of A but not less than Result(12), if A itself has a property (not an
- inherited property) named ToString(k), then delete that property.
- 14. Set the value of property P of A to Result(12).
- 15. Return.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.5.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array [[Put]] (P, V)";
+var SECTION = "15.4.5.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array [[Put]] (P, V)";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
-
- var item = 0;
-
- // P is "length"
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length = 1000; A.length",
- 1000,
- eval("var A = new Array(); A.length = 1000; A.length") );
-
- // A has Property P, and P is not length or an array index
- array[item++] = new TestCase( SECTION,
- "var A = new Array(1000); A.name = 'name of this array'; A.name",
- 'name of this array',
- eval("var A = new Array(1000); A.name = 'name of this array'; A.name") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(1000); A.name = 'name of this array'; A.length",
- 1000,
- eval("var A = new Array(1000); A.name = 'name of this array'; A.length") );
+writeHeaderToLog( SECTION + " "+ TITLE);
- // A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the
- // value of length
+// P is "length"
- array[item++] = new TestCase( SECTION,
- "var A = new Array(1000); A[123] = 'hola'; A[123]",
- 'hola',
- eval("var A = new Array(1000); A[123] = 'hola'; A[123]") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 1000; A.length",
+ 1000,
+ eval("var A = new Array(); A.length = 1000; A.length") );
- array[item++] = new TestCase( SECTION,
- "var A = new Array(1000); A[123] = 'hola'; A.length",
- 1000,
- eval("var A = new Array(1000); A[123] = 'hola'; A.length") );
+// A has Property P, and P is not length or an array index
+new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.name",
+ 'name of this array',
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.name") );
+
+new TestCase( SECTION,
+ "var A = new Array(1000); A.name = 'name of this array'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A.name = 'name of this array'; A.length") );
- for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) {
- TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'";
- if ( i < 0x00FF - 1 ) {
- TEST_STRING += ",";
- } else {
- TEST_STRING += ");"
- }
- }
+// A has Property P, P is not length, P is an array index, and ToUint32(p) is less than the
+// value of length
- var LENGTH = 0x00ff - 0x0020;
+new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A[123]",
+ 'hola',
+ eval("var A = new Array(1000); A[123] = 'hola'; A[123]") );
- array[item++] = new TestCase( SECTION,
- TEST_STRING +" A[150] = 'hello'; A[150]",
- 'hello',
- eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) );
+new TestCase( SECTION,
+ "var A = new Array(1000); A[123] = 'hola'; A.length",
+ 1000,
+ eval("var A = new Array(1000); A[123] = 'hola'; A.length") );
- array[item++] = new TestCase( SECTION,
- TEST_STRING +" A[150] = 'hello'; A[150]",
- LENGTH,
- eval( TEST_STRING + " A[150] = 'hello'; A.length" ) );
- // A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the
- // value of length
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A[123] = true; A.length",
- 124,
- eval("var A = new Array(); A[123] = true; A.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length",
- 16,
- eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") );
-
- for ( var i = 0; i < A.length; i++, item++ ) {
- array[item] = new TestCase( SECTION,
- "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]",
- (i <= 10) ? i : ( i == 15 ? '15' : void 0 ),
- A[i] );
- }
- // P is not an array index, and P is not "length"
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.join.length = 4; A.join.length",
- 1,
- eval("var A = new Array(); A.join.length = 4; A.join.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.join.length = 4; A.length",
- 0,
- eval("var A = new Array(); A.join.length = 4; A.length") );
-
- return array;
+for ( var i = 0X0020, TEST_STRING = "var A = new Array( " ; i < 0x00ff; i++ ) {
+ TEST_STRING += "\'\\"+ String.fromCharCode( i ) +"\'";
+ if ( i < 0x00FF - 1 ) {
+ TEST_STRING += ",";
+ } else {
+ TEST_STRING += ");"
+ }
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+var LENGTH = 0x00ff - 0x0020;
+
+new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ 'hello',
+ eval( TEST_STRING + " A[150] = 'hello'; A[150]" ) );
+
+new TestCase( SECTION,
+ TEST_STRING +" A[150] = 'hello'; A[150]",
+ LENGTH,
+ eval( TEST_STRING + " A[150] = 'hello'; A.length" ) );
+
+// A has Property P, P is not length, P is an array index, and ToUint32(p) is not less than the
+// value of length
+
+new TestCase( SECTION,
+ "var A = new Array(); A[123] = true; A.length",
+ 124,
+ eval("var A = new Array(); A[123] = true; A.length") );
+
+new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length",
+ 16,
+ eval("var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A.length") );
+
+for ( var i = 0; i < A.length; i++ ) {
+ new TestCase( SECTION,
+ "var A = new Array(0,1,2,3,4,5,6,7,8,9,10); A[15] ='15'; A[" +i +"]",
+ (i <= 10) ? i : ( i == 15 ? '15' : void 0 ),
+ A[i] );
}
+// P is not an array index, and P is not "length"
+
+new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.join.length",
+ 1,
+ eval("var A = new Array(); A.join.length = 4; A.join.length") );
+
+new TestCase( SECTION,
+ "var A = new Array(); A.join.length = 4; A.length",
+ 0,
+ eval("var A = new Array(); A.join.length = 4; A.length") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Array/15.4.5.1-2.js b/mozilla/js/tests/ecma/Array/15.4.5.1-2.js
index 20b355e309c..c35a69e07b4 100644
--- a/mozilla/js/tests/ecma/Array/15.4.5.1-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.5.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,132 +35,116 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.5.1-2.js
- ECMA Section: [[ Put]] (P, V)
- Description:
- Array objects use a variation of the [[Put]] method used for other native
- ECMAScript objects (section 8.6.2.2).
+ File Name: 15.4.5.1-2.js
+ ECMA Section: [[ Put]] (P, V)
+ Description:
+ Array objects use a variation of the [[Put]] method used for other native
+ ECMAScript objects (section 8.6.2.2).
- Assume A is an Array object and P is a string.
+ Assume A is an Array object and P is a string.
- When the [[Put]] method of A is called with property P and value V, the
- following steps are taken:
+ When the [[Put]] method of A is called with property P and value V, the
+ following steps are taken:
- 1. Call the [[CanPut]] method of A with name P.
- 2. If Result(1) is false, return.
- 3. If A doesn't have a property with name P, go to step 7.
- 4. If P is "length", go to step 12.
- 5. Set the value of property P of A to V.
- 6. Go to step 8.
- 7. Create a property with name P, set its value to V and give it empty
- attributes.
- 8. If P is not an array index, return.
- 9. If A itself has a property (not an inherited property) named "length",
- andToUint32(P) is less than the value of the length property of A, then
- return.
- 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
- 11. Return.
- 12. Compute ToUint32(V).
- 13. For every integer k that is less than the value of the length property
- of A but not less than Result(12), if A itself has a property (not an
- inherited property) named ToString(k), then delete that property.
- 14. Set the value of property P of A to Result(12).
- 15. Return.
+ 1. Call the [[CanPut]] method of A with name P.
+ 2. If Result(1) is false, return.
+ 3. If A doesn't have a property with name P, go to step 7.
+ 4. If P is "length", go to step 12.
+ 5. Set the value of property P of A to V.
+ 6. Go to step 8.
+ 7. Create a property with name P, set its value to V and give it empty
+ attributes.
+ 8. If P is not an array index, return.
+ 9. If A itself has a property (not an inherited property) named "length",
+ andToUint32(P) is less than the value of the length property of A, then
+ return.
+ 10. Change (or set) the value of the length property of A to ToUint32(P)+1.
+ 11. Return.
+ 12. Compute ToUint32(V).
+ 13. For every integer k that is less than the value of the length property
+ of A but not less than Result(12), if A itself has a property (not an
+ inherited property) named ToString(k), then delete that property.
+ 14. Set the value of property P of A to Result(12).
+ 15. Return.
- These are testcases from Waldemar, detailed in
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552
+ These are testcases from Waldemar, detailed in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123552
- Author: christine@netscape.com
- Date: 15 June 1998
+ Author: christine@netscape.com
+ Date: 15 June 1998
*/
- var SECTION = "15.4.5.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array [[Put]] (P,V)";
+var SECTION = "15.4.5.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array [[Put]] (P,V)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var a = new Array();
- var a = new Array();
+AddCase( "3.00", "three" );
+AddCase( "00010", "eight" );
+AddCase( "37xyz", "thirty-five" );
+AddCase("5000000000", 5)
+ AddCase( "-2", -3 );
- AddCase( "3.00", "three" );
- AddCase( "00010", "eight" );
- AddCase( "37xyz", "thirty-five" );
- AddCase("5000000000", 5)
- AddCase( "-2", -3 );
+new TestCase( SECTION,
+ "a[10]",
+ void 0,
+ a[10] );
- testcases[tc++] = new TestCase( SECTION,
- "a[10]",
- void 0,
- a[10] );
+new TestCase( SECTION,
+ "a[3]",
+ void 0,
+ a[3] );
- testcases[tc++] = new TestCase( SECTION,
- "a[3]",
- void 0,
- a[3] );
+a[4] = "four";
- a[4] = "four";
+new TestCase( SECTION,
+ "a[4] = \"four\"; a[4]",
+ "four",
+ a[4] );
- testcases[tc++] = new TestCase( SECTION,
- "a[4] = \"four\"; a[4]",
- "four",
- a[4] );
+new TestCase( SECTION,
+ "a[\"4\"]",
+ "four",
+ a["4"] );
- testcases[tc++] = new TestCase( SECTION,
- "a[\"4\"]",
- "four",
- a["4"] );
+new TestCase( SECTION,
+ "a[\"4.00\"]",
+ void 0,
+ a["4.00"] );
- testcases[tc++] = new TestCase( SECTION,
- "a[\"4.00\"]",
- void 0,
- a["4.00"] );
-
- testcases[tc++] = new TestCase( SECTION,
- "a.length",
- 5,
- a.length );
+new TestCase( SECTION,
+ "a.length",
+ 5,
+ a.length );
- a["5000000000"] = 5;
+a["5000000000"] = 5;
- testcases[tc++] = new TestCase( SECTION,
- "a[\"5000000000\"] = 5; a.length",
- 5,
- a.length );
+new TestCase( SECTION,
+ "a[\"5000000000\"] = 5; a.length",
+ 5,
+ a.length );
- testcases[tc++] = new TestCase( SECTION,
- "a[\"-2\"] = -3; a.length",
- 5,
- a.length );
+new TestCase( SECTION,
+ "a[\"-2\"] = -3; a.length",
+ 5,
+ a.length );
- test();
+test();
function AddCase ( arg, value ) {
- a[arg] = value;
+ a[arg] = value;
- testcases[tc++] = new TestCase( SECTION,
- "a[\"" + arg + "\"] = "+ value +"; a.length",
- 0,
- a.length );
-}
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "a[\"" + arg + "\"] = "+ value +"; a.length",
+ 0,
+ a.length );
}
diff --git a/mozilla/js/tests/ecma/Array/15.4.5.2-1.js b/mozilla/js/tests/ecma/Array/15.4.5.2-1.js
index 6e1e74f9b51..0c10ba3f459 100644
--- a/mozilla/js/tests/ecma/Array/15.4.5.2-1.js
+++ b/mozilla/js/tests/ecma/Array/15.4.5.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,75 +35,50 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.4.5.2-1.js
- ECMA Section: Array.length
- Description:
- 15.4.5.2 length
- The length property of this Array object is always numerically greater
- than the name of every property whose name is an array index.
- The length property has the attributes { DontEnum, DontDelete }.
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.4.5.2-1.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
+
+ The length property has the attributes { DontEnum, DontDelete }.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.5.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.length";
+var SECTION = "15.4.5.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var A = new Array(); A.length",
+ 0,
+ eval("var A = new Array(); A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
+ Math.pow(2,32)-1,
+ eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
+ "",
+ eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length",
+ false ,
+ eval("var A = new Array(); A.length = 123; delete A.length") );
+new TestCase( SECTION,
+ "var A = new Array(); A.length = 123; delete A.length; A.length",
+ 123,
+ eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
+test();
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length",
- 0,
- eval("var A = new Array(); A.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length",
- Math.pow(2,32)-1,
- eval("var A = new Array(); A[Math.pow(2,32)-2] = 'hi'; A.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length = 123; A.length",
- 123,
- eval("var A = new Array(); A.length = 123; A.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS",
- "",
- eval("var A = new Array(); A.length = 123; var PROPS = ''; for ( var p in A ) { PROPS += ( p == 'length' ? p : ''); } PROPS") );
-
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length = 123; delete A.length",
- false ,
- eval("var A = new Array(); A.length = 123; delete A.length") );
-
- array[item++] = new TestCase( SECTION,
- "var A = new Array(); A.length = 123; delete A.length; A.length",
- 123,
- eval("var A = new Array(); A.length = 123; delete A.length; A.length") );
- return array;
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Array/15.4.5.2-2.js b/mozilla/js/tests/ecma/Array/15.4.5.2-2.js
index 6d542b5b70c..33ece2e62b8 100644
--- a/mozilla/js/tests/ecma/Array/15.4.5.2-2.js
+++ b/mozilla/js/tests/ecma/Array/15.4.5.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,105 +35,91 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.4.5.2-2.js
- ECMA Section: Array.length
- Description:
- 15.4.5.2 length
- The length property of this Array object is always numerically greater
- than the name of every property whose name is an array index.
+ File Name: 15.4.5.2-2.js
+ ECMA Section: Array.length
+ Description:
+ 15.4.5.2 length
+ The length property of this Array object is always numerically greater
+ than the name of every property whose name is an array index.
- The length property has the attributes { DontEnum, DontDelete }.
+ The length property has the attributes { DontEnum, DontDelete }.
- This test verifies that the Array.length property is not Read Only.
+ This test verifies that the Array.length property is not Read Only.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.4.5.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Array.length";
+var SECTION = "15.4.5.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Array.length";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) );
- addCase( new Array(), 0, Math.pow(2,14), Math.pow(2,14) );
+addCase( new Array(), 0, 1, 1 );
- addCase( new Array(), 0, 1, 1 );
+addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 );
+addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) );
+addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) );
+addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) )
- addCase( new Array(Math.pow(2,12)), Math.pow(2,12), 0, 0 );
- addCase( new Array(Math.pow(2,13)), Math.pow(2,13), Math.pow(2,12), Math.pow(2,12) );
- addCase( new Array(Math.pow(2,12)), Math.pow(2,12), Math.pow(2,12), Math.pow(2,12) );
- addCase( new Array(Math.pow(2,14)), Math.pow(2,14), Math.pow(2,12), Math.pow(2,12) )
+ // some tests where array is not empty
+ // array is populated with strings
+ for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {
+ arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" );
- // some tests where array is not empty
- // array is populated with strings
- for ( var arg = "", i = 0; i < Math.pow(2,12); i++ ) {
- arg += String(i) + ( i != Math.pow(2,12)-1 ? "," : "" );
-
- }
+}
// print(i +":"+arg);
- var a = eval( "new Array("+arg+")" );
+var a = eval( "new Array("+arg+")" );
- addCase( a, i, i, i );
- addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true );
- addCase( a, Math.pow(2,12)+5, 0, 0, true );
+addCase( a, i, i, i );
+addCase( a, i, Math.pow(2,12)+i+1, Math.pow(2,12)+i+1, true );
+addCase( a, Math.pow(2,12)+5, 0, 0, true );
- test();
+test();
function addCase( object, old_len, set_len, new_len, checkitems ) {
- object.length = set_len;
+ object.length = set_len;
- testcases[testcases.length] = new TestCase( SECTION,
- "array = new Array("+ old_len+"); array.length = " + set_len +
- "; array.length",
- new_len,
- object.length );
+ new TestCase( SECTION,
+ "array = new Array("+ old_len+"); array.length = " + set_len +
+ "; array.length",
+ new_len,
+ object.length );
- if ( checkitems ) {
+ if ( checkitems ) {
// verify that items between old and newlen are all undefined
if ( new_len < old_len ) {
- var passed = true;
- for ( var i = new_len; i < old_len; i++ ) {
- if ( object[i] != void 0 ) {
- passed = false;
- }
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "verify that array items have been deleted",
- true,
- passed );
+ var passed = true;
+ for ( var i = new_len; i < old_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ new TestCase( SECTION,
+ "verify that array items have been deleted",
+ true,
+ passed );
}
if ( new_len > old_len ) {
- var passed = true;
- for ( var i = old_len; i < new_len; i++ ) {
- if ( object[i] != void 0 ) {
- passed = false;
- }
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "verify that new items are undefined",
- true,
- passed );
- }
+ var passed = true;
+ for ( var i = old_len; i < new_len; i++ ) {
+ if ( object[i] != void 0 ) {
+ passed = false;
+ }
+ }
+ new TestCase( SECTION,
+ "verify that new items are undefined",
+ true,
+ passed );
}
+ }
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Array/browser.js b/mozilla/js/tests/ecma/Array/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Array/shell.js b/mozilla/js/tests/ecma/Array/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.1.js b/mozilla/js/tests/ecma/Boolean/15.6.1.js
index 9188e4ef7b2..757331220a3 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,60 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.1.js
- ECMA Section: 15.6.1 The Boolean Function
- 15.6.1.1 Boolean( value )
- 15.6.1.2 Boolean ()
- Description: Boolean( value ) should return a Boolean value
- not a Boolean object) computed by
- Boolean.toBooleanValue( value)
+ File Name: 15.6.1.js
+ ECMA Section: 15.6.1 The Boolean Function
+ 15.6.1.1 Boolean( value )
+ 15.6.1.2 Boolean ()
+ Description: Boolean( value ) should return a Boolean value
+ not a Boolean object) computed by
+ Boolean.toBooleanValue( value)
- 15.6.1.2 Boolean() returns false
+ 15.6.1.2 Boolean() returns false
- Author: christine@netscape.com
- Date: 27 jun 1997
+ Author: christine@netscape.com
+ Date: 27 jun 1997
- Data File Fields:
- VALUE Argument passed to the Boolean function
- TYPE typeof VALUE (not used, but helpful in understanding
- the data file)
- E_RETURN Expected return value of Boolean( VALUE )
+ Data File Fields:
+ VALUE Argument passed to the Boolean function
+ TYPE typeof VALUE (not used, but helpful in understanding
+ the data file)
+ E_RETURN Expected return value of Boolean( VALUE )
*/
- var SECTION = "15.6.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
+var SECTION = "15.6.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Boolean constructor called as a function: Boolean( value ) and Boolean()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+var array = new Array();
+var item = 0;
- test();
+new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+new TestCase( SECTION, "Boolean('1')", true, Boolean("1") );
+new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") );
+new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Boolean('true')", true, Boolean("true") );
+new TestCase( SECTION, "Boolean('false')", true, Boolean("false") );
+new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
- array[item++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
- array[item++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
- array[item++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
- array[item++] = new TestCase( SECTION, "Boolean('1')", true, Boolean("1") );
- array[item++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
- array[item++] = new TestCase( SECTION, "Boolean('-1')", true, Boolean("-1") );
- array[item++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
- array[item++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
-
- array[item++] = new TestCase( SECTION, "Boolean('true')", true, Boolean("true") );
- array[item++] = new TestCase( SECTION, "Boolean('false')", true, Boolean("false") );
- array[item++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
-
- array[item++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) );
- array[item++] = new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) );
- array[item++] = new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) );
- array[item++] = new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) );
- array[item++] = new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) );
- array[item++] = new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) );
- array[item++] = new TestCase( SECTION, "Boolean()", false, Boolean() );
+new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+new TestCase( SECTION, "Boolean(void(0))", false, Boolean( void(0) ) );
+new TestCase( SECTION, "Boolean(x=0)", false, Boolean( x=0 ) );
+new TestCase( SECTION, "Boolean(x=1)", true, Boolean( x=1 ) );
+new TestCase( SECTION, "Boolean(x=false)", false, Boolean( x=false ) );
+new TestCase( SECTION, "Boolean(x=true)", true, Boolean( x=true ) );
+new TestCase( SECTION, "Boolean(x=null)", false, Boolean( x=null ) );
+new TestCase( SECTION, "Boolean()", false, Boolean() );
// array[item++] = new TestCase( SECTION, "Boolean(var someVar)", false, Boolean( someVar ) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.2.js b/mozilla/js/tests/ecma/Boolean/15.6.2.js
index cc0b1d21292..08ddac7f084 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.2.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,142 +35,125 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.2.js
- ECMA Section: 15.6.2 The Boolean Constructor
- 15.6.2.1 new Boolean( value )
- 15.6.2.2 new Boolean()
+ File Name: 15.6.2.js
+ ECMA Section: 15.6.2 The Boolean Constructor
+ 15.6.2.1 new Boolean( value )
+ 15.6.2.2 new Boolean()
- This test verifies that the Boolean constructor
- initializes a new object (typeof should return
- "object"). The prototype of the new object should
- be Boolean.prototype. The value of the object
- should be ToBoolean( value ) (a boolean value).
+ This test verifies that the Boolean constructor
+ initializes a new object (typeof should return
+ "object"). The prototype of the new object should
+ be Boolean.prototype. The value of the object
+ should be ToBoolean( value ) (a boolean value).
- Description:
- Author: christine@netscape.com
- Date: june 27, 1997
+ Description:
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()";
+var SECTION = "15.6.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "15.6.2 The Boolean Constructor; 15.6.2.1 new Boolean( value ); 15.6.2.2 new Boolean()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+var array = new Array();
+var item = 0;
- test();
+new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) );
+new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) );
+new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) );
+new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) );
+new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') );
+new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') );
+new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() );
+new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') );
+new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) );
+new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) );
+new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) );
+new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) );
+new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+new TestCase( SECTION,
+ "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
+new TestCase( "15.6.2.2",
+ "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
+ "[object Boolean]",
+ eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
+new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() );
+new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "typeof (new Boolean(1))", "object", typeof (new Boolean(1)) );
- array[item++] = new TestCase( SECTION, "(new Boolean(1)).constructor", Boolean.prototype.constructor, (new Boolean(1)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(1)).valueOf()", true, (new Boolean(1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(1)", "object", typeof new Boolean(1) );
- array[item++] = new TestCase( SECTION, "(new Boolean(0)).constructor", Boolean.prototype.constructor, (new Boolean(0)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(0)).valueOf()", false, (new Boolean(0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(0)", "object", typeof new Boolean(0) );
- array[item++] = new TestCase( SECTION, "(new Boolean(-1)).constructor", Boolean.prototype.constructor, (new Boolean(-1)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(-1);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(-1)).valueOf()", true, (new Boolean(-1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(-1)", "object", typeof new Boolean(-1) );
- array[item++] = new TestCase( SECTION, "(new Boolean('1')).constructor", Boolean.prototype.constructor, (new Boolean('1')).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean('1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean('1')).valueOf()", true, (new Boolean('1')).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean('1')", "object", typeof new Boolean('1') );
- array[item++] = new TestCase( SECTION, "(new Boolean('0')).constructor", Boolean.prototype.constructor, (new Boolean('0')).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean('0');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean('0')).valueOf()", true, (new Boolean('0')).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean('0')", "object", typeof new Boolean('0') );
- array[item++] = new TestCase( SECTION, "(new Boolean('-1')).constructor", Boolean.prototype.constructor, (new Boolean('-1')).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean('-1');TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean('-1')).valueOf()", true, (new Boolean('-1')).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean('-1')", "object", typeof new Boolean('-1') );
- array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).constructor", Boolean.prototype.constructor, (new Boolean(new Boolean(true))).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(new Boolean(true));TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(new Boolean(true))).valueOf()", true, (new Boolean(new Boolean(true))).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(new Boolean(true))", "object", typeof new Boolean(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NaN)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(Number.NaN);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.NaN)).valueOf()", false, (new Boolean(Number.NaN)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NaN)", "object", typeof new Boolean(Number.NaN) );
- array[item++] = new TestCase( SECTION, "(new Boolean(null)).constructor", Boolean.prototype.constructor, (new Boolean(null)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(null);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(null)).valueOf()", false, (new Boolean(null)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(null)", "object", typeof new Boolean(null) );
- array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).constructor", Boolean.prototype.constructor, (new Boolean(void 0)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(void 0);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(void 0)).valueOf()", false, (new Boolean(void 0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(void 0)", "object", typeof new Boolean(void 0) );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.POSITIVE_INFINITY)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(Number.POSITIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.POSITIVE_INFINITY)).valueOf()", true, (new Boolean(Number.POSITIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.POSITIVE_INFINITY)", "object", typeof new Boolean(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
- array[item++] = new TestCase( SECTION,
- "TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean(Number.NEGATIVE_INFINITY);TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).valueOf()", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof new Boolean(Number.NEGATIVE_INFINITY)", "object", typeof new Boolean(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "(new Boolean(Number.NEGATIVE_INFINITY)).constructor", Boolean.prototype.constructor, (new Boolean(Number.NEGATIVE_INFINITY)).constructor );
- array[item++] = new TestCase( "15.6.2.2",
- "TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()",
- "[object Boolean]",
- eval("TESTBOOL=new Boolean();TESTBOOL.toString=Object.prototype.toString;TESTBOOL.toString()") );
- array[item++] = new TestCase( "15.6.2.2", "(new Boolean()).valueOf()", false, (new Boolean()).valueOf() );
- array[item++] = new TestCase( "15.6.2.2", "typeof new Boolean()", "object", typeof new Boolean() );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1-1.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1-1.js
index 30cb1aece82..0edc5737853 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1-1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1-1.js
- ECMA Section: 15.6.3 Boolean.prototype
+ File Name: 15.6.3.1-1.js
+ ECMA Section: 15.6.3 Boolean.prototype
- Description: The initial value of Boolean.prototype is the built-in
- Boolean prototype object (15.6.4).
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
- The property shall have the attributes [DontEnum,
- DontDelete, ReadOnly ].
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
- This tests the DontEnum property of Boolean.prototype
+ This tests the DontEnum property of Boolean.prototype
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.3.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype";
+var SECTION = "15.6.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var array = new Array();
+var item = 0;
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var str='';for ( p in Boolean ) { str += p } str;",
- "",
- eval("var str='';for ( p in Boolean ) { str += p } str;") );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "var str='';for ( p in Boolean ) { str += p } str;",
+ "",
+ eval("var str='';for ( p in Boolean ) { str += p } str;") );
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1-2.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1-2.js
index 3c6d66eb788..a557dbe9a7d 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1-2.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1-2.js
- ECMA Section: 15.6.3.1 Boolean.prototype
+ File Name: 15.6.3.1-2.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
- Description: The initial valu eof Boolean.prototype is the built-in
- Boolean prototype object (15.6.4).
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
- The property shall have the attributes [DontEnum,
- DontDelete, ReadOnly ].
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
- This tests the DontDelete property of Boolean.prototype
+ This tests the DontDelete property of Boolean.prototype
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
+var array = new Array();
+var item = 0;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "delete( Boolean.prototype)",
+ false,
+ delete( Boolean.prototype) );
- array[item++] = new TestCase( SECTION,
- "delete( Boolean.prototype)",
- false,
- delete( Boolean.prototype) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1-3.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1-3.js
index ce25aa7d9c3..9671ed83659 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1-3.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1-3.js
- ECMA Section: 15.6.3.1 Boolean.prototype
+ File Name: 15.6.3.1-3.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
- Description: The initial valu eof Boolean.prototype is the built-in
- Boolean prototype object (15.6.4).
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
- The property shall have the attributes [DontEnum,
- DontDelete, ReadOnly ].
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
- This tests the DontDelete property of Boolean.prototype
+ This tests the DontDelete property of Boolean.prototype
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.3.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
+var array = new Array();
+var item = 0;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "delete( Boolean.prototype); Boolean.prototype",
+ Boolean.prototype,
+ eval("delete( Boolean.prototype); Boolean.prototype") );
- array[item++] = new TestCase( SECTION,
- "delete( Boolean.prototype); Boolean.prototype",
- Boolean.prototype,
- eval("delete( Boolean.prototype); Boolean.prototype") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1-4.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1-4.js
index b3e9c58a338..ac2433ba51a 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1-4.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1-4.js
- ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object
+ File Name: 15.6.3.1-4.js
+ ECMA Section: 15.6.3.1 Properties of the Boolean Prototype Object
- Description: The initial value of Boolean.prototype is the built-in
- Boolean prototype object (15.6.4).
+ Description: The initial value of Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
- The property shall have the attributes [DontEnum,
- DontDelete, ReadOnly ].
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
- This tests the ReadOnly property of Boolean.prototype
+ This tests the ReadOnly property of Boolean.prototype
- Author: christine@netscape.com
- Date: 30 september 1997
+ Author: christine@netscape.com
+ Date: 30 september 1997
*/
- var SECTION = "15.6.3.1-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
+var BOOL_PROTO = Boolean.prototype;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO",
+ true,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") );
- var BOOL_PROTO = Boolean.prototype;
+new TestCase( SECTION,
+ "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null",
+ false,
+ eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") );
- array[item++] = new TestCase( SECTION,
- "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO",
- true,
- eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == BOOL_PROTO") );
-
- array[item++] = new TestCase( SECTION,
- "var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null",
- false,
- eval("var BOOL_PROTO = Boolean.prototype; Boolean.prototype=null; Boolean.prototype == null") );
-
- return ( array );
-}
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1-5.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1-5.js
index 0d69cdb39a1..2ba82e117f1 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1-5.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,43 +35,22 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1-5.js
- ECMA Section: 15.6.3.1 Boolean.prototype
- Description:
- Author: christine@netscape.com
- Date: 28 october 1997
+ File Name: 15.6.3.1-5.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var VERSION = "ECMA_2";
- startTest();
- var SECTION = "15.6.3.1-5";
- var TITLE = "Boolean.prototype"
+var VERSION = "ECMA_2";
+startTest();
+var SECTION = "15.6.3.1-5";
+var TITLE = "Boolean.prototype"
- writeHeaderToLog( SECTION + " " + TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " " + TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Function.prototype == Boolean.__proto__", true, Function.prototype == Boolean.__proto__ );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.1.js b/mozilla/js/tests/ecma/Boolean/15.6.3.1.js
index 0462f653f35..afc75ee26e5 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.1.js
- ECMA Section: 15.6.3.1 Boolean.prototype
+ File Name: 15.6.3.1.js
+ ECMA Section: 15.6.3.1 Boolean.prototype
- Description: The initial valu eof Boolean.prototype is the built-in
- Boolean prototype object (15.6.4).
+ Description: The initial valu eof Boolean.prototype is the built-in
+ Boolean prototype object (15.6.4).
- The property shall have the attributes [DontEnum,
- DontDelete, ReadOnly ].
+ The property shall have the attributes [DontEnum,
+ DontDelete, ReadOnly ].
- It has the internal [[Call]] and [[Construct]]
- properties (not tested), and the length property.
+ It has the internal [[Call]] and [[Construct]]
+ properties (not tested), and the length property.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype";
+var SECTION = "15.6.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
+new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
- array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.3.js b/mozilla/js/tests/ecma/Boolean/15.6.3.js
index fb4a8ee1744..66db9338ae5 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.3.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.3.js
- ECMA Section: 15.6.3 Properties of the Boolean Constructor
+ File Name: 15.6.3.js
+ ECMA Section: 15.6.3 Properties of the Boolean Constructor
- Description: The value of the internal prototype property is
- the Function prototype object.
+ Description: The value of the internal prototype property is
+ the Function prototype object.
- It has the internal [[Call]] and [[Construct]]
- properties, and the length property.
+ It has the internal [[Call]] and [[Construct]]
+ properties, and the length property.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.3";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "Properties of the Boolean Constructor"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Boolean Constructor"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype );
+new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Boolean.__proto__ == Function.prototype", true, Boolean.__proto__ == Function.prototype );
- array[item++] = new TestCase( SECTION, "Boolean.length", 1, Boolean.length );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4-1.js b/mozilla/js/tests/ecma/Boolean/15.6.4-1.js
index 46b53953fc5..e3910ab1021 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4-1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,55 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4-1.js
- ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+ File Name: 15.6.4-1.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
- Description:
- The Boolean prototype object is itself a Boolean object (its [[Class]] is
- "Boolean") whose value is false.
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
- The value of the internal [[Prototype]] property of the Boolean prototype object
- is the Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
- Author: christine@netscape.com
- Date: 30 september 1997
+ Author: christine@netscape.com
+ Date: 30 september 1997
*/
- var VERSION = "ECMA_1"
- startTest();
- var SECTION = "15.6.4-1";
+var VERSION = "ECMA_1"
+startTest();
+var SECTION = "15.6.4-1";
- writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
- var testcases = getTestCases();
- test();
+writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) );
+new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) );
+new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
+new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Boolean.prototype == typeof( new Boolean )", true, typeof Boolean.prototype == typeof( new Boolean ) );
- array[item++] = new TestCase( SECTION, "typeof( Boolean.prototype )", "object", typeof(Boolean.prototype) );
- array[item++] = new TestCase( SECTION,
- "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
- "[object Boolean]",
- eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
- array[item++] = new TestCase( SECTION, "Boolean.prototype.valueOf()", false, Boolean.prototype.valueOf() );
-
- return ( array );
-}
-
-function test() {
- for (tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4-2.js b/mozilla/js/tests/ecma/Boolean/15.6.4-2.js
index 330cc6b96f4..47a108ea1ac 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4-2.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4-2.js
- ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
+ File Name: 15.6.4-2.js
+ ECMA Section: 15.6.4 Properties of the Boolean Prototype Object
- Description:
- The Boolean prototype object is itself a Boolean object (its [[Class]] is
- "Boolean") whose value is false.
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is
+ "Boolean") whose value is false.
- The value of the internal [[Prototype]] property of the Boolean prototype object
- is the Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Boolean prototype object
+ is the Object prototype object (15.2.3.1).
- Author: christine@netscape.com
- Date: 30 september 1997
+ Author: christine@netscape.com
+ Date: 30 september 1997
*/
- var VERSION = "ECMA_2"
- startTest();
- var SECTION = "15.6.4-2";
+var VERSION = "ECMA_2"
+startTest();
+var SECTION = "15.6.4-2";
- writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
- var testcases = getTestCases();
- test();
+writeHeaderToLog( SECTION + " Properties of the Boolean Prototype Object");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
-
- return ( array );
-}
-
-function test() {
- for (tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.1.js b/mozilla/js/tests/ecma/Boolean/15.6.4.1.js
index 22b8eb9c089..0eec10335d1 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.1.js
- ECMA Section: 15.6.4.1 Boolean.prototype.constructor
+ File Name: 15.6.4.1.js
+ ECMA Section: 15.6.4.1 Boolean.prototype.constructor
- Description: The initial value of Boolean.prototype.constructor
- is the built-in Boolean constructor.
+ Description: The initial value of Boolean.prototype.constructor
+ is the built-in Boolean constructor.
- Author: christine@netscape.com
- Date: 30 september 1997
+ Author: christine@netscape.com
+ Date: 30 september 1997
*/
- var SECTION = "15.6.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.constructor"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.constructor"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "( Boolean.prototype.constructor == Boolean )",
- true ,
- (Boolean.prototype.constructor == Boolean) );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "( Boolean.prototype.constructor == Boolean )",
+ true ,
+ (Boolean.prototype.constructor == Boolean) );
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.2-1.js b/mozilla/js/tests/ecma/Boolean/15.6.4.2-1.js
index a4cf9b0693e..70e82da5b8e 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.2-1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,79 +35,61 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.2.js
- ECMA Section: 15.6.4.2-1 Boolean.prototype.toString()
- Description: If this boolean value is true, then the string "true"
- is returned; otherwise this boolean value must be false,
- and the string "false" is returned.
+ File Name: 15.6.4.2.js
+ ECMA Section: 15.6.4.2-1 Boolean.prototype.toString()
+ Description: If this boolean value is true, then the string "true"
+ is returned; otherwise this boolean value must be false,
+ and the string "false" is returned.
- The toString function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.toString()"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() );
+new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() );
+new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() );
+new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() );
+new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() );
+new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() );
+new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() );
+new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() );
+new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(1)", "true", (new Boolean(1)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(0)", "false", (new Boolean(0)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(-1)", "true", (new Boolean(-1)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean('1')", "true", (new Boolean("1")).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean('0')", "true", (new Boolean("0")).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(true)", "true", (new Boolean(true)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(false)", "false", (new Boolean(false)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean('true')", "true", (new Boolean('true')).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean('false')", "true", (new Boolean('false')).toString() );
+new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() );
+new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() );
+new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() );
+new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() );
+new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() );
+new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() );
+new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() );
+new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() );
+new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() );
+new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() );
+new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() );
+new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() );
+new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean('')", "false", (new Boolean('')).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(null)", "false", (new Boolean(null)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(void(0))", "false", (new Boolean(void(0))).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", "true", (new Boolean(Number.NEGATIVE_INFINITY)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(NaN)", "false", (new Boolean(Number.NaN)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean()", "false", (new Boolean()).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=1)", "true", (new Boolean(x=1)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=0)", "false", (new Boolean(x=0)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=false)", "false", (new Boolean(x=false)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=true)", "true", (new Boolean(x=true)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=null)", "false", (new Boolean(x=null)).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x='')", "false", (new Boolean(x="")).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", "true", (new Boolean(x=" ")).toString() );
+new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() );
+new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(true))", "true", (new Boolean(new MyObject(true))).toString() );
- array[item++] = new TestCase( SECTION, "new Boolean(new MyObject(false))", "true", (new Boolean(new MyObject(false))).toString() );
+test();
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- return this;
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.2-2.js b/mozilla/js/tests/ecma/Boolean/15.6.4.2-2.js
index 275996cddb2..b64be2b0861 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.2-2.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.2-2.js
- ECMA Section: 15.6.4.2 Boolean.prototype.toString()
- Description: Returns this boolean value.
+ File Name: 15.6.4.2-2.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
- The toString function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.toString()"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.4.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
-
- array[item++] = new TestCase( SECTION,
- "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()",
- "false",
- "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" );
- array[item++] = new TestCase( SECTION,
- "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()",
- "true",
- "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()" );
- array[item++] = new TestCase( SECTION,
- "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()",
- "false",
- "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()" );
- return ( array );
-
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()",
+ "false",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") );
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()",
+ "true",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(true); x.toString=tostr; x.toString()") );
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new Boolean(false); x.toString=tostr;x.toString()",
+ "false",
+ eval("tostr=Boolean.prototype.toString; x=new Boolean(); x.toString=tostr;x.toString()") );
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.2-3.js b/mozilla/js/tests/ecma/Boolean/15.6.4.2-3.js
index f9f095715d2..a7289efc965 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.2-3.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.2-3.js
- ECMA Section: 15.6.4.2 Boolean.prototype.toString()
- Description: Returns this boolean value.
+ File Name: 15.6.4.2-3.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
- The toString function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.toString()"
- writeHeaderToLog( SECTION + TITLE );
+var SECTION = "15.6.4.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()"
+writeHeaderToLog( SECTION + TITLE );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") );
+new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()", "true", eval("tostr=Boolean.prototype.toString; x=true; x.toString=tostr;x.toString()") );
- array[item++] = new TestCase( SECTION, "tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()", "false", eval("tostr=Boolean.prototype.toString; x=false; x.toString=tostr;x.toString()") );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.2-4-n.js b/mozilla/js/tests/ecma/Boolean/15.6.4.2-4-n.js
index e8c5988a0dd..1bf12f4463d 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.2-4-n.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.2-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.2-4.js
- ECMA Section: 15.6.4.2 Boolean.prototype.toString()
- Description: Returns this boolean value.
+ File Name: 15.6.4.2-4.js
+ ECMA Section: 15.6.4.2 Boolean.prototype.toString()
+ Description: Returns this boolean value.
- The toString function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.2-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.toString()";
- writeHeaderToLog( SECTION +" "+ TITLE );
+var SECTION = "15.6.4.2-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.toString()";
+writeHeaderToLog( SECTION +" "+ TITLE );
- var testcases = getTestCases();
- test();
+DESCRIPTION = "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()",
+ "error",
+ eval("tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()") );
- array[item++] = new TestCase( SECTION,
- "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()",
- "error",
- "tostr=Boolean.prototype.toString; x=new String( 'hello' ); x.toString=tostr; x.toString()" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual);
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.3-1.js b/mozilla/js/tests/ecma/Boolean/15.6.4.3-1.js
index 5c1cb13c3b8..0dbab94e151 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.3-1.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,73 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.3.js
- ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
- Description: Returns this boolean value.
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.valueOf()";
+var SECTION = "15.6.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(1)", true, (new Boolean(1)).valueOf() );
+new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() );
+new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(0)", false, (new Boolean(0)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean('1')", true, (new Boolean("1")).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean('0')", true, (new Boolean("0")).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(true)", true, (new Boolean(true)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(false)", false, (new Boolean(false)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean('true')", true, (new Boolean("true")).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean('')", false, (new Boolean('')).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(null)", false, (new Boolean(null)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean()", false, (new Boolean()).valueOf() );
-
- array[item++] = new TestCase( SECTION, "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
- array[item++] = new TestCase( SECTION, "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.3-2.js b/mozilla/js/tests/ecma/Boolean/15.6.4.3-2.js
index 06b44b875a5..3abd1f1e5c9 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.3-2.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.3-2.js
- ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
- Description: Returns this boolean value.
+ File Name: 15.6.4.3-2.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.valueOf()";
+var SECTION = "15.6.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") );
+
+new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") );
- array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()", false, eval("valof=Boolean.prototype.valueOf; x=new Boolean(); x.valueOf=valof;x.valueOf()") );
- array[item++] = new TestCase( SECTION, "valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()", true, eval("valof=Boolean.prototype.valueOf; x=new Boolean(true); x.valueOf=valof;x.valueOf()") );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.3-3.js b/mozilla/js/tests/ecma/Boolean/15.6.4.3-3.js
index 842d0d5f4ae..7db19acdb4b 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.3-3.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.3-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.3-3.js
- ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
- Description: Returns this boolean value.
+ File Name: 15.6.4.3-3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.3-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.valueOf()";
+var SECTION = "15.6.4.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
-
- testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()",
- true,
- eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()",
+ true,
+ eval("x=true; x.valueOf=Boolean.prototype.valueOf;x.valueOf()") );
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.3-4-n.js b/mozilla/js/tests/ecma/Boolean/15.6.4.3-4-n.js
index bf59233514d..364e079031e 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.3-4-n.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.3-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.3-4.js
- ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
- Description: Returns this boolean value.
+ File Name: 15.6.4.3-4.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "15.6.4.3-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean.prototype.valueOf()";
+var SECTION = "15.6.4.3-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean.prototype.valueOf()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+DESCRIPTION = "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()"
+EXPECTED = "error";
- test();
+new TestCase( SECTION,
+ "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()",
+ "error",
+ eval("valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()",
- "error",
- "valof=Boolean.prototype.valueOf; x=new String( 'hello' ); x.valueOf=valof;x.valueOf()" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.3.js b/mozilla/js/tests/ecma/Boolean/15.6.4.3.js
index 2c3492fa882..798168959b0 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.3.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,79 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.3.js
- ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
- Description: Returns this boolean value.
+ File Name: 15.6.4.3.js
+ ECMA Section: 15.6.4.3 Boolean.prototype.valueOf()
+ Description: Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(1)", true, (new Boolean(1)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(0)", false, (new Boolean(0)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(-1)", true, (new Boolean(-1)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('1')", true, (new Boolean("1")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('0')", true, (new Boolean("0")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(true)", true, (new Boolean(true)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(false)", false, (new Boolean(false)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('true')", true, (new Boolean("true")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('false')", true, (new Boolean('false')).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
- array[item++] = new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean('')", false, (new Boolean('')).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(null)", false, (new Boolean(null)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(void(0))", false, (new Boolean(void(0))).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(-Infinity)", true, (new Boolean(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(NaN)", false, (new Boolean(Number.NaN)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean()", false, (new Boolean()).valueOf() );
- return ( array );
-}
+new TestCase( "15.8.6.4", "new Boolean(x=1)", true, (new Boolean(x=1)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=0)", false, (new Boolean(x=0)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=false)", false, (new Boolean(x=false)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=true)", true, (new Boolean(x=true)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=null)", false, (new Boolean(x=null)).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x='')", false, (new Boolean(x="")).valueOf() );
+new TestCase( "15.8.6.4", "new Boolean(x=' ')", true, (new Boolean(x=" ")).valueOf() );
-function test( array ) {
- var passed = true;
-
- writeHeaderToLog("15.8.6.4.3 Properties of the Boolean Object: valueOf");
-
- for ( i = 0; i < array.length; i++ ) {
-
- array[i].passed = writeTestCaseResult(
- array[i].expect,
- array[i].actual,
- "( "+ array[i].description +" ).valueOf() = "+ array[i].actual );
-
- array[i].reason += ( array[i].passed ) ? "" : "wrong value ";
-
- passed = ( array[i].passed ) ? passed : false;
-
- }
-
- stopTest();
-
- // all tests must return a boolean value
- return ( array );
-}
-
-// for TCMS, the testcases array must be global.
- var testcases = getTestCases();
-
-// all tests must call a function that returns a boolean value
- test( testcases );
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/15.6.4.js b/mozilla/js/tests/ecma/Boolean/15.6.4.js
index 5c672410a2b..9d9dd60229b 100644
--- a/mozilla/js/tests/ecma/Boolean/15.6.4.js
+++ b/mozilla/js/tests/ecma/Boolean/15.6.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,59 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.6.4.js
- ECMA Section: Properties of the Boolean Prototype Object
- Description:
- The Boolean prototype object is itself a Boolean object (its [[Class]] is "
- Boolean") whose value is false.
+ File Name: 15.6.4.js
+ ECMA Section: Properties of the Boolean Prototype Object
+ Description:
+ The Boolean prototype object is itself a Boolean object (its [[Class]] is "
+ Boolean") whose value is false.
- The value of the internal [[Prototype]] property of the Boolean prototype
- object is the Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Boolean prototype
+ object is the Object prototype object (15.2.3.1).
- In following descriptions of functions that are properties of the Boolean
- prototype object, the phrase "this Boolean object" refers to the object that
- is the this value for the invocation of the function; it is an error if
- this does not refer to an object for which the value of the internal
- [[Class]] property is "Boolean". Also, the phrase "this boolean value"
- refers to the boolean value represented by this Boolean object, that is,
- the value of the internal [[Value]] property of this Boolean object.
+ In following descriptions of functions that are properties of the Boolean
+ prototype object, the phrase "this Boolean object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Boolean". Also, the phrase "this boolean value"
+ refers to the boolean value represented by this Boolean object, that is,
+ the value of the internal [[Value]] property of this Boolean object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.6.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Boolean Prototype Object";
+var SECTION = "15.6.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Boolean Prototype Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "Boolean.prototype == false",
+ true,
+ Boolean.prototype == false );
- testcases[tc++] = new TestCase( SECTION,
- "Boolean.prototype == false",
- true,
- Boolean.prototype == false );
+new TestCase( SECTION,
+ "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
+ "[object Boolean]",
+ eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
- testcases[tc++] = new TestCase( SECTION,
- "Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()",
- "[object Boolean]",
- eval("Boolean.prototype.toString = Object.prototype.toString; Boolean.prototype.toString()") );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Boolean/browser.js b/mozilla/js/tests/ecma/Boolean/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Boolean/shell.js b/mozilla/js/tests/ecma/Boolean/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Date/15.9.1.1-1.js b/mozilla/js/tests/ecma/Date/15.9.1.1-1.js
index d097b6e9dfd..766c55703a7 100644
--- a/mozilla/js/tests/ecma/Date/15.9.1.1-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.1.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.1.1-1.js
- ECMA Section: 15.9.1.1 Time Range
- Description:
- - leap seconds are ignored
- - assume 86400000 ms / day
- - numbers range fom +/- 9,007,199,254,740,991
- - ms precision for any instant that is within
- approximately +/-285,616 years from 1 jan 1970
- UTC
- - range of times supported is -100,000,000 days
- to 100,000,000 days from 1 jan 1970 12:00 am
- - time supported is 8.64e5*10e8 milliseconds from
- 1 jan 1970 UTC (+/-273972.6027397 years)
+ File Name: 15.9.1.1-1.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
- - this test generates its own data -- it does not
- read data from a file.
- Author: christine@netscape.com
- Date: 7 july 1997
+ - this test generates its own data -- it does not
+ read data from a file.
+ Author: christine@netscape.com
+ Date: 7 july 1997
- Static variables:
- FOUR_HUNDRED_YEARS
+ Static variables:
+ FOUR_HUNDRED_YEARS
*/
-function test() {
- writeHeaderToLog("15.8.1.1 Time Range");
-
- for ( M_SECS = 0, CURRENT_YEAR = 1970;
- M_SECS < 8640000000000000;
- tc++, M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) {
-
- testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS)).getUTCFullYear() );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- if ( ! testcases[tc].passed ) {
- testcases[tc].reason = "wrong year value";
- }
- }
-
- stopTest();
-
- return ( testcases );
-}
-
// every one hundred years contains:
// 24 years with 366 days
//
@@ -94,9 +71,23 @@ function test() {
// 86400000*365*97 = 3067372800000
// +86400000*366*303 = + 9555408000000
// = 1.26227808e+13
- var FOUR_HUNDRED_YEARS = 1.26227808e+13;
- var SECTION = "15.9.1.1-1";
- var tc = 0;
- var testcases = new Array();
+var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+var SECTION = "15.9.1.1-1";
+
+writeHeaderToLog("15.8.1.1 Time Range");
+
+var M_SECS;
+var CURRENT_YEAR;
+
+for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS < 8640000000000000;
+ M_SECS += FOUR_HUNDRED_YEARS, CURRENT_YEAR += 400 ) {
+
+ new TestCase( SECTION,
+ "new Date("+M_SECS+")",
+ CURRENT_YEAR,
+ (new Date( M_SECS)).getUTCFullYear() );
+}
+
+test();
- test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.1.1-2.js b/mozilla/js/tests/ecma/Date/15.9.1.1-2.js
index 78beb9d06f5..060c2fcfeb2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.1.1-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.1.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,54 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.1.1-2.js
- ECMA Section: 15.9.1.1 Time Range
- Description:
- - leap seconds are ignored
- - assume 86400000 ms / day
- - numbers range fom +/- 9,007,199,254,740,991
- - ms precision for any instant that is within
- approximately +/-285,616 years from 1 jan 1970
- UTC
- - range of times supported is -100,000,000 days
- to 100,000,000 days from 1 jan 1970 12:00 am
- - time supported is 8.64e5*10e8 milliseconds from
- 1 jan 1970 UTC (+/-273972.6027397 years)
- Author: christine@netscape.com
- Date: 9 july 1997
+ File Name: 15.9.1.1-2.js
+ ECMA Section: 15.9.1.1 Time Range
+ Description:
+ - leap seconds are ignored
+ - assume 86400000 ms / day
+ - numbers range fom +/- 9,007,199,254,740,991
+ - ms precision for any instant that is within
+ approximately +/-285,616 years from 1 jan 1970
+ UTC
+ - range of times supported is -100,000,000 days
+ to 100,000,000 days from 1 jan 1970 12:00 am
+ - time supported is 8.64e5*10e8 milliseconds from
+ 1 jan 1970 UTC (+/-273972.6027397 years)
+ Author: christine@netscape.com
+ Date: 9 july 1997
*/
-function test() {
+// every one hundred years contains:
+// 24 years with 366 days
+//
+// every four hundred years contains:
+// 97 years with 366 days
+// 303 years with 365 days
+//
+// 86400000*366*97 = 3067372800000
+// +86400000*365*303 = + 9555408000000
+// = 1.26227808e+13
- writeHeaderToLog("15.8.1.1 Time Range");
+var FOUR_HUNDRED_YEARS = 1.26227808e+13;
+var SECTION = "15.9.1.1-2";
- for ( M_SECS = 0, CURRENT_YEAR = 1970;
- M_SECS > -8640000000000000;
- tc++, M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
+writeHeaderToLog("15.8.1.1 Time Range");
- testcases[tc] = new TestCase( SECTION, "new Date("+M_SECS+")", CURRENT_YEAR, (new Date( M_SECS )).getUTCFullYear() );
+var M_SECS;
+var CURRENT_YEAR;
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description + " = " +
- testcases[tc].actual );
+for ( M_SECS = 0, CURRENT_YEAR = 1970;
+ M_SECS > -8640000000000000;
+ M_SECS -= FOUR_HUNDRED_YEARS, CURRENT_YEAR -= 400 ) {
- if ( ! testcases[tc].passed ) {
- testcases[tc].reason = "wrong year value";
- }
- }
+ new TestCase( SECTION,
+ "new Date("+M_SECS+")",
+ CURRENT_YEAR,
+ (new Date( M_SECS )).getUTCFullYear() );
- stopTest();
-
- return ( testcases );
}
- // every one hundred years contains:
- // 24 years with 366 days
- //
- // every four hundred years contains:
- // 97 years with 366 days
- // 303 years with 365 days
- //
- // 86400000*366*97 = 3067372800000
- // +86400000*365*303 = + 9555408000000
- // = 1.26227808e+13
- var FOUR_HUNDRED_YEARS = 1.26227808e+13;
- var SECTION = "15.9.1.1-2";
- var tc = 0;
- var testcases = new Array();
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.1.js b/mozilla/js/tests/ecma/Date/15.9.2.1.js
index d031df036ab..4b72f70289d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,90 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.2.1.js
- ECMA Section: 15.9.2.1 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds, ms )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
+/**
+ File Name: 15.9.2.1.js
+ ECMA Section: 15.9.2.1 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds, ms )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.2.1";
- var TITLE = "Date Constructor used as a function";
- var TYPEOF = "string";
- var TOLERANCE = 1000;
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.2.1";
+var TITLE = "Date Constructor used as a function";
+var TYPEOF = "string";
+var TOLERANCE = 1000;
- writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
- "Date( year, month, date, hours, minutes, seconds, ms )" );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog("15.9.2.1 The Date Constructor Called as a Function: " +
+ "Date( year, month, date, hours, minutes, seconds, ms )" );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+var TODAY = new Date();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// Dates around 1970
- var TODAY = new Date();
+new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1));
- // Dates around 1970
+ // Dates around 2000
+ new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999));
+new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0));
+new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59,999)", (new Date()).toString(), Date(1969,11,31,15,59,59,999))
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0,0))
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,0,1))
+// Dates around 1900
- // Dates around 2000
- array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59,999)", (new Date()).toString(), Date(1999,11,15,59,59,999));
- array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0,0));
- array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59,999)", (new Date()).toString(), Date(1999,11,31,23,59,59,999) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0));
- // Dates around 1900
+// Dates around feb 29, 2000
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59,999)", (new Date()).toString(), Date(1899,11,31,23,59,59,999));
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0));
- // Dates around feb 29, 2000
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59,999)", (new Date()).toString(), Date( 2000,1,28,23,59,59,999));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0));
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59,999)", (new Date()).toString(), Date(2004,11,31,23,59,59,999));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0,0));
-
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59,999)", (new Date()).toString(), Date(2031,11,31,23,59,59,999));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0,0));
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-1.js b/mozilla/js/tests/ecma/Date/15.9.2.2-1.js
index 78121544c35..6639af743a8 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,66 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+// Dates around 1970
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around 1970
-
- array[item++] = new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59))
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0))
- array[item++] = new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1))
+new TestCase( SECTION, "Date(1970,0,1,0,0,0)", (new Date()).toString(), Date(1970,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1969,11,31,15,59,59)", (new Date()).toString(), Date(1969,11,31,15,59,59));
+new TestCase( SECTION, "Date(1969,11,31,16,0,0)", (new Date()).toString(), Date(1969,11,31,16,0,0));
+new TestCase( SECTION, "Date(1969,11,31,16,0,1)", (new Date()).toString(), Date(1969,11,31,16,0,1));
/*
- // Dates around 2000
- array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
- array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
- array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+// Dates around 2000
+new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
- // Dates around 1900
+// Dates around 1900
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
- // Dates around feb 29, 2000
+// Dates around feb 29, 2000
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-2.js b/mozilla/js/tests/ecma/Date/15.9.2.2-2.js
index 89f7aa4bcd8..a21d3359dd5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,60 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around 2000
- array[item++] = new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
- array[item++] = new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
- array[item++] = new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
+// Dates around 2000
+new TestCase( SECTION, "Date(1999,11,15,59,59)", (new Date()).toString(), Date(1999,11,15,59,59));
+new TestCase( SECTION, "Date(1999,11,16,0,0,0)", (new Date()).toString(), Date(1999,11,16,0,0,0));
+new TestCase( SECTION, "Date(1999,11,31,23,59,59)", (new Date()).toString(), Date(1999,11,31,23,59,59) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,0)", (new Date()).toString(), Date(2000,0,0,0,0,0) );
+new TestCase( SECTION, "Date(2000,0,1,0,0,1)", (new Date()).toString(), Date(2000,0,0,0,0,1) );
/*
- // Dates around 1900
+// Dates around 1900
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
- // Dates around feb 29, 2000
+// Dates around feb 29, 2000
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-3.js b/mozilla/js/tests/ecma/Date/15.9.2.2-3.js
index b005c85ec27..05e938c6340 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,74 +35,53 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+// Dates around 1900
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around 1900
-
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
+new TestCase( SECTION, "Date(1899,11,31,23,59,59)", (new Date()).toString(), Date(1899,11,31,23,59,59));
+new TestCase( SECTION, "Date(1900,0,1,0,0,0)", (new Date()).toString(), Date(1900,0,1,0,0,0) );
+new TestCase( SECTION, "Date(1900,0,1,0,0,1)", (new Date()).toString(), Date(1900,0,1,0,0,1) );
+new TestCase( SECTION, "Date(1899,11,31,16,0,0,0)", (new Date()).toString(), Date(1899,11,31,16,0,0,0));
/*
- // Dates around feb 29, 2000
+// Dates around feb 29, 2000
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-4.js b/mozilla/js/tests/ecma/Date/15.9.2.2-4.js
index 63e18d9ca07..406d6161e7b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,67 +35,46 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+// Dates around feb 29, 2000
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around feb 29, 2000
-
- array[item++] = new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
- array[item++] = new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
+new TestCase( SECTION, "Date( 2000,1,29,0,0,0)", (new Date()).toString(), Date(2000,1,29,0,0,0));
+new TestCase( SECTION, "Date( 2000,1,28,23,59,59)", (new Date()).toString(), Date( 2000,1,28,23,59,59));
+new TestCase( SECTION, "Date( 2000,1,27,16,0,0)", (new Date()).toString(), Date(2000,1,27,16,0,0));
/*
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-5.js b/mozilla/js/tests/ecma/Date/15.9.2.2-5.js
index 99f2feec64a..a94854fea9b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,60 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around jan 1, 2005
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
+// Dates around jan 1, 2005
+new TestCase( SECTION, "Date(2004,11,31,23,59,59)", (new Date()).toString(), Date(2004,11,31,23,59,59));
+new TestCase( SECTION, "Date(2005,0,1,0,0,0)", (new Date()).toString(), Date(2005,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2005,0,1,0,0,1)", (new Date()).toString(), Date(2005,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2004,11,31,16,0,0,0)", (new Date()).toString(), Date(2004,11,31,16,0,0,0));
/*
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.2.2-6.js b/mozilla/js/tests/ecma/Date/15.9.2.2-6.js
index 4761baa3d00..6400233fe26 100644
--- a/mozilla/js/tests/ecma/Date/15.9.2.2-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.2.2-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.2.2.js
- ECMA Section: 15.9.2.2 Date constructor used as a function
- Date( year, month, date, hours, minutes, seconds )
- Description: The arguments are accepted, but are completely ignored.
- A string is created and returned as if by the
- expression (new Date()).toString().
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+/**
+ File Name: 15.9.2.2.js
+ ECMA Section: 15.9.2.2 Date constructor used as a function
+ Date( year, month, date, hours, minutes, seconds )
+ Description: The arguments are accepted, but are completely ignored.
+ A string is created and returned as if by the
+ expression (new Date()).toString().
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = 9706;
- startTest();
- var SECTION = "15.9.2.2";
- var TOLERANCE = 100;
- var TITLE = "The Date Constructor Called as a Function";
+var VERSION = 9706;
+startTest();
+var SECTION = "15.9.2.2";
+var TOLERANCE = 100;
+var TITLE = "The Date Constructor Called as a Function";
- writeHeaderToLog(SECTION+" "+TITLE );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog(SECTION+" "+TITLE );
-// all tests must call a function that returns an array of TestCase objects.
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Dates around jan 1, 2032
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
- array[item++] = new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
- array[item++] = new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+// Dates around jan 1, 2032
+new TestCase( SECTION, "Date(2031,11,31,23,59,59)", (new Date()).toString(), Date(2031,11,31,23,59,59));
+new TestCase( SECTION, "Date(2032,0,1,0,0,0)", (new Date()).toString(), Date(2032,0,1,0,0,0) );
+new TestCase( SECTION, "Date(2032,0,1,0,0,1)", (new Date()).toString(), Date(2032,0,1,0,0,1) );
+new TestCase( SECTION, "Date(2031,11,31,16,0,0,0)", (new Date()).toString(), Date(2031,11,31,16,0,0,0));
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.1-1.js b/mozilla/js/tests/ecma/Date/15.9.3.1-1.js
index bb45298c416..dc15cd3cc3c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.1-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,255 +36,234 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.9.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+var TZ_ADJUST = TZ_PST * msPerHour;
- var testcases = new Array();
+// Dates around 1970
- getTestCases();
- test();
+addNewTestCase( new Date( 1969,11,31,15,59,59,999),
+ "new Date( 1969,11,31,15,59,59,999)",
+ [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = TZ_PST * msPerHour;
+addNewTestCase( new Date( 1969,11,31,23,59,59,999),
+ "new Date( 1969,11,31,23,59,59,999)",
+ [TIME_1970-TZ_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
- // Dates around 1970
+addNewTestCase( new Date( 1970,0,1,0,0,0,0),
+ "new Date( 1970,0,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( 1969,11,31,15,59,59,999),
- "new Date( 1969,11,31,15,59,59,999)",
- [TIME_1970-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+addNewTestCase( new Date( 1969,11,31,16,0,0,0),
+ "new Date( 1969,11,31,16,0,0,0)",
+ [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date( 1969,11,31,23,59,59,999),
- "new Date( 1969,11,31,23,59,59,999)",
- [TIME_1970-TZ_ADJUST-1,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+addNewTestCase( new Date(1969,12,1,0,0,0,0),
+ "new Date(1969,12,1,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( 1970,0,1,0,0,0,0),
- "new Date( 1970,0,1,0,0,0,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date(1969,11,32,0,0,0,0),
+ "new Date(1969,11,32,0,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( 1969,11,31,16,0,0,0),
- "new Date( 1969,11,31,16,0,0,0)",
- [TIME_1970,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date(1969,11,31,24,0,0,0),
+ "new Date(1969,11,31,24,0,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date(1969,12,1,0,0,0,0),
- "new Date(1969,12,1,0,0,0,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date(1969,11,31,23,60,0,0),
+ "new Date(1969,11,31,23,60,0,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date(1969,11,32,0,0,0,0),
- "new Date(1969,11,32,0,0,0,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date(1969,11,31,23,59,60,0),
+ "new Date(1969,11,31,23,59,60,0)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date(1969,11,31,24,0,0,0),
- "new Date(1969,11,31,24,0,0,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date(1969,11,31,23,59,59,1000),
+ "new Date(1969,11,31,23,59,59,1000)",
+ [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date(1969,11,31,23,60,0,0),
- "new Date(1969,11,31,23,60,0,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+// Dates around 2000
- addNewTestCase( new Date(1969,11,31,23,59,60,0),
- "new Date(1969,11,31,23,59,60,0)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
- addNewTestCase( new Date(1969,11,31,23,59,59,1000),
- "new Date(1969,11,31,23,59,59,1000)",
- [TIME_1970-TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
- // Dates around 2000
+addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
- addNewTestCase( new Date( 1999,11,31,15,59,59,999),
- "new Date( 1999,11,31,15,59,59,999)",
- [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date( 1999,11,31,16,0,0,0),
- "new Date( 1999,11,31,16,0,0,0)",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
- addNewTestCase( new Date( 1999,11,31,23,59,59,999),
- "new Date( 1999,11,31,23,59,59,999)",
- [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+// Dates around 29 Feb 2000
- addNewTestCase( new Date( 2000,0,1,0,0,0,0),
- "new Date( 2000,0,1,0,0,0,0)",
- [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
- addNewTestCase( new Date( 2000,0,1,0,0,0,1),
- "new Date( 2000,0,1,0,0,0,1)",
- [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- // Dates around 29 Feb 2000
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+// Dates around 1900
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(2000,1,28,24,0,0,0),
- "new Date(2000,1,28,24,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
- // Dates around 1900
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
- addNewTestCase( new Date(1899,11,31,16,0,0,0),
- "new Date(1899,11,31,16,0,0,0)",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1899,11,31,15,59,59,999),
- "new Date(1899,11,31,15,59,59,999)",
- [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
- addNewTestCase( new Date(1899,11,31,23,59,59,999),
- "new Date(1899,11,31,23,59,59,999)",
- [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+// Dates around 2005
- addNewTestCase( new Date(1900,0,1,0,0,0,0),
- "new Date(1900,0,1,0,0,0,0)",
- [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- addNewTestCase( new Date(1900,0,1,0,0,0,1),
- "new Date(1900,0,1,0,0,0,1)",
- [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- // Dates around 2005
-
- var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
-
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
-
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings test case
+ // Daylight Savings test case
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
+
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- var item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.1-2.js b/mozilla/js/tests/ecma/Date/15.9.3.1-2.js
index 9c1ffe4b517..d79d1b06ab4 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.1-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,213 +35,195 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.9.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- getTestCases();
- test();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = TZ_PST * msPerHour;
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = TZ_PST * msPerHour;
+// Dates around 2000
- // Dates around 2000
+addNewTestCase( new Date( 1999,11,31,15,59,59,999),
+ "new Date( 1999,11,31,15,59,59,999)",
+ [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
- addNewTestCase( new Date( 1999,11,31,15,59,59,999),
- "new Date( 1999,11,31,15,59,59,999)",
- [TIME_2000-1,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+addNewTestCase( new Date( 1999,11,31,16,0,0,0),
+ "new Date( 1999,11,31,16,0,0,0)",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
- addNewTestCase( new Date( 1999,11,31,16,0,0,0),
- "new Date( 1999,11,31,16,0,0,0)",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+addNewTestCase( new Date( 1999,11,31,23,59,59,999),
+ "new Date( 1999,11,31,23,59,59,999)",
+ [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
- addNewTestCase( new Date( 1999,11,31,23,59,59,999),
- "new Date( 1999,11,31,23,59,59,999)",
- [TIME_2000-TZ_ADJUST-1,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+addNewTestCase( new Date( 2000,0,1,0,0,0,0),
+ "new Date( 2000,0,1,0,0,0,0)",
+ [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date( 2000,0,1,0,0,0,0),
- "new Date( 2000,0,1,0,0,0,0)",
- [TIME_2000-TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
-
- addNewTestCase( new Date( 2000,0,1,0,0,0,1),
- "new Date( 2000,0,1,0,0,0,1)",
- [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
+addNewTestCase( new Date( 2000,0,1,0,0,0,1),
+ "new Date( 2000,0,1,0,0,0,1)",
+ [TIME_2000-TZ_ADJUST+1,2000,0,1,6,8,0,0,1,2000,0,1,6,0,0,0,1] );
/*
- // Dates around 29 Feb 2000
+// Dates around 29 Feb 2000
- var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+"new Date(2000,1,28,16,0,0,0)",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+"new Date(2000,1,29,0,0,0,0)",
+[UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,28,24,0,0,0),
- "new Date(2000,1,28,24,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(2000,1,28,24,0,0,0),
+"new Date(2000,1,28,24,0,0,0)",
+[UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- // Dates around 1900
+// Dates around 1900
- addNewTestCase( new Date(1899,11,31,16,0,0,0),
- "new Date(1899,11,31,16,0,0,0)",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+"new Date(1899,11,31,16,0,0,0)",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(1899,11,31,15,59,59,999),
- "new Date(1899,11,31,15,59,59,999)",
- [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+"new Date(1899,11,31,15,59,59,999)",
+[TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
- addNewTestCase( new Date(1899,11,31,23,59,59,999),
- "new Date(1899,11,31,23,59,59,999)",
- [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+"new Date(1899,11,31,23,59,59,999)",
+[TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
- addNewTestCase( new Date(1900,0,1,0,0,0,0),
- "new Date(1900,0,1,0,0,0,0)",
- [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+"new Date(1900,0,1,0,0,0,0)",
+[TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1900,0,1,0,0,0,1),
- "new Date(1900,0,1,0,0,0,1)",
- [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+"new Date(1900,0,1,0,0,0,1)",
+[TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
- // Dates around 2005
+// Dates around 2005
- var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings test case
+ // Daylight Savings test case
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- var item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.1-3.js b/mozilla/js/tests/ecma/Date/15.9.3.1-3.js
index 7b837b24443..02ad9a3927d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.1-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,191 +35,173 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.9.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = TZ_PST * msPerHour;
- getTestCases();
- test();
+// Dates around 29 Feb 2000
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = TZ_PST * msPerHour;
+var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
- // Dates around 29 Feb 2000
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
-
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
-
- addNewTestCase( new Date(2000,1,28,24,0,0,0),
- "new Date(2000,1,28,24,0,0,0)",
- [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(2000,1,28,24,0,0,0),
+ "new Date(2000,1,28,24,0,0,0)",
+ [UTC_FEB_29_2000-TZ_ADJUST,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
/*
- // Dates around 1900
+// Dates around 1900
- addNewTestCase( new Date(1899,11,31,16,0,0,0),
- "new Date(1899,11,31,16,0,0,0)",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+"new Date(1899,11,31,16,0,0,0)",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(1899,11,31,15,59,59,999),
- "new Date(1899,11,31,15,59,59,999)",
- [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+"new Date(1899,11,31,15,59,59,999)",
+[TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
- addNewTestCase( new Date(1899,11,31,23,59,59,999),
- "new Date(1899,11,31,23,59,59,999)",
- [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+"new Date(1899,11,31,23,59,59,999)",
+[TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
- addNewTestCase( new Date(1900,0,1,0,0,0,0),
- "new Date(1900,0,1,0,0,0,0)",
- [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+"new Date(1900,0,1,0,0,0,0)",
+[TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1900,0,1,0,0,0,1),
- "new Date(1900,0,1,0,0,0,1)",
- [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+"new Date(1900,0,1,0,0,0,1)",
+[TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
- // Dates around 2005
+// Dates around 2005
- var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings test case
+ // Daylight Savings test case
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- var item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.1-4.js b/mozilla/js/tests/ecma/Date/15.9.3.1-4.js
index 792dfd94c2c..6bfcce32d62 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.1-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.1-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,175 +35,156 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.9.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = TZ_PST * msPerHour;
- getTestCases();
- test();
+// Dates around 1900
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = TZ_PST * msPerHour;
+addNewTestCase( new Date(1899,11,31,16,0,0,0),
+ "new Date(1899,11,31,16,0,0,0)",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- // Dates around 1900
+addNewTestCase( new Date(1899,11,31,15,59,59,999),
+ "new Date(1899,11,31,15,59,59,999)",
+ [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
- addNewTestCase( new Date(1899,11,31,16,0,0,0),
- "new Date(1899,11,31,16,0,0,0)",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1899,11,31,23,59,59,999),
+ "new Date(1899,11,31,23,59,59,999)",
+ [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
- addNewTestCase( new Date(1899,11,31,15,59,59,999),
- "new Date(1899,11,31,15,59,59,999)",
- [TIME_1900-1,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+addNewTestCase( new Date(1900,0,1,0,0,0,0),
+ "new Date(1900,0,1,0,0,0,0)",
+ [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1899,11,31,23,59,59,999),
- "new Date(1899,11,31,23,59,59,999)",
- [TIME_1900-TZ_ADJUST-1,1900,0,1,1,7,59,59,999,1899,11,31,0,23,59,59,999] );
-
- addNewTestCase( new Date(1900,0,1,0,0,0,0),
- "new Date(1900,0,1,0,0,0,0)",
- [TIME_1900-TZ_ADJUST,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
-
- addNewTestCase( new Date(1900,0,1,0,0,0,1),
- "new Date(1900,0,1,0,0,0,1)",
- [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+addNewTestCase( new Date(1900,0,1,0,0,0,1),
+ "new Date(1900,0,1,0,0,0,1)",
+ [TIME_1900-TZ_ADJUST+1,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
/*
- // Dates around 2005
+// Dates around 2005
- var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings test case
+ // Daylight Savings test case
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- var item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.1-5.js b/mozilla/js/tests/ecma/Date/15.9.3.1-5.js
index ce31865e0ca..ddd06390df5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.1-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.1-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,152 +35,134 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1) is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.9.3.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
+var SECTION = "15.9.3.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Date( year, month, date, hours, minutes, seconds, ms )";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = TZ_PST * msPerHour;
- getTestCases();
- test();
+// Dates around 2005
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = TZ_PST * msPerHour;
+var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- // Dates around 2005
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- var UTC_YEAR_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
-
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [UTC_YEAR_2005-TZ_ADJUST,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
-
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_YEAR_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings test case
+ // Daylight Savings test case
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- var item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.2-1.js b/mozilla/js/tests/ecma/Date/15.9.3.2-1.js
index 2898b89a8b3..8145eef0928 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.2-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,223 +35,203 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var SECTION = "15.9.3.1";
- var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
- writeHeaderToLog( SECTION+" " +TITLE );
+writeHeaderToLog( SECTION+" " +TITLE );
- var testcases = new Array();
- getTestCases();
+// Dates around 1970
-// all tests must call a function that returns an array of TestCase object
- test();
+addNewTestCase( new Date( 1969,11,31,15,59,59),
+ "new Date( 1969,11,31,15,59,59)",
+ [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] );
-function getTestCases( ) {
+addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- // Dates around 1970
+addNewTestCase( new Date( 1969,11,31,23,59,59),
+ "new Date( 1969,11,31,23,59,59)",
+ [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] );
- addNewTestCase( new Date( 1969,11,31,15,59,59),
- "new Date( 1969,11,31,15,59,59)",
- [-1000,1969,11,31,3,23,59,59,0,1969,11,31,3,15,59,59,0] );
+addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0),
+ "new Date( 1970, 0, 1, 0, 0, 0)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( 1969,11,31,16,0,0),
- "new Date( 1969,11,31,16,0,0)",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
-
- addNewTestCase( new Date( 1969,11,31,23,59,59),
- "new Date( 1969,11,31,23,59,59)",
- [28799000,1970,0,1,4,7,59,59,0,1969,11,31,3,23,59,59,0] );
-
- addNewTestCase( new Date( 1970, 0, 1, 0, 0, 0),
- "new Date( 1970, 0, 1, 0, 0, 0)",
- [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
-
- addNewTestCase( new Date( 1969,11,31,16,0,0),
- "new Date( 1969,11,31,16,0,0)",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date( 1969,11,31,16,0,0),
+ "new Date( 1969,11,31,16,0,0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
/*
- // Dates around 2000
+// Dates around 2000
- addNewTestCase( new Date( 1999,11,31,15,59,59),
- "new Date( 1999,11,31,15,59,59)",
- [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
+addNewTestCase( new Date( 1999,11,31,15,59,59),
+"new Date( 1999,11,31,15,59,59)",
+[946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
- addNewTestCase( new Date( 1999,11,31,16,0,0),
- "new Date( 1999,11,31,16,0,0)",
- [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+addNewTestCase( new Date( 1999,11,31,16,0,0),
+"new Date( 1999,11,31,16,0,0)",
+[946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
- addNewTestCase( new Date( 2000,0,1,0,0,0),
- "new Date( 2000,0,1,0,0,0)",
- [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( 2000,0,1,0,0,0),
+"new Date( 2000,0,1,0,0,0)",
+[946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- // Dates around 1900
+// Dates around 1900
- addNewTestCase( new Date(1899,11,31,16,0,0),
- "new Date(1899,11,31,16,0,0)",
- [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1899,11,31,16,0,0),
+"new Date(1899,11,31,16,0,0)",
+[-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(1899,11,31,15,59,59),
- "new Date(1899,11,31,15,59,59)",
- [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+addNewTestCase( new Date(1899,11,31,15,59,59),
+"new Date(1899,11,31,15,59,59)",
+[-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
- addNewTestCase( new Date(1900,0,1,0,0,0),
- "new Date(1900,0,1,0,0,0)",
- [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(1900,0,1,0,0,0),
+"new Date(1900,0,1,0,0,0)",
+[-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1900,0,1,0,0,1),
- "new Date(1900,0,1,0,0,1)",
- [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+addNewTestCase( new Date(1900,0,1,0,0,1),
+"new Date(1900,0,1,0,0,1)",
+[-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
- var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
- // Dates around Feb 29, 2000
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+// Dates around Feb 29, 2000
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+"new Date(2000,1,28,16,0,0,0)",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+"new Date(2000,1,29,0,0,0,0)",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,24,0,0,0),
- "new Date(2000,1,29,24,0,0,0)",
- [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,24,0,0,0),
+"new Date(2000,1,29,24,0,0,0)",
+[PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
- // Dates around Jan 1, 2005
+// Dates around Jan 1, 2005
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings Time
+ // Daylight Savings Time
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
-
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.2-2.js b/mozilla/js/tests/ecma/Date/15.9.3.2-2.js
index d3886af7f44..65eab591836 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.2-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,201 +35,180 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var SECTION = "15.9.3.1";
- var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
- writeHeaderToLog( SECTION+" " +TITLE );
+writeHeaderToLog( SECTION+" " +TITLE );
- var testcases = new Array();
- getTestCases();
+// Dates around 2000
-// all tests must call a function that returns an array of TestCase object
- test();
+addNewTestCase( new Date( 1999,11,31,15,59,59),
+ "new Date( 1999,11,31,15,59,59)",
+ [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
-function getTestCases( ) {
+addNewTestCase( new Date( 1999,11,31,16,0,0),
+ "new Date( 1999,11,31,16,0,0)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
- // Dates around 2000
-
- addNewTestCase( new Date( 1999,11,31,15,59,59),
- "new Date( 1999,11,31,15,59,59)",
- [946684799000,1999,11,31,5,23,59,59,0,1999,11,31,5,15,59,59,0] );
-
- addNewTestCase( new Date( 1999,11,31,16,0,0),
- "new Date( 1999,11,31,16,0,0)",
- [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
-
- addNewTestCase( new Date( 2000,0,1,0,0,0),
- "new Date( 2000,0,1,0,0,0)",
- [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( 2000,0,1,0,0,0),
+ "new Date( 2000,0,1,0,0,0)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
/*
- // Dates around 1900
+// Dates around 1900
- addNewTestCase( new Date(1899,11,31,16,0,0),
- "new Date(1899,11,31,16,0,0)",
- [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(1899,11,31,16,0,0),
+"new Date(1899,11,31,16,0,0)",
+[-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(1899,11,31,15,59,59),
- "new Date(1899,11,31,15,59,59)",
- [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
+addNewTestCase( new Date(1899,11,31,15,59,59),
+"new Date(1899,11,31,15,59,59)",
+[-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
- addNewTestCase( new Date(1900,0,1,0,0,0),
- "new Date(1900,0,1,0,0,0)",
- [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(1900,0,1,0,0,0),
+"new Date(1900,0,1,0,0,0)",
+[-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1900,0,1,0,0,1),
- "new Date(1900,0,1,0,0,1)",
- [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+addNewTestCase( new Date(1900,0,1,0,0,1),
+"new Date(1900,0,1,0,0,1)",
+[-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
- var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
- // Dates around Feb 29, 2000
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+// Dates around Feb 29, 2000
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+"new Date(2000,1,28,16,0,0,0)",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+"new Date(2000,1,29,0,0,0,0)",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,24,0,0,0),
- "new Date(2000,1,29,24,0,0,0)",
- [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,24,0,0,0),
+"new Date(2000,1,29,24,0,0,0)",
+[PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
- // Dates around Jan 1, 2005
+// Dates around Jan 1, 2005
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings Time
+ // Daylight Savings Time
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
-
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.2-3.js b/mozilla/js/tests/ecma/Date/15.9.3.2-3.js
index 53a343fdff0..5e48617702c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.2-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,187 +35,166 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var SECTION = "15.9.3.1";
- var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
- writeHeaderToLog( SECTION+" " +TITLE );
+writeHeaderToLog( SECTION+" " +TITLE );
- var testcases = new Array();
- getTestCases();
+// Dates around 1900
-// all tests must call a function that returns an array of TestCase object
- test();
+addNewTestCase( new Date(1899,11,31,16,0,0),
+ "new Date(1899,11,31,16,0,0)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
-function getTestCases( ) {
+addNewTestCase( new Date(1899,11,31,15,59,59),
+ "new Date(1899,11,31,15,59,59)",
+ [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
- // Dates around 1900
+addNewTestCase( new Date(1900,0,1,0,0,0),
+ "new Date(1900,0,1,0,0,0)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(1899,11,31,16,0,0),
- "new Date(1899,11,31,16,0,0)",
- [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
-
- addNewTestCase( new Date(1899,11,31,15,59,59),
- "new Date(1899,11,31,15,59,59)",
- [-2208988801000,1899,11,31,0,23,59,59,0,1899,11,31,0,15,59,59,0] );
-
- addNewTestCase( new Date(1900,0,1,0,0,0),
- "new Date(1900,0,1,0,0,0)",
- [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
-
- addNewTestCase( new Date(1900,0,1,0,0,1),
- "new Date(1900,0,1,0,0,1)",
- [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
+addNewTestCase( new Date(1900,0,1,0,0,1),
+ "new Date(1900,0,1,0,0,1)",
+ [-2208959999000,1900,0,1,1,8,0,1,0,1900,0,1,1,0,0,1,0] );
/*
- var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+ var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+ var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
- // Dates around Feb 29, 2000
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
+ // Dates around Feb 29, 2000
+ addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+ addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(2000,1,29,24,0,0,0),
- "new Date(2000,1,29,24,0,0,0)",
- [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+ addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
- // Dates around Jan 1, 2005
+ // Dates around Jan 1, 2005
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+ var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+ TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+ var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+ addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+ addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings Time
+ // Daylight Savings Time
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
-
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.2-4.js b/mozilla/js/tests/ecma/Date/15.9.3.2-4.js
index 57641b25f42..84deba3f40d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.2-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,170 +35,148 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var SECTION = "15.9.3.1";
- var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
- writeHeaderToLog( SECTION+" " +TITLE );
+writeHeaderToLog( SECTION+" " +TITLE );
- var testcases = new Array();
- getTestCases();
+var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
-// all tests must call a function that returns an array of TestCase object
- test();
+// Dates around Feb 29, 2000
+addNewTestCase( new Date(2000,1,28,16,0,0,0),
+ "new Date(2000,1,28,16,0,0,0)",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
-function getTestCases( ) {
+addNewTestCase( new Date(2000,1,29,0,0,0,0),
+ "new Date(2000,1,29,0,0,0,0)",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
-
- var UTC_FEB_29_2000 = TIME_2000 + msPerDay*31 + msPerDay*28;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
-
- // Dates around Feb 29, 2000
- addNewTestCase( new Date(2000,1,28,16,0,0,0),
- "new Date(2000,1,28,16,0,0,0)",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0,0] );
-
- addNewTestCase( new Date(2000,1,29,0,0,0,0),
- "new Date(2000,1,29,0,0,0,0)",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
-
- addNewTestCase( new Date(2000,1,29,24,0,0,0),
- "new Date(2000,1,29,24,0,0,0)",
- [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
+addNewTestCase( new Date(2000,1,29,24,0,0,0),
+ "new Date(2000,1,29,24,0,0,0)",
+ [PST_FEB_29_2000+msPerDay,2000,2,1,3,8,0,0,0,2000,2,1,3,0,0,0,0] );
/*
- // Dates around Jan 1, 2005
+// Dates around Jan 1, 2005
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+"new Date(2005,0,1,0,0,0,0)",
+[PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+"new Date(2004,11,31,16,0,0,0)",
+[UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings Time
+ // Daylight Savings Time
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
-
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.2-5.js b/mozilla/js/tests/ecma/Date/15.9.3.2-5.js
index 53b07d059da..97aa761a1c6 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.2-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.2-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,152 +35,131 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.1.js
- ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial value of Date.prototype.
+ File Name: 15.9.3.1.js
+ ECMA Section: 15.9.3.1 new Date (year, month, date, hours, minutes, seconds, ms)
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial value of Date.prototype.
- The [[Class]] property of the newly constructed object
- is set as follows:
- 1. Call ToNumber(year)
- 2. Call ToNumber(month)
- 3. Call ToNumber(date)
- 4. Call ToNumber(hours)
- 5. Call ToNumber(minutes)
- 6. Call ToNumber(seconds)
- 7. Call ToNumber(ms)
- 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
- 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
- Result(8) is Result(1)
- 9. Compute MakeDay(Result(8), Result(2), Result(3)
- 10. Compute MakeTime(Result(4), Result(5), Result(6),
- Result(7)
- 11. Compute MakeDate(Result(9), Result(10))
- 12. Set the [[Value]] property of the newly constructed
- object to TimeClip(UTC(Result(11))).
+ The [[Class]] property of the newly constructed object
+ is set as follows:
+ 1. Call ToNumber(year)
+ 2. Call ToNumber(month)
+ 3. Call ToNumber(date)
+ 4. Call ToNumber(hours)
+ 5. Call ToNumber(minutes)
+ 6. Call ToNumber(seconds)
+ 7. Call ToNumber(ms)
+ 8. If Result(1)is NaN and 0 <= ToInteger(Result(1)) <=
+ 99, Result(8) is 1900+ToInteger(Result(1)); otherwise,
+ Result(8) is Result(1)
+ 9. Compute MakeDay(Result(8), Result(2), Result(3)
+ 10. Compute MakeTime(Result(4), Result(5), Result(6),
+ Result(7)
+ 11. Compute MakeDate(Result(9), Result(10))
+ 12. Set the [[Value]] property of the newly constructed
+ object to TimeClip(UTC(Result(11))).
- This tests the returned value of a newly constructed
- Date object.
+ This tests the returned value of a newly constructed
+ Date object.
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var SECTION = "15.9.3.1";
- var TITLE = "Date( year, month, date, hours, minutes, seconds )";
+var SECTION = "15.9.3.1";
+var TITLE = "Date( year, month, date, hours, minutes, seconds )";
- writeHeaderToLog( SECTION+" " +TITLE );
+writeHeaderToLog( SECTION+" " +TITLE );
- var testcases = new Array();
- getTestCases();
+// Dates around Jan 1, 2005
-// all tests must call a function that returns an array of TestCase object
- test();
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
-function getTestCases( ) {
+addNewTestCase( new Date(2005,0,1,0,0,0,0),
+ "new Date(2005,0,1,0,0,0,0)",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- // Dates around Jan 1, 2005
-
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002)+ TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
-
- addNewTestCase( new Date(2005,0,1,0,0,0,0),
- "new Date(2005,0,1,0,0,0,0)",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
-
- addNewTestCase( new Date(2004,11,31,16,0,0,0),
- "new Date(2004,11,31,16,0,0,0)",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(2004,11,31,16,0,0,0),
+ "new Date(2004,11,31,16,0,0,0)",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- // Daylight Savings Time
+ // Daylight Savings Time
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(1998,3,5,1,59,59,999),
- "new Date(1998,3,5,1,59,59,999)",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(1998,3,5,1,59,59,999),
+ "new Date(1998,3,5,1,59,59,999)",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(1998,3,5,2,0,0,0),
- "new Date(1998,3,5,2,0,0,0)",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(1998,3,5,2,0,0,0),
+ "new Date(1998,3,5,2,0,0,0)",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(1998,9,25,1,59,59,999),
- "new Date(1998,9,25,1,59,59,999)",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(1998,9,25,1,59,59,999),
+ "new Date(1998,9,25,1,59,59,999)",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(1998,9,25,2,0,0,0),
- "new Date(1998,9,25,2,0,0,0)",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(1998,9,25,2,0,0,0),
+ "new Date(1998,9,25,2,0,0,0)",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray);
+//adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray);
- item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
-
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
-
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
- return testcases;
-}
-
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.8-1.js b/mozilla/js/tests/ecma/Date/15.9.3.8-1.js
index 2ef5004e3af..2ae570518aa 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.8-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.8-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,281 +36,259 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.9.3.8.js
- ECMA Section: 15.9.3.8 The Date Constructor
- new Date( value )
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial valiue of Date.prototype.
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
- The [[Class]] property of the newly constructed object is
- set to "Date".
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
- The [[Value]] property of the newly constructed object is
- set as follows:
+ The [[Value]] property of the newly constructed object is
+ set as follows:
- 1. Call ToPrimitive(value)
- 2. If Type( Result(1) ) is String, then go to step 5.
- 3. Let V be ToNumber( Result(1) ).
- 4. Set the [[Value]] property of the newly constructed
- object to TimeClip(V) and return.
- 5. Parse Result(1) as a date, in exactly the same manner
- as for the parse method. Let V be the time value for
- this date.
- 6. Go to step 4.
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.3.8";
- var TYPEOF = "object";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var tc= 0;
- var TITLE = "Date constructor: new Date( value )";
- var SECTION = "15.9.3.8";
- var VERSION = "ECMA_1";
- startTest();
+var tc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION +" " + TITLE );
+writeHeaderToLog( SECTION +" " + TITLE );
- testcases = new Array();
- getTestCases();
-
-// all tests must call a function that returns a boolean value
- test();
-
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = -TZ_PST * msPerHour;
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
- // Dates around 1970
- addNewTestCase( new Date(0),
- "new Date(0)",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+// Dates around 1970
+addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date(1),
- "new Date(1)",
- [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+addNewTestCase( new Date(1),
+ "new Date(1)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
- addNewTestCase( new Date(true),
- "new Date(true)",
- [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
+addNewTestCase( new Date(true),
+ "new Date(true)",
+ [1,1970,0,1,4,0,0,0,1,1969,11,31,3,16,0,0,1] );
- addNewTestCase( new Date(false),
- "new Date(false)",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date(false),
+ "new Date(false)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date( (new Date(0)).toString() ),
- "new Date(\""+ (new Date(0)).toString()+"\" )",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date( (new Date(0)).toString() ),
+ "new Date(\""+ (new Date(0)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
/*
// addNewTestCase( "new Date(\""+ (new Date(0)).toLocaleString()+"\")", [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date((new Date(0)).toUTCString()),
- "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date((new Date(0)).toUTCString()),
+"new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+[0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date((new Date(1)).toString()),
- "new Date(\""+ (new Date(1)).toString()+"\" )",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date((new Date(1)).toString()),
+"new Date(\""+ (new Date(1)).toString()+"\" )",
+[0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date( TZ_ADJUST ),
- "new Date(" + TZ_ADJUST+")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date( TZ_ADJUST ),
+"new Date(" + TZ_ADJUST+")",
+[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
- "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+"new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
// addNewTestCase( "new Date(\""+ (new Date(TZ_ADJUST)).toLocaleString()+"\")",[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
- "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+"new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+[TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- // Dates around 2000
+// Dates around 2000
- addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
- "new Date(" +(TIME_2000+TZ_ADJUST)+")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+"new Date(" +(TIME_2000+TZ_ADJUST)+")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(TIME_2000),
- "new Date(" +TIME_2000+")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(TIME_2000),
+"new Date(" +TIME_2000+")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+"new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date((new Date(TIME_2000)).toString()),
- "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+"new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+"new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+"new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- // Dates around Feb 29, 2000
+// Dates around Feb 29, 2000
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
- addNewTestCase( new Date(UTC_FEB_29_2000),
- "new Date("+UTC_FEB_29_2000+")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date(UTC_FEB_29_2000),
+"new Date("+UTC_FEB_29_2000+")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date(PST_FEB_29_2000),
- "new Date("+PST_FEB_29_2000+")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(PST_FEB_29_2000),
+"new Date("+PST_FEB_29_2000+")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
// Parsing toLocaleString() is not guaranteed by ECMA.
// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- // Dates around 1900
+// Dates around 1900
- var PST_1900 = TIME_1900 + 8*msPerHour;
+var PST_1900 = TIME_1900 + 8*msPerHour;
- addNewTestCase( new Date( TIME_1900 ),
- "new Date("+TIME_1900+")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( TIME_1900 ),
+"new Date("+TIME_1900+")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(PST_1900),
- "new Date("+PST_1900+")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(PST_1900),
+"new Date("+PST_1900+")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
- "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+"new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
- "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+"new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
- "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+"new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
- "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+"new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(DST_START_1998-1),
- "new Date("+(DST_START_1998-1)+")",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(DST_START_1998),
- "new Date("+DST_START_1998+")",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(DST_END_1998-1),
- "new Date("+(DST_END_1998-1)+")",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(DST_END_1998),
- "new Date("+DST_END_1998+")",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray, 'msMode');
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
- item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.8-2.js b/mozilla/js/tests/ecma/Date/15.9.3.8-2.js
index 5407e1e1fbc..454060e625f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.8-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.8-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,256 +36,233 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.9.3.8.js
- ECMA Section: 15.9.3.8 The Date Constructor
- new Date( value )
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial valiue of Date.prototype.
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
- The [[Class]] property of the newly constructed object is
- set to "Date".
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
- The [[Value]] property of the newly constructed object is
- set as follows:
+ The [[Value]] property of the newly constructed object is
+ set as follows:
- 1. Call ToPrimitive(value)
- 2. If Type( Result(1) ) is String, then go to step 5.
- 3. Let V be ToNumber( Result(1) ).
- 4. Set the [[Value]] property of the newly constructed
- object to TimeClip(V) and return.
- 5. Parse Result(1) as a date, in exactly the same manner
- as for the parse method. Let V be the time value for
- this date.
- 6. Go to step 4.
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.3.8";
- var TYPEOF = "object";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var tc= 0;
- var TITLE = "Date constructor: new Date( value )";
- var SECTION = "15.9.3.8";
- var VERSION = "ECMA_1";
- startTest();
+var tc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION +" " + TITLE );
+writeHeaderToLog( SECTION +" " + TITLE );
- testcases = new Array();
- getTestCases();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
-// all tests must call a function that returns a boolean value
- test();
+addNewTestCase( new Date((new Date(0)).toUTCString()),
+ "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = -TZ_PST * msPerHour;
+addNewTestCase( new Date((new Date(1)).toString()),
+ "new Date(\""+ (new Date(1)).toString()+"\" )",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- addNewTestCase( new Date((new Date(0)).toUTCString()),
- "new Date(\""+ (new Date(0)).toUTCString()+"\" )",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+addNewTestCase( new Date( TZ_ADJUST ),
+ "new Date(" + TZ_ADJUST+")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date((new Date(1)).toString()),
- "new Date(\""+ (new Date(1)).toString()+"\" )",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
-
- addNewTestCase( new Date( TZ_ADJUST ),
- "new Date(" + TZ_ADJUST+")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
-
- addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
- "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date((new Date(TZ_ADJUST)).toString()),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
- "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
- [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TZ_ADJUST)).toUTCString() ),
+ "new Date(\""+ (new Date(TZ_ADJUST)).toUTCString()+"\")",
+ [TZ_ADJUST,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
/*
- // Dates around 2000
+// Dates around 2000
- addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
- "new Date(" +(TIME_2000+TZ_ADJUST)+")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+"new Date(" +(TIME_2000+TZ_ADJUST)+")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(TIME_2000),
- "new Date(" +TIME_2000+")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(TIME_2000),
+"new Date(" +TIME_2000+")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+"new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date((new Date(TIME_2000)).toString()),
- "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+"new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
// addNewTestCase( "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toLocaleString()+"\")", [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
// addNewTestCase( "new Date(\"" +(new Date(TIME_2000)).toLocaleString()+"\")", [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+"new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+[TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+"new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+[TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- // Dates around Feb 29, 2000
+// Dates around Feb 29, 2000
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
- addNewTestCase( new Date(UTC_FEB_29_2000),
- "new Date("+UTC_FEB_29_2000+")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date(UTC_FEB_29_2000),
+"new Date("+UTC_FEB_29_2000+")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date(PST_FEB_29_2000),
- "new Date("+PST_FEB_29_2000+")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(PST_FEB_29_2000),
+"new Date("+PST_FEB_29_2000+")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
// Parsing toLocaleString() is not guaranteed by ECMA.
// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- // Dates around 1900
+// Dates around 1900
- var PST_1900 = TIME_1900 + 8*msPerHour;
+var PST_1900 = TIME_1900 + 8*msPerHour;
- addNewTestCase( new Date( TIME_1900 ),
- "new Date("+TIME_1900+")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( TIME_1900 ),
+"new Date("+TIME_1900+")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(PST_1900),
- "new Date("+PST_1900+")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(PST_1900),
+"new Date("+PST_1900+")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
- "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+"new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
- "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+"new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
- "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+"new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
- "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+"new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(DST_START_1998-1),
- "new Date("+(DST_START_1998-1)+")",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(DST_START_1998),
- "new Date("+DST_START_1998+")",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(DST_END_1998-1),
- "new Date("+(DST_END_1998-1)+")",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(DST_END_1998),
- "new Date("+DST_END_1998+")",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray, 'msMode');
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
- item = testcases.length;
-
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.8-3.js b/mozilla/js/tests/ecma/Date/15.9.3.8-3.js
index 8d453ab9128..05b513c76a6 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.8-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.8-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,235 +35,213 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.8.js
- ECMA Section: 15.9.3.8 The Date Constructor
- new Date( value )
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial valiue of Date.prototype.
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
- The [[Class]] property of the newly constructed object is
- set to "Date".
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
- The [[Value]] property of the newly constructed object is
- set as follows:
+ The [[Value]] property of the newly constructed object is
+ set as follows:
- 1. Call ToPrimitive(value)
- 2. If Type( Result(1) ) is String, then go to step 5.
- 3. Let V be ToNumber( Result(1) ).
- 4. Set the [[Value]] property of the newly constructed
- object to TimeClip(V) and return.
- 5. Parse Result(1) as a date, in exactly the same manner
- as for the parse method. Let V be the time value for
- this date.
- 6. Go to step 4.
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.3.8";
- var TYPEOF = "object";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var tc= 0;
- var TITLE = "Date constructor: new Date( value )";
- var SECTION = "15.9.3.8";
- var VERSION = "ECMA_1";
- startTest();
+var tc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION +" " + TITLE );
+writeHeaderToLog( SECTION +" " + TITLE );
- testcases = new Array();
- getTestCases();
-
-// all tests must call a function that returns a boolean value
- test();
-
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = -TZ_PST * msPerHour;
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
- // Dates around 2000
+// Dates around 2000
- addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
- "new Date(" +(TIME_2000+TZ_ADJUST)+")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(TIME_2000+TZ_ADJUST),
+ "new Date(" +(TIME_2000+TZ_ADJUST)+")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date(TIME_2000),
- "new Date(" +TIME_2000+")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(TIME_2000),
+ "new Date(" +TIME_2000+")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date((new Date(TIME_2000)).toString()),
- "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date((new Date(TIME_2000)).toString()),
+ "new Date(\"" +(new Date(TIME_2000)).toString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
- [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000+TZ_ADJUST)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000+TZ_ADJUST)).toUTCString()+"\")",
+ [TIME_2000+TZ_ADJUST,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
- "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
- [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_2000)).toUTCString()),
+ "new Date(\"" +(new Date(TIME_2000)).toUTCString()+"\")",
+ [TIME_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
/*
- // Dates around Feb 29, 2000
+// Dates around Feb 29, 2000
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
- addNewTestCase( new Date(UTC_FEB_29_2000),
- "new Date("+UTC_FEB_29_2000+")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date(UTC_FEB_29_2000),
+"new Date("+UTC_FEB_29_2000+")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date(PST_FEB_29_2000),
- "new Date("+PST_FEB_29_2000+")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date(PST_FEB_29_2000),
+"new Date("+PST_FEB_29_2000+")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
// Parsing toLocaleString() is not guaranteed by ECMA.
// addNewTestCase( "new Date(\""+(new Date(UTC_FEB_29_2000)).toLocaleString()+"\")", [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_FEB_29_2000)).toLocaleString()+"\")", [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+[UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+"new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+[PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- // Dates around 1900
+// Dates around 1900
- var PST_1900 = TIME_1900 + 8*msPerHour;
+var PST_1900 = TIME_1900 + 8*msPerHour;
- addNewTestCase( new Date( TIME_1900 ),
- "new Date("+TIME_1900+")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( TIME_1900 ),
+"new Date("+TIME_1900+")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(PST_1900),
- "new Date("+PST_1900+")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(PST_1900),
+"new Date("+PST_1900+")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
- "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+"new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
- "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+"new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
- "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+"new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
- "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+"new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(DST_START_1998-1),
- "new Date("+(DST_START_1998-1)+")",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(DST_START_1998),
- "new Date("+DST_START_1998+")",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(DST_END_1998-1),
- "new Date("+(DST_END_1998-1)+")",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(DST_END_1998),
- "new Date("+DST_END_1998+")",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray, 'msMode');
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
- item = testcases.length;
-
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.8-4.js b/mozilla/js/tests/ecma/Date/15.9.3.8-4.js
index 8dbca982e97..b2525fc200e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.8-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.8-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,204 +35,182 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.8.js
- ECMA Section: 15.9.3.8 The Date Constructor
- new Date( value )
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial valiue of Date.prototype.
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
- The [[Class]] property of the newly constructed object is
- set to "Date".
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
- The [[Value]] property of the newly constructed object is
- set as follows:
+ The [[Value]] property of the newly constructed object is
+ set as follows:
- 1. Call ToPrimitive(value)
- 2. If Type( Result(1) ) is String, then go to step 5.
- 3. Let V be ToNumber( Result(1) ).
- 4. Set the [[Value]] property of the newly constructed
- object to TimeClip(V) and return.
- 5. Parse Result(1) as a date, in exactly the same manner
- as for the parse method. Let V be the time value for
- this date.
- 6. Go to step 4.
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.3.8";
- var TYPEOF = "object";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var tc= 0;
- var TITLE = "Date constructor: new Date( value )";
- var SECTION = "15.9.3.8";
- var VERSION = "ECMA_1";
- startTest();
+var tc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION +" " + TITLE );
+writeHeaderToLog( SECTION +" " + TITLE );
- testcases = new Array();
- getTestCases();
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
-// all tests must call a function that returns a boolean value
- test();
+// Dates around Feb 29, 2000
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = -TZ_PST * msPerHour;
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
- // Dates around Feb 29, 2000
+addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date("+UTC_FEB_29_2000+")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + TZ_ADJUST;
+addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date("+PST_FEB_29_2000+")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date(UTC_FEB_29_2000),
- "new Date("+UTC_FEB_29_2000+")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date(PST_FEB_29_2000),
- "new Date("+PST_FEB_29_2000+")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
-
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
-
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
- addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
- [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
+addNewTestCase( new Date( (new Date(UTC_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(UTC_FEB_29_2000)).toGMTString()+"\")",
+ [UTC_FEB_29_2000,2000,1,29,2,0,0,0,0,2000,1,28,1,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
- "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
- [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_FEB_29_2000)).toGMTString() ),
+ "new Date(\""+(new Date(PST_FEB_29_2000)).toGMTString()+"\")",
+ [PST_FEB_29_2000,2000,1,29,2,8,0,0,0,2000,1,29,2,0,0,0,0] );
/*
- // Dates around 1900
+// Dates around 1900
- var PST_1900 = TIME_1900 + 8*msPerHour;
+var PST_1900 = TIME_1900 + 8*msPerHour;
- addNewTestCase( new Date( TIME_1900 ),
- "new Date("+TIME_1900+")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( TIME_1900 ),
+"new Date("+TIME_1900+")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(PST_1900),
- "new Date("+PST_1900+")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(PST_1900),
+"new Date("+PST_1900+")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
- "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+"new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
- "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+"new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
- "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+"new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+[TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
- "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+"new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+[ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(TIME_1900)).toLocaleString()+"\")", [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
// addNewTestCase( "new Date(\""+(new Date(PST_1900 )).toLocaleString()+"\")", [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
*/
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(DST_START_1998-1),
- "new Date("+(DST_START_1998-1)+")",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(DST_START_1998),
- "new Date("+DST_START_1998+")",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(DST_END_1998-1),
- "new Date("+(DST_END_1998-1)+")",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(DST_END_1998),
- "new Date("+DST_END_1998+")",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray, 'msMode');
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
- item = testcases.length;
-
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.3.8-5.js b/mozilla/js/tests/ecma/Date/15.9.3.8-5.js
index a9c7a93dc56..39aa91c6244 100644
--- a/mozilla/js/tests/ecma/Date/15.9.3.8-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.3.8-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,172 +35,150 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.3.8.js
- ECMA Section: 15.9.3.8 The Date Constructor
- new Date( value )
- Description: The [[Prototype]] property of the newly constructed
- object is set to the original Date prototype object,
- the one that is the initial valiue of Date.prototype.
+ File Name: 15.9.3.8.js
+ ECMA Section: 15.9.3.8 The Date Constructor
+ new Date( value )
+ Description: The [[Prototype]] property of the newly constructed
+ object is set to the original Date prototype object,
+ the one that is the initial valiue of Date.prototype.
- The [[Class]] property of the newly constructed object is
- set to "Date".
+ The [[Class]] property of the newly constructed object is
+ set to "Date".
- The [[Value]] property of the newly constructed object is
- set as follows:
+ The [[Value]] property of the newly constructed object is
+ set as follows:
- 1. Call ToPrimitive(value)
- 2. If Type( Result(1) ) is String, then go to step 5.
- 3. Let V be ToNumber( Result(1) ).
- 4. Set the [[Value]] property of the newly constructed
- object to TimeClip(V) and return.
- 5. Parse Result(1) as a date, in exactly the same manner
- as for the parse method. Let V be the time value for
- this date.
- 6. Go to step 4.
+ 1. Call ToPrimitive(value)
+ 2. If Type( Result(1) ) is String, then go to step 5.
+ 3. Let V be ToNumber( Result(1) ).
+ 4. Set the [[Value]] property of the newly constructed
+ object to TimeClip(V) and return.
+ 5. Parse Result(1) as a date, in exactly the same manner
+ as for the parse method. Let V be the time value for
+ this date.
+ 6. Go to step 4.
- Author: christine@netscape.com
- Date: 28 october 1997
- Version: 9706
+ Author: christine@netscape.com
+ Date: 28 october 1997
+ Version: 9706
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.3.8";
- var TYPEOF = "object";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.3.8";
+var TYPEOF = "object";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
// for TCMS, the testcases array must be global.
- var tc= 0;
- var TITLE = "Date constructor: new Date( value )";
- var SECTION = "15.9.3.8";
- var VERSION = "ECMA_1";
- startTest();
+var tc= 0;
+var TITLE = "Date constructor: new Date( value )";
+var SECTION = "15.9.3.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION +" " + TITLE );
+writeHeaderToLog( SECTION +" " + TITLE );
- testcases = new Array();
- getTestCases();
-
-// all tests must call a function that returns a boolean value
- test();
-
-function getTestCases( ) {
- // all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
- var TZ_ADJUST = -TZ_PST * msPerHour;
+// all the "ResultArrays" below are hard-coded to Pacific Standard Time values -
+var TZ_ADJUST = -TZ_PST * msPerHour;
- // Dates around 1900
+// Dates around 1900
- var PST_1900 = TIME_1900 + 8*msPerHour;
+var PST_1900 = TIME_1900 + 8*msPerHour;
- addNewTestCase( new Date( TIME_1900 ),
- "new Date("+TIME_1900+")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( TIME_1900 ),
+ "new Date("+TIME_1900+")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date(PST_1900),
- "new Date("+PST_1900+")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(PST_1900),
+ "new Date("+PST_1900+")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
- "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toString() ),
+ "new Date(\""+(new Date(TIME_1900)).toString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
- "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toString() ),
+ "new Date(\""+(new Date(PST_1900 )).toString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
- "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
- [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date( (new Date(TIME_1900)).toUTCString() ),
+ "new Date(\""+(new Date(TIME_1900)).toUTCString()+"\")",
+ [TIME_1900,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
- "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
- [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date( (new Date(PST_1900)).toUTCString() ),
+ "new Date(\""+(new Date(PST_1900 )).toUTCString()+"\")",
+ [ PST_1900,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
/*
- This test case is incorrect. Need to fix the DaylightSavings functions in
- shell.js for this to work properly.
+ This test case is incorrect. Need to fix the DaylightSavings functions in
+ shell.js for this to work properly.
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- addNewTestCase( new Date(DST_START_1998-1),
- "new Date("+(DST_START_1998-1)+")",
- [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
+ addNewTestCase( new Date(DST_START_1998-1),
+ "new Date("+(DST_START_1998-1)+")",
+ [DST_START_1998-1,1998,3,5,0,9,59,59,999,1998,3,5,0,1,59,59,999] );
- addNewTestCase( new Date(DST_START_1998),
- "new Date("+DST_START_1998+")",
- [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
+ addNewTestCase( new Date(DST_START_1998),
+ "new Date("+DST_START_1998+")",
+ [DST_START_1998,1998,3,5,0,10,0,0,0,1998,3,5,0,3,0,0,0]);
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- addNewTestCase ( new Date(DST_END_1998-1),
- "new Date("+(DST_END_1998-1)+")",
- [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
+ addNewTestCase ( new Date(DST_END_1998-1),
+ "new Date("+(DST_END_1998-1)+")",
+ [DST_END_1998-1,1998,9,25,0,8,59,59,999,1998,9,25,0,1,59,59,999] );
- addNewTestCase ( new Date(DST_END_1998),
- "new Date("+DST_END_1998+")",
- [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
+ addNewTestCase ( new Date(DST_END_1998),
+ "new Date("+DST_END_1998+")",
+ [DST_END_1998,1998,9,25,0,9,0,0,0,1998,9,25,0,1,0,0,0] );
*/
-}
+
+test();
function addNewTestCase( DateCase, DateString, ResultArray ) {
- //adjust hard-coded ResultArray for tester's timezone instead of PST
- adjustResultArray(ResultArray, 'msMode');
+ //adjust hard-coded ResultArray for tester's timezone instead of PST
+ adjustResultArray(ResultArray, 'msMode');
- item = testcases.length;
-
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
-}
-
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", ResultArray[UTC_HOURS], DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", ResultArray[UTC_MINUTES],DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.4.2-1.js b/mozilla/js/tests/ecma/Date/15.9.4.2-1.js
index 96623f91f3b..98b62780e5e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.4.2-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.4.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -50,29 +51,29 @@
* Author: christine@netscape.com
*/
- var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
- var VERSION = "ECMA"; // Version of JavaScript or ECMA
- var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
- var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
+var SECTION = "15.9.4.2-1"; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA"; // Version of JavaScript or ECMA
+var TITLE = "Regression Test for Date.parse"; // Provide ECMA section title or a description
+var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=4088"; // Provide URL to bugsplat or bugzilla report
- startTest(); // leave this alone
+startTest(); // leave this alone
- AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
- new Date(1999,0,1,0,30).toString(),
- new Date('1/1/1999 12:30 AM').toString() );
+AddTestCase( "new Date('1/1/1999 12:30 AM').toString()",
+ new Date(1999,0,1,0,30).toString(),
+ new Date('1/1/1999 12:30 AM').toString() );
- AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
- new Date( 1999,0,1,12,30 ).toString(),
- new Date('1/1/1999 12:30 PM').toString() );
+AddTestCase( "new Date('1/1/1999 12:30 PM').toString()",
+ new Date( 1999,0,1,12,30 ).toString(),
+ new Date('1/1/1999 12:30 PM').toString() );
- AddTestCase( "new Date('1/1/1999 13:30 AM')",
- "Invalid Date",
- new Date('1/1/1999 13:30 AM').toString() );
+AddTestCase( "new Date('1/1/1999 13:30 AM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 AM').toString() );
- AddTestCase( "new Date('1/1/1999 13:30 PM')",
- "Invalid Date",
- new Date('1/1/1999 13:30 PM').toString() );
+AddTestCase( "new Date('1/1/1999 13:30 PM')",
+ "Invalid Date",
+ new Date('1/1/1999 13:30 PM').toString() );
- test(); // leave this alone. this executes the test cases and
- // displays results.
+test(); // leave this alone. this executes the test cases and
+// displays results.
diff --git a/mozilla/js/tests/ecma/Date/15.9.4.2.js b/mozilla/js/tests/ecma/Date/15.9.4.2.js
index c2d2783987a..c45a066b3a3 100644
--- a/mozilla/js/tests/ecma/Date/15.9.4.2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.4.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,195 +35,175 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.4.2.js
- ECMA Section: 15.9.4.2 Date.parse()
- Description: The parse() function applies the to ToString() operator
- to its argument and interprets the resulting string as
- a date. It returns a number, the UTC time value
- corresponding to the date.
+ File Name: 15.9.4.2.js
+ ECMA Section: 15.9.4.2 Date.parse()
+ Description: The parse() function applies the to ToString() operator
+ to its argument and interprets the resulting string as
+ a date. It returns a number, the UTC time value
+ corresponding to the date.
- The string may be interpreted as a local time, a UTC
- time, or a time in some other time zone, depending on
- the contents of the string.
+ The string may be interpreted as a local time, a UTC
+ time, or a time in some other time zone, depending on
+ the contents of the string.
- (need to test strings containing stuff with the time
- zone specified, and verify that parse() returns the
- correct GMT time)
+ (need to test strings containing stuff with the time
+ zone specified, and verify that parse() returns the
+ correct GMT time)
- so for any Date object x, all of these things should
- be equal:
+ so for any Date object x, all of these things should
+ be equal:
- value tested in function:
- x.valueOf() test_value()
- Date.parse(x.toString()) test_tostring()
- Date.parse(x.toGMTString()) test_togmt()
+ value tested in function:
+ x.valueOf() test_value()
+ Date.parse(x.toString()) test_tostring()
+ Date.parse(x.toGMTString()) test_togmt()
- Date.parse(x.toLocaleString()) is not required to
- produce the same number value as the preceeding three
- expressions. in general the value produced by
- Date.parse is implementation dependent when given any
- string value that could not be produced in that
- implementation by the toString or toGMTString method.
+ Date.parse(x.toLocaleString()) is not required to
+ produce the same number value as the preceeding three
+ expressions. in general the value produced by
+ Date.parse is implementation dependent when given any
+ string value that could not be produced in that
+ implementation by the toString or toGMTString method.
- value tested in function:
- Date.parse( x.toLocaleString()) test_tolocale()
+ value tested in function:
+ Date.parse( x.toLocaleString()) test_tolocale()
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.9.4.2";
- var TITLE = "Date.parse()";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.9.4.2";
+var TITLE = "Date.parse()";
- var TIME = 0;
- var UTC_YEAR = 1;
- var UTC_MONTH = 2;
- var UTC_DATE = 3;
- var UTC_DAY = 4;
- var UTC_HOURS = 5;
- var UTC_MINUTES = 6;
- var UTC_SECONDS = 7;
- var UTC_MS = 8;
+var TIME = 0;
+var UTC_YEAR = 1;
+var UTC_MONTH = 2;
+var UTC_DATE = 3;
+var UTC_DAY = 4;
+var UTC_HOURS = 5;
+var UTC_MINUTES = 6;
+var UTC_SECONDS = 7;
+var UTC_MS = 8;
- var YEAR = 9;
- var MONTH = 10;
- var DATE = 11;
- var DAY = 12;
- var HOURS = 13;
- var MINUTES = 14;
- var SECONDS = 15;
- var MS = 16;
- var TYPEOF = "object";
+var YEAR = 9;
+var MONTH = 10;
+var DATE = 11;
+var DAY = 12;
+var HOURS = 13;
+var MINUTES = 14;
+var SECONDS = 15;
+var MS = 16;
+var TYPEOF = "object";
// for TCMS, the testcases array must be global.
- writeHeaderToLog("15.9.4.2 Date.parse()" );
- var tc= 0;
- testcases = new Array();
- getTestCases();
+writeHeaderToLog("15.9.4.2 Date.parse()" );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+// Dates around 1970
-function getTestCases() {
+addNewTestCase( new Date(0),
+ "new Date(0)",
+ [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
- // Dates around 1970
+addNewTestCase( new Date(-1),
+ "new Date(-1)",
+ [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
+addNewTestCase( new Date(28799999),
+ "new Date(28799999)",
+ [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
+addNewTestCase( new Date(28800000),
+ "new Date(28800000)",
+ [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
- addNewTestCase( new Date(0),
- "new Date(0)",
- [0,1970,0,1,4,0,0,0,0,1969,11,31,3,16,0,0,0] );
+// Dates around 2000
- addNewTestCase( new Date(-1),
- "new Date(-1)",
- [-1,1969,11,31,3,23,59,59,999,1969,11,31,3,15,59,59,999] );
- addNewTestCase( new Date(28799999),
- "new Date(28799999)",
- [28799999,1970,0,1,4,7,59,59,999,1969,11,31,3,23,59,59,999] );
- addNewTestCase( new Date(28800000),
- "new Date(28800000)",
- [28800000,1970,0,1,4,8,0,0,0,1970,0,1,4,0,0,0,0] );
+addNewTestCase( new Date(946684799999),
+ "new Date(946684799999)",
+ [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
+addNewTestCase( new Date(946713599999),
+ "new Date(946713599999)",
+ [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
+addNewTestCase( new Date(946684800000),
+ "new Date(946684800000)",
+ [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
+addNewTestCase( new Date(946713600000),
+ "new Date(946713600000)",
+ [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
- // Dates around 2000
+// Dates around 1900
- addNewTestCase( new Date(946684799999),
- "new Date(946684799999)",
- [946684799999,1999,11,31,5,23,59,59,999,1999,11,31,5,15,59,59,999] );
- addNewTestCase( new Date(946713599999),
- "new Date(946713599999)",
- [946713599999,2000,0,1,6,7,59,59,999,1999,11,31,5,23,59,59,999] );
- addNewTestCase( new Date(946684800000),
- "new Date(946684800000)",
- [946684800000,2000,0,1,6,0,0,0,0,1999,11,31,5, 16,0,0,0] );
- addNewTestCase( new Date(946713600000),
- "new Date(946713600000)",
- [946713600000,2000,0,1,6,8,0,0,0,2000,0,1,6,0,0,0,0] );
+addNewTestCase( new Date(-2208988800000),
+ "new Date(-2208988800000)",
+ [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
- // Dates around 1900
+addNewTestCase( new Date(-2208988800001),
+ "new Date(-2208988800001)",
+ [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
- addNewTestCase( new Date(-2208988800000),
- "new Date(-2208988800000)",
- [-2208988800000,1900,0,1,1,0,0,0,0,1899,11,31,0,16,0,0,0] );
+addNewTestCase( new Date(-2208960000001),
+ "new Date(-2208960000001)",
+ [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] );
+addNewTestCase( new Date(-2208960000000),
+ "new Date(-2208960000000)",
+ [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
+addNewTestCase( new Date(-2208959999999),
+ "new Date(-2208959999999)",
+ [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
- addNewTestCase( new Date(-2208988800001),
- "new Date(-2208988800001)",
- [-2208988800001,1899,11,31,0,23,59,59,999,1899,11,31,0,15,59,59,999] );
+// Dates around Feb 29, 2000
- addNewTestCase( new Date(-2208960000001),
- "new Date(-2208960000001)",
- [-2208960000001,1900,0,1,1,7,59,59,0,1899,11,31,0,23,59,59,999] );
- addNewTestCase( new Date(-2208960000000),
- "new Date(-2208960000000)",
- [-2208960000000,1900,0,1,1,8,0,0,0,1900,0,1,1,0,0,0,0] );
- addNewTestCase( new Date(-2208959999999),
- "new Date(-2208959999999)",
- [-2208959999999,1900,0,1,1,8,0,0,1,1900,0,1,1,0,0,0,1] );
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
+addNewTestCase( new Date(UTC_FEB_29_2000),
+ "new Date(" + UTC_FEB_29_2000 +")",
+ [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(PST_FEB_29_2000),
+ "new Date(" + PST_FEB_29_2000 +")",
+ [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]);
- // Dates around Feb 29, 2000
+// Dates around Jan 1 2005
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var PST_FEB_29_2000 = UTC_FEB_29_2000 + 8*msPerHour;
- addNewTestCase( new Date(UTC_FEB_29_2000),
- "new Date(" + UTC_FEB_29_2000 +")",
- [UTC_FEB_29_2000,2000,0,1,6,0,0,0,0,1999,11,31,5,16,0,0,0] );
- addNewTestCase( new Date(PST_FEB_29_2000),
- "new Date(" + PST_FEB_29_2000 +")",
- [PST_FEB_29_2000,2000,0,1,6,8.0,0,0,2000,0,1,6,0,0,0,0]);
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- // Dates around Jan 1 2005
+addNewTestCase( new Date(UTC_JAN_1_2005),
+ "new Date("+ UTC_JAN_1_2005 +")",
+ [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
+addNewTestCase( new Date(PST_JAN_1_2005),
+ "new Date("+ PST_JAN_1_2005 +")",
+ [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- var PST_JAN_1_2005 = UTC_JAN_1_2005 + 8*msPerHour;
- addNewTestCase( new Date(UTC_JAN_1_2005),
- "new Date("+ UTC_JAN_1_2005 +")",
- [UTC_JAN_1_2005,2005,0,1,6,0,0,0,0,2004,11,31,5,16,0,0,0] );
- addNewTestCase( new Date(PST_JAN_1_2005),
- "new Date("+ PST_JAN_1_2005 +")",
- [PST_JAN_1_2005,2005,0,1,6,8,0,0,0,2005,0,1,6,0,0,0,0] );
+test();
-}
function addNewTestCase( DateCase, DateString, ResultArray ) {
- DateCase = DateCase;
+ DateCase = DateCase;
- item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) );
- testcases[item++] = new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) );
+ new TestCase( SECTION, DateString+".getTime()", ResultArray[TIME], DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", ResultArray[TIME], DateCase.valueOf() );
+ new TestCase( SECTION, "Date.parse(" + DateCase.toString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toString()) );
+ new TestCase( SECTION, "Date.parse(" + DateCase.toGMTString() +")", Math.floor(ResultArray[TIME]/1000)*1000, Date.parse(DateCase.toGMTString()) );
/*
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() z inutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", ResultArray[UTC_YEAR], DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", ResultArray[UTC_MONTH], DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", ResultArray[UTC_DATE], DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", ResultArray[UTC_DAY], DateCase.getUTCDay() z inutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", ResultArray[UTC_SECONDS],DateCase.getUTCSeconds() );
+// new TestCase( SECTION, DateString+".getUTCMilliseconds()", ResultArray[UTC_MS], DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
+new TestCase( SECTION, DateString+".getFullYear()", ResultArray[YEAR], DateCase.getFullYear() );
+new TestCase( SECTION, DateString+".getMonth()", ResultArray[MONTH], DateCase.getMonth() );
+new TestCase( SECTION, DateString+".getDate()", ResultArray[DATE], DateCase.getDate() );
+new TestCase( SECTION, DateString+".getDay()", ResultArray[DAY], DateCase.getDay() );
+new TestCase( SECTION, DateString+".getHours()", ResultArray[HOURS], DateCase.getHours() );
+new TestCase( SECTION, DateString+".getMinutes()", ResultArray[MINUTES], DateCase.getMinutes() );
+new TestCase( SECTION, DateString+".getSeconds()", ResultArray[SECONDS], DateCase.getSeconds() );
+// new TestCase( SECTION, DateString+".getMilliseconds()", ResultArray[MS], DateCase.getMilliseconds() );
*/
}
-function test() {
- for( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.4.3.js b/mozilla/js/tests/ecma/Date/15.9.4.3.js
index b9e84ce1e25..5d619924de4 100644
--- a/mozilla/js/tests/ecma/Date/15.9.4.3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.4.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -36,189 +37,172 @@
* ***** END LICENSE BLOCK ***** */
- var testcases = new Array();
- var SECTION = "15.9.4.3";
- var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";
+var testcases = new Array();
+var SECTION = "15.9.4.3";
+var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";
- getTestCases();
- test();
+// Dates around 1970
-function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
-}
+addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
+ "Date.UTC( 1970,0,1,0,0,0,0)",
+ utc(1970,0,1,0,0,0,0) );
-function utc( year, month, date, hours, minutes, seconds, ms ) {
- d = new MyDate();
- d.year = Number(year);
+addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
+ "Date.UTC( 1969,11,31,23,59,59,999)",
+ utc(1969,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
+ "Date.UTC( 1972,1,29,23,59,59,999)",
+ utc(1972,1,29,23,59,59,999) );
+addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
+ "Date.UTC( 1972,2,1,23,59,59,999)",
+ utc(1972,2,1,23,59,59,999) );
+addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
+ "Date.UTC( 1968,1,29,23,59,59,999)",
+ utc(1968,1,29,23,59,59,999) );
+addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
+ "Date.UTC( 1968,2,1,23,59,59,999)",
+ utc(1968,2,1,23,59,59,999) );
+addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
+ "Date.UTC( 1969,0,1,0,0,0,0)",
+ utc(1969,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
+ "Date.UTC( 1969,11,31,23,59,59,1000)",
+ utc(1970,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
+ "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
+ utc(1969,Number.NaN,31,23,59,59,999) );
- if (month)
- d.month = Number(month);
- if (date)
- d.date = Number(date);
- if (hours)
- d.hours = Number(hours);
- if (minutes)
- d.minutes = Number(minutes);
- if (seconds)
- d.seconds = Number(seconds);
- if (ms)
- d.ms = Number(ms);
+// Dates around 2000
- if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
- d.year = 1900 + ToInteger(d.year);
- }
+addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
+ "Date.UTC( 1999,11,31,23,59,59,999)",
+ utc(1999,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
+ "Date.UTC( 2000,0,1,0,0,0,0)",
+ utc(2000,0,1,0,0,0,0) );
- if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
- isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
- d.year = Number.NaN;
- d.month = Number.NaN;
- d.date = Number.NaN;
- d.hours = Number.NaN;
- d.minutes = Number.NaN;
- d.seconds = Number.NaN;
- d.ms = Number.NaN;
- d.value = Number.NaN;
- d.time = Number.NaN;
- d.day =Number.NaN;
- return d;
- }
+// Dates around 1900
+addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
+ "Date.UTC( 1899,11,31,23,59,59,999)",
+ utc(1899,11,31,23,59,59,999) );
+addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
+ "Date.UTC( 1900,0,1,0,0,0,0)",
+ utc(1900,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
+ "Date.UTC( 1973,0,1,0,0,0,0)",
+ utc(1973,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
+ "Date.UTC( 1776,6,4,12,36,13,111)",
+ utc(1776,6,4,12,36,13,111) );
+addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
+ "Date.UTC( 2525,9,18,15,30,1,123)",
+ utc(2525,9,18,15,30,1,123) );
- d.day = MakeDay( d.year, d.month, d.date );
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = (TimeClip( MakeDate(d.day,d.time)));
+// Dates around 29 Feb 2000
- return d;
-}
+addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
+ "Date.UTC( 2000,1,29,0,0,0,0 )",
+ utc(2000,1,29,0,0,0,0) );
+addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
+ "Date.UTC( 2000,1,29,8,0,0,0 )",
+ utc(2000,1,29,8,0,0,0) );
-function UTCTime( t ) {
- sign = ( t < 0 ) ? -1 : 1;
- return ( (t +(TZ_DIFF*msPerHour)) );
-}
+// Dates around 1 Jan 2005
-function getTestCases() {
+addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
+ "Date.UTC( 2005,0,1,0,0,0,0 )",
+ utc(2005,0,1,0,0,0,0) );
+addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
+ "Date.UTC( 2004,11,31,16,0,0,0 )",
+ utc(2004,11,31,16,0,0,0) );
- // Dates around 1970
-
- addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
- "Date.UTC( 1970,0,1,0,0,0,0)",
- utc(1970,0,1,0,0,0,0) );
-
- addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
- "Date.UTC( 1969,11,31,23,59,59,999)",
- utc(1969,11,31,23,59,59,999) );
- addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
- "Date.UTC( 1972,1,29,23,59,59,999)",
- utc(1972,1,29,23,59,59,999) );
- addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
- "Date.UTC( 1972,2,1,23,59,59,999)",
- utc(1972,2,1,23,59,59,999) );
- addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
- "Date.UTC( 1968,1,29,23,59,59,999)",
- utc(1968,1,29,23,59,59,999) );
- addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
- "Date.UTC( 1968,2,1,23,59,59,999)",
- utc(1968,2,1,23,59,59,999) );
- addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
- "Date.UTC( 1969,0,1,0,0,0,0)",
- utc(1969,0,1,0,0,0,0) );
- addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
- "Date.UTC( 1969,11,31,23,59,59,1000)",
- utc(1970,0,1,0,0,0,0) );
- addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
- "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
- utc(1969,Number.NaN,31,23,59,59,999) );
-
- // Dates around 2000
-
- addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
- "Date.UTC( 1999,11,31,23,59,59,999)",
- utc(1999,11,31,23,59,59,999) );
- addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
- "Date.UTC( 2000,0,1,0,0,0,0)",
- utc(2000,0,1,0,0,0,0) );
-
- // Dates around 1900
- addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
- "Date.UTC( 1899,11,31,23,59,59,999)",
- utc(1899,11,31,23,59,59,999) );
- addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
- "Date.UTC( 1900,0,1,0,0,0,0)",
- utc(1900,0,1,0,0,0,0) );
- addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
- "Date.UTC( 1973,0,1,0,0,0,0)",
- utc(1973,0,1,0,0,0,0) );
- addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
- "Date.UTC( 1776,6,4,12,36,13,111)",
- utc(1776,6,4,12,36,13,111) );
- addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
- "Date.UTC( 2525,9,18,15,30,1,123)",
- utc(2525,9,18,15,30,1,123) );
-
- // Dates around 29 Feb 2000
-
- addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
- "Date.UTC( 2000,1,29,0,0,0,0 )",
- utc(2000,1,29,0,0,0,0) );
- addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
- "Date.UTC( 2000,1,29,8,0,0,0 )",
- utc(2000,1,29,8,0,0,0) );
-
- // Dates around 1 Jan 2005
-
- addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
- "Date.UTC( 2005,0,1,0,0,0,0 )",
- utc(2005,0,1,0,0,0,0) );
- addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
- "Date.UTC( 2004,11,31,16,0,0,0 )",
- utc(2004,11,31,16,0,0,0) );
-}
+test();
function addNewTestCase( DateCase, DateString, ExpectDate) {
- DateCase = DateCase;
+ DateCase = DateCase;
- item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
- testcases[item++] = new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+ new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
+ new TestCase( SECTION, DateString, ExpectDate.value, DateCase );
/*
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", ExpectDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", ExpectDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", ExpectDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", ExpectDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", ExpectDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", ExpectDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", ExpectDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", ExpectDate.ms, DateCase.getUTCMilliseconds() );
+new TestCase( SECTION, DateString+".getUTCFullYear()", ExpectDate.year, DateCase.getUTCFullYear() );
+new TestCase( SECTION, DateString+".getUTCMonth()", ExpectDate.month, DateCase.getUTCMonth() );
+new TestCase( SECTION, DateString+".getUTCDate()", ExpectDate.date, DateCase.getUTCDate() );
+new TestCase( SECTION, DateString+".getUTCDay()", ExpectDate.day, DateCase.getUTCDay() );
+new TestCase( SECTION, DateString+".getUTCHours()", ExpectDate.hours, DateCase.getUTCHours() );
+new TestCase( SECTION, DateString+".getUTCMinutes()", ExpectDate.minutes,DateCase.getUTCMinutes() );
+new TestCase( SECTION, DateString+".getUTCSeconds()", ExpectDate.seconds,DateCase.getUTCSeconds() );
+new TestCase( SECTION, DateString+".getUTCMilliseconds()", ExpectDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", ExpectDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", ExpectDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", ExpectDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", ExpectDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", ExpectDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", ExpectDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", ExpectDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", ExpectDate.ms, DateCase.getMilliseconds() );
+new TestCase( SECTION, DateString+".getFullYear()", ExpectDate.year, DateCase.getFullYear() );
+new TestCase( SECTION, DateString+".getMonth()", ExpectDate.month, DateCase.getMonth() );
+new TestCase( SECTION, DateString+".getDate()", ExpectDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", ExpectDate.day, DateCase.getDay() );
+new TestCase( SECTION, DateString+".getHours()", ExpectDate.hours, DateCase.getHours() );
+new TestCase( SECTION, DateString+".getMinutes()", ExpectDate.minutes, DateCase.getMinutes() );
+new TestCase( SECTION, DateString+".getSeconds()", ExpectDate.seconds, DateCase.getSeconds() );
+new TestCase( SECTION, DateString+".getMilliseconds()", ExpectDate.ms, DateCase.getMilliseconds() );
*/
}
-function test() {
- for( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = " +
- testcases[tc].actual );
- }
-
- stopTest();
- return testcases;
+function MyDate() {
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
+
+function utc( year, month, date, hours, minutes, seconds, ms ) {
+ d = new MyDate();
+ d.year = Number(year);
+
+ if (month)
+ d.month = Number(month);
+ if (date)
+ d.date = Number(date);
+ if (hours)
+ d.hours = Number(hours);
+ if (minutes)
+ d.minutes = Number(minutes);
+ if (seconds)
+ d.seconds = Number(seconds);
+ if (ms)
+ d.ms = Number(ms);
+
+ if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
+ d.year = 1900 + ToInteger(d.year);
+ }
+
+ if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
+ isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
+ d.year = Number.NaN;
+ d.month = Number.NaN;
+ d.date = Number.NaN;
+ d.hours = Number.NaN;
+ d.minutes = Number.NaN;
+ d.seconds = Number.NaN;
+ d.ms = Number.NaN;
+ d.value = Number.NaN;
+ d.time = Number.NaN;
+ d.day =Number.NaN;
+ return d;
+ }
+
+ d.day = MakeDay( d.year, d.month, d.date );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = (TimeClip( MakeDate(d.day,d.time)));
+
+ return d;
+}
+
+function UTCTime( t ) {
+ sign = ( t < 0 ) ? -1 : 1;
+ return ( (t +(TZ_DIFF*msPerHour)) );
+}
+
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.1.js b/mozilla/js/tests/ecma/Date/15.9.5.1.js
index 458bf4541f0..c11795e8c3e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,41 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.1.js
- ECMA Section: 15.9.5.1 Date.prototype.constructor
- Description:
- The initial value of Date.prototype.constructor is the built-in Date
- constructor.
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.1.js
+ ECMA Section: 15.9.5.1 Date.prototype.constructor
+ Description:
+ The initial value of Date.prototype.constructor is the built-in Date
+ constructor.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.constructor";
+var SECTION = "15.9.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
-
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.constructor == Date",
- true,
- Date.prototype.constructor == Date );
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Date.prototype.constructor == Date",
+ true,
+ Date.prototype.constructor == Date );
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-1.js b/mozilla/js/tests/ecma/Date/15.9.5.10-1.js
index ef6b913c2f6..dafa805b09e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,97 +35,84 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( now );
+addTestCase( now );
/*
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( time );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDate()",
- DateFromTime(LocalTime(t)),
- (new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDate()",
+ DateFromTime(LocalTime(t)),
+ (new Date(t)).getDate() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-10.js b/mozilla/js/tests/ecma/Date/15.9.5.10-10.js
index 56a7d131908..d5cba5e03de 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-10.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,88 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( DST_START_1998+1 );
+addTestCase( DST_START_1998+1 );
/*
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-11.js b/mozilla/js/tests/ecma/Date/15.9.5.10-11.js
index 727f3ce45f2..d417cc11c74 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-11.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( DST_END_1998 );
+addTestCase( DST_END_1998 );
/*
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-12.js b/mozilla/js/tests/ecma/Date/15.9.5.10-12.js
index ee752f2bf54..e7b794471fa 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-12.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-12.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,86 +35,73 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( DST_END_1998-1 );
+addTestCase( DST_END_1998-1 );
/*
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-13.js b/mozilla/js/tests/ecma/Date/15.9.5.10-13.js
index b4b09432883..b174e935c80 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-13.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-13.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
+addTestCase( DST_END_1998+1 );
- addTestCase( DST_END_1998+1 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-2.js b/mozilla/js/tests/ecma/Date/15.9.5.10-2.js
index 351f5c562b7..6e421a29659 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,96 +35,83 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( time );
+addTestCase( time );
/*
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+testcases[tc++] = new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-3.js b/mozilla/js/tests/ecma/Date/15.9.5.10-3.js
index 331a8271c41..6863c1700c2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,95 +35,82 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( TIME_1970 );
+addTestCase( TIME_1970 );
/*
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-4.js b/mozilla/js/tests/ecma/Date/15.9.5.10-4.js
index daf046d745f..8aa11808f69 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,80 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( TIME_1900 );
+addTestCase( TIME_1900 );
/*
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-5.js b/mozilla/js/tests/ecma/Date/15.9.5.10-5.js
index 62e54c78fb2..86e7d64a39c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,81 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( TIME_2000 );
+addTestCase( TIME_2000 );
/*
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-6.js b/mozilla/js/tests/ecma/Date/15.9.5.10-6.js
index 45a5e54bd44..cb4a6b1f1a8 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,92 +35,79 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_FEB_29_2000 );
/*
- addTestCase( UTC_JAN_1_2005 );
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( UTC_JAN_1_2005 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-7.js b/mozilla/js/tests/ecma/Date/15.9.5.10-7.js
index 82dcc0823fe..236c1610da1 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,91 +35,78 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+ var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( UTC_JAN_1_2005 );
+addTestCase( UTC_JAN_1_2005 );
/*
- addTestCase( DST_START_1998 );
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_START_1998 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-8.js b/mozilla/js/tests/ecma/Date/15.9.5.10-8.js
index 33b749ab09a..688086c76c2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,90 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( DST_START_1998 );
+addTestCase( DST_START_1998 );
/*
- addTestCase( DST_START_1998-1 );
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_START_1998-1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.10-9.js b/mozilla/js/tests/ecma/Date/15.9.5.10-9.js
index 165773816c8..35826456fc2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.10-9.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.10-9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,89 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.10.js
- ECMA Section: 15.9.5.10
- Description: Date.prototype.getDate
+ File Name: 15.9.5.10.js
+ ECMA Section: 15.9.5.10
+ Description: Date.prototype.getDate
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return DateFromTime(LocalTime(t)).
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return DateFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDate()";
+var SECTION = "15.9.5.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+// some daylight savings time cases
- // some daylight savings time cases
+var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour );
- var DST_START_1998 = UTC( GetFirstSundayInApril(TimeFromYear(1998)) + 2*msPerHour )
+var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
- var DST_END_1998 = UTC( GetLastSundayInOctober(TimeFromYear(1998)) + 2*msPerHour );
-
- addTestCase( DST_START_1998-1 );
+addTestCase( DST_START_1998-1 );
/*
- addTestCase( DST_START_1998+1 );
- addTestCase( DST_END_1998 );
- addTestCase( DST_END_1998-1 );
- addTestCase( DST_END_1998+1 );
+ addTestCase( DST_START_1998+1 );
+ addTestCase( DST_END_1998 );
+ addTestCase( DST_END_1998-1 );
+ addTestCase( DST_END_1998+1 );
*/
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDate()",
- NaN,
- (new Date(NaN)).getDate() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getDate()",
+ NaN,
+ (new Date(NaN)).getDate() );
+
+new TestCase( SECTION,
+ "Date.prototype.getDate.length",
+ 0,
+ Date.prototype.getDate.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDate.length",
- 0,
- Date.prototype.getDate.length );
- test();
function addTestCase( t ) {
- for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
+ for ( d = 0; d < TimeInMonth(MonthFromTime(t)); d+= msPerDay ) {
+ t += d;
+ testcases[tc++] = new TestCase( SECTION,
"(new Date("+t+")).getDate()",
DateFromTime(LocalTime(t)),
(new Date(t)).getDate() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-1.js b/mozilla/js/tests/ecma/Date/15.9.5.11-1.js
index d03d44406ad..84bb8384c8f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,67 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+addTestCase( now );
- addTestCase( now );
-
- test()
+test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-2.js b/mozilla/js/tests/ecma/Date/15.9.5.11-2.js
index 04e8699fdcb..4f3344f60bc 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
+addTestCase( time );
- addTestCase( time );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-3.js b/mozilla/js/tests/ecma/Date/15.9.5.11-3.js
index e17570a0f48..27dfd4db15b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,77 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_1970 );
- addTestCase( TIME_1970 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-4.js b/mozilla/js/tests/ecma/Date/15.9.5.11-4.js
index ef9c265cc75..3d90207871b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,77 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_1900 );
- addTestCase( TIME_1900 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7* msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7* msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-5.js b/mozilla/js/tests/ecma/Date/15.9.5.11-5.js
index 1ed21cf908c..d362b310547 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,77 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_2000 );
- addTestCase( TIME_2000 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-6.js b/mozilla/js/tests/ecma/Date/15.9.5.11-6.js
index 20265ffdd05..290ffceee21 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,66 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
- var UTC_FEB_29_2000 = TIME_2000 + ( 30 * msPerDay ) + ( 29 * msPerDay );
+addTestCase( UTC_FEB_29_2000 );
+
+test();
- addTestCase( UTC_FEB_29_2000 );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.11-7.js b/mozilla/js/tests/ecma/Date/15.9.5.11-7.js
index 17b77738d60..ec5cfc2162e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.11-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.11-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,67 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.11.js
- ECMA Section: 15.9.5.11
- Description: Date.prototype.getUTCDate
+ File Name: 15.9.5.11.js
+ ECMA Section: 15.9.5.11
+ Description: Date.prototype.getUTCDate
1.Let t be this time value.
2.If t is NaN, return NaN.
1.Return DateFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDate()";
+var SECTION = "15.9.5.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDate()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( UTC_JAN_1_2005 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 11; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 11; m++ ) {
+ t += TimeInMonth(m);
- for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
- t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDate()",
- DateFromTime((t)),
- (new Date(t)).getUTCDate() );
+ for ( var d = 0; d < TimeInMonth( m ); d += 7*msPerDay ) {
+ t += d;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDate()",
+ DateFromTime((t)),
+ (new Date(t)).getUTCDate() );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCDate()",
- DateFromTime((t+1)),
- (new Date(t+1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCDate()",
+ DateFromTime((t+1)),
+ (new Date(t+1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCDate()",
- DateFromTime((t-1)),
- (new Date(t-1)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCDate()",
+ DateFromTime((t-1)),
+ (new Date(t-1)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getUTCDate() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
- DateFromTime((t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getUTCDate() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCDate()",
+ DateFromTime((t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getUTCDate() );
*/
- }
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-1.js b/mozilla/js/tests/ecma/Date/15.9.5.12-1.js
index bd0aa99e6e8..6eed40fe25e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,91 +35,78 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( now );
+addTestCase( now );
/*
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( time );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-2.js b/mozilla/js/tests/ecma/Date/15.9.5.12-2.js
index 3018e89e49f..22d2f467e83 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,90 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( time );
+addTestCase( time );
/*
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ testcases[tc++] = new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-3.js b/mozilla/js/tests/ecma/Date/15.9.5.12-3.js
index 1bb2e81ddb3..62abbdf34b9 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,89 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_1970 );
+addTestCase( TIME_1970 );
/*
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-4.js b/mozilla/js/tests/ecma/Date/15.9.5.12-4.js
index 449b3106912..a17673d74d3 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,88 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_1900 );
+addTestCase( TIME_1900 );
/*
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-5.js b/mozilla/js/tests/ecma/Date/15.9.5.12-5.js
index 15d2fb9f456..e24ee6aaebc 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_2000 );
+addTestCase( TIME_2000 );
/*
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-6.js b/mozilla/js/tests/ecma/Date/15.9.5.12-6.js
index bc4e4970330..721c48d35d6 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,86 +35,73 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_FEB_29_2000 );
/*
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-7.js b/mozilla/js/tests/ecma/Date/15.9.5.12-7.js
index a3f17d4fed5..f4dfb279b64 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,71 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12.js
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12.js
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( UTC_JAN_1_2005 );
+addTestCase( UTC_JAN_1_2005 );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
+ new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
*/
- test();
+test();
+
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.12-8.js b/mozilla/js/tests/ecma/Date/15.9.5.12-8.js
index 9d02cb31a6a..dd41d801340 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.12-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.12-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.12
- ECMA Section: 15.9.5.12
- Description: Date.prototype.getDay
+ File Name: 15.9.5.12
+ ECMA Section: 15.9.5.12
+ Description: Date.prototype.getDay
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return WeekDay(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return WeekDay(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getDay()";
+var SECTION = "15.9.5.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+new TestCase( SECTION,
+ "(new Date(NaN)).getDay()",
+ NaN,
+ (new Date(NaN)).getDay() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getDay()",
- NaN,
- (new Date(NaN)).getDay() );
+new TestCase( SECTION,
+ "Date.prototype.getDay.length",
+ 0,
+ Date.prototype.getDay.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getDay.length",
- 0,
- Date.prototype.getDay.length );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*6 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getDay()",
- WeekDay(LocalTime(t)),
- (new Date(t)).getDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getDay()",
+ WeekDay(LocalTime(t)),
+ (new Date(t)).getDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-1.js b/mozilla/js/tests/ecma/Date/15.9.5.13-1.js
index a0ab3e32c69..0174a4cae81 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,60 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+addTestCase( now );
- addTestCase( now );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-2.js b/mozilla/js/tests/ecma/Date/15.9.5.13-2.js
index b93ce909ae1..70bb2f2e6fb 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,48 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
+addTestCase( time );
+test();
- addTestCase( time );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-3.js b/mozilla/js/tests/ecma/Date/15.9.5.13-3.js
index d7b38598bc9..2a6ebdf8ffa 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_1970 );
- addTestCase( TIME_1970 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-4.js b/mozilla/js/tests/ecma/Date/15.9.5.13-4.js
index 54e46bc0081..bf9e831eb98 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_1900 );
- addTestCase( TIME_1900 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-5.js b/mozilla/js/tests/ecma/Date/15.9.5.13-5.js
index dc89262d0b2..231f1191dd9 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+addTestCase( TIME_2000 );
- addTestCase( TIME_2000 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*14 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-6.js b/mozilla/js/tests/ecma/Date/15.9.5.13-6.js
index 6e1b117b8e0..41769aec491 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,60 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get time for 29 feb 2000
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+addTestCase( UTC_FEB_29_2000 );
+test();
- addTestCase( UTC_FEB_29_2000 );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-7.js b/mozilla/js/tests/ecma/Date/15.9.5.13-7.js
index 89f829f4049..4faec39f165 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,49 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( UTC_JAN_1_2005 );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.13-8.js b/mozilla/js/tests/ecma/Date/15.9.5.13-8.js
index b0be7541859..db56cae16cc 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.13-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.13-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.13.js
- ECMA Section: 15.9.5.13
- Description: Date.prototype.getUTCDay
+ File Name: 15.9.5.13.js
+ ECMA Section: 15.9.5.13
+ Description: Date.prototype.getUTCDay
1.Let t be this time value.
2.If t is NaN, return NaN.
3.Return WeekDay(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCDay()";
+var SECTION = "15.9.5.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCDay()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCDay()",
+ NaN,
+ (new Date(NaN)).getUTCDay() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCDay()",
- NaN,
- (new Date(NaN)).getUTCDay() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCDay.length",
+ 0,
+ Date.prototype.getUTCDay.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCDay.length",
- 0,
- Date.prototype.getUTCDay.length );
+test();
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
- t += TimeInMonth(m);
+ for ( var m = 0; m < 12; m++ ) {
+ t += TimeInMonth(m);
- for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
- t += d;
+ for ( d = 0; d < TimeInMonth(m); d+= msPerDay*7 ) {
+ t += d;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCDay()",
- WeekDay((t)),
- (new Date(t)).getUTCDay() );
- }
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCDay()",
+ WeekDay((t)),
+ (new Date(t)).getUTCDay() );
}
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.14.js b/mozilla/js/tests/ecma/Date/15.9.5.14.js
index cc0f9c58bf5..0919648b831 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.14.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.14.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.14.js
- ECMA Section: 15.9.5.14
- Description: Date.prototype.getHours
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return HourFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.14.js
+ ECMA Section: 15.9.5.14
+ Description: Date.prototype.getHours
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.14";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getHours()";
+var SECTION = "15.9.5.14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getHours()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getHours()",
+ NaN,
+ (new Date(NaN)).getHours() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getHours()",
- NaN,
- (new Date(NaN)).getHours() );
+new TestCase( SECTION,
+ "Date.prototype.getHours.length",
+ 0,
+ Date.prototype.getHours.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getHours.length",
- 0,
- Date.prototype.getHours.length );
- test();
function addTestCase( t ) {
- for ( h = 0; h < 24; h+=4 ) {
- t += msPerHour;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getHours()",
- HourFromTime((LocalTime(t))),
- (new Date(t)).getHours() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( h = 0; h < 24; h+=4 ) {
+ t += msPerHour;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getHours()",
+ HourFromTime((LocalTime(t))),
+ (new Date(t)).getHours() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.15.js b/mozilla/js/tests/ecma/Date/15.9.5.15.js
index 36b6ca31334..99ae14e3aa0 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.15.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.15.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.15.js
- ECMA Section: 15.9.5.15
- Description: Date.prototype.getUTCHours
+ File Name: 15.9.5.15.js
+ ECMA Section: 15.9.5.15
+ Description: Date.prototype.getUTCHours
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return HourFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return HourFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.15";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCHours()";
+var SECTION = "15.9.5.15";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCHours()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCHours()",
+ NaN,
+ (new Date(NaN)).getUTCHours() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCHours()",
- NaN,
- (new Date(NaN)).getUTCHours() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCHours.length",
+ 0,
+ Date.prototype.getUTCHours.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCHours.length",
- 0,
- Date.prototype.getUTCHours.length );
- test();
function addTestCase( t ) {
- for ( h = 0; h < 24; h+=3 ) {
- t += msPerHour;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCHours()",
- HourFromTime((t)),
- (new Date(t)).getUTCHours() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( h = 0; h < 24; h+=3 ) {
+ t += msPerHour;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCHours()",
+ HourFromTime((t)),
+ (new Date(t)).getUTCHours() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.16.js b/mozilla/js/tests/ecma/Date/15.9.5.16.js
index ea2542fef6a..ad92a6c4313 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.16.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.16.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.16.js
- ECMA Section: 15.9.5.16
- Description: Date.prototype.getMinutes
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return MinFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.16.js
+ ECMA Section: 15.9.5.16
+ Description: Date.prototype.getMinutes
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return MinFromTime(LocalTime(t)).
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.16";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getMinutes()";
+var SECTION = "15.9.5.16";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMinutes()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getMinutes()",
+ NaN,
+ (new Date(NaN)).getMinutes() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getMinutes()",
- NaN,
- (new Date(NaN)).getMinutes() );
+new TestCase( SECTION,
+ "Date.prototype.getMinutes.length",
+ 0,
+ Date.prototype.getMinutes.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getMinutes.length",
- 0,
- Date.prototype.getMinutes.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 60; m+=10 ) {
- t += msPerMinute;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getMinutes()",
- MinFromTime((LocalTime(t))),
- (new Date(t)).getMinutes() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMinutes()",
+ MinFromTime((LocalTime(t))),
+ (new Date(t)).getMinutes() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.17.js b/mozilla/js/tests/ecma/Date/15.9.5.17.js
index d748d94566c..3b822bc97b3 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.17.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.17.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.17.js
- ECMA Section: 15.9.5.17
- Description: Date.prototype.getUTCMinutes
+ File Name: 15.9.5.17.js
+ ECMA Section: 15.9.5.17
+ Description: Date.prototype.getUTCMinutes
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return MinFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MinFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.17";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMinutes()";
+var SECTION = "15.9.5.17";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMinutes()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMinutes()",
+ NaN,
+ (new Date(NaN)).getUTCMinutes() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCMinutes()",
- NaN,
- (new Date(NaN)).getUTCMinutes() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCMinutes.length",
+ 0,
+ Date.prototype.getUTCMinutes.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCMinutes.length",
- 0,
- Date.prototype.getUTCMinutes.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 60; m+=10 ) {
- t += msPerMinute;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMinutes()",
- MinFromTime(t),
- (new Date(t)).getUTCMinutes() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += msPerMinute;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMinutes()",
+ MinFromTime(t),
+ (new Date(t)).getUTCMinutes() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.18.js b/mozilla/js/tests/ecma/Date/15.9.5.18.js
index 68f3d89cfee..6c7ffa83fb6 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.18.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.18.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.18.js
- ECMA Section: 15.9.5.18
- Description: Date.prototype.getSeconds
+ File Name: 15.9.5.18.js
+ ECMA Section: 15.9.5.18
+ Description: Date.prototype.getSeconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return SecFromTime(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.18";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getSeconds()";
+var SECTION = "15.9.5.18";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getSeconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getSeconds()",
+ NaN,
+ (new Date(NaN)).getSeconds() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getSeconds()",
- NaN,
- (new Date(NaN)).getSeconds() );
+new TestCase( SECTION,
+ "Date.prototype.getSeconds.length",
+ 0,
+ Date.prototype.getSeconds.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getSeconds.length",
- 0,
- Date.prototype.getSeconds.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 60; m+=10 ) {
- t += 1000;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getSeconds()",
- SecFromTime(LocalTime(t)),
- (new Date(t)).getSeconds() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getSeconds()",
+ SecFromTime(LocalTime(t)),
+ (new Date(t)).getSeconds() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.19.js b/mozilla/js/tests/ecma/Date/15.9.5.19.js
index b4967b9daec..0716ed3a640 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.19.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.19.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.19.js
- ECMA Section: 15.9.5.19
- Description: Date.prototype.getUTCSeconds
+ File Name: 15.9.5.19.js
+ ECMA Section: 15.9.5.19
+ Description: Date.prototype.getUTCSeconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return SecFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return SecFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.19";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCSeconds()";
+var SECTION = "15.9.5.19";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCSeconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCSeconds()",
+ NaN,
+ (new Date(NaN)).getUTCSeconds() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCSeconds()",
- NaN,
- (new Date(NaN)).getUTCSeconds() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCSeconds.length",
+ 0,
+ Date.prototype.getUTCSeconds.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCSeconds.length",
- 0,
- Date.prototype.getUTCSeconds.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 60; m+=10 ) {
- t += 1000;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCSeconds()",
- SecFromTime(t),
- (new Date(t)).getUTCSeconds() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 60; m+=10 ) {
+ t += 1000;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCSeconds()",
+ SecFromTime(t),
+ (new Date(t)).getUTCSeconds() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.2-1.js b/mozilla/js/tests/ecma/Date/15.9.5.2-1.js
index e2949f1bf23..02fe596128d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.2-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,134 +35,120 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.2.js
- ECMA Section: 15.9.5.2 Date.prototype.toString
- Description:
- This function returns a string value. The contents of the string are
- implementation dependent, but are intended to represent the Date in a
- convenient, human-readable form in the current time zone.
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Date object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.toString";
+var SECTION = "15.9.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.toString.length",
- 0,
- Date.prototype.toString.length );
+var now = new Date();
- var now = new Date();
+// can't test the content of the string, but can verify that the string is
+// parsable by Date.parse
- // can't test the content of the string, but can verify that the string is
- // parsable by Date.parse
+new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
- testcases[tc++] = new TestCase( SECTION,
- "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
- true,
- Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+// 1970
- testcases[tc++] = new TestCase( SECTION,
- "typeof now.toString()",
- "string",
- typeof now.toString() );
- // 1970
+TZ_ADJUST = TZ_DIFF * msPerHour;
- TZ_ADJUST = TZ_DIFF * msPerHour;
+new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date(0)).toString() )",
- 0,
- Date.parse( (new Date(0)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
- TZ_ADJUST,
- Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+// 1900
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) );
- // 1900
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_1900+")).toString() )",
- TIME_1900,
- Date.parse( (new Date(TIME_1900)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
- TIME_1900 -TZ_ADJUST,
- Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+// 2000
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) );
- // 2000
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_2000+")).toString() )",
- TIME_2000,
- Date.parse( (new Date(TIME_2000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
- TIME_2000 -TZ_ADJUST,
- Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+// 29 Feb 2000
- // 29 Feb 2000
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) );
- var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
- UTC_29_FEB_2000,
- Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
-
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
- UTC_29_FEB_2000-1000,
- Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
- UTC_29_FEB_2000-TZ_ADJUST,
- Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
- // 2O05
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) );
+// 2O05
- var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
- UTC_1_JAN_2005,
- Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
- UTC_1_JAN_2005-1000,
- Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
- UTC_1_JAN_2005-TZ_ADJUST,
- Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) );
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.2-2-n.js b/mozilla/js/tests/ecma/Date/15.9.5.2-2-n.js
index ae50eff6938..b6647bf268f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.2-2-n.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,59 +35,48 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.2-2.js
- ECMA Section: 15.9.5.2 Date.prototype.toString
- Description:
- This function returns a string value. The contents of the string are
- implementation dependent, but are intended to represent the Date in a
- convenient, human-readable form in the current time zone.
+ File Name: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Date object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- This verifies that calling toString on an object that is not a string
- generates a runtime error.
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.toString";
+var SECTION = "15.9.5.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var OBJ = new MyObject( new Date(0) );
- var OBJ = new MyObject( new Date(0) );
+DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.toString()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- "var OBJ = new MyObject( new Date(0) ); OBJ.toString()",
- "error",
- OBJ.toString() );
- test();
+new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.toString()",
+ "error",
+ eval("OBJ.toString()") );
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = Date.prototype.toString;
- return this;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.2.js b/mozilla/js/tests/ecma/Date/15.9.5.2.js
index e2949f1bf23..02fe596128d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,134 +35,120 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.2.js
- ECMA Section: 15.9.5.2 Date.prototype.toString
- Description:
- This function returns a string value. The contents of the string are
- implementation dependent, but are intended to represent the Date in a
- convenient, human-readable form in the current time zone.
+ File Name: 15.9.5.2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Date object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.toString";
+var SECTION = "15.9.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "Date.prototype.toString.length",
+ 0,
+ Date.prototype.toString.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.toString.length",
- 0,
- Date.prototype.toString.length );
+var now = new Date();
- var now = new Date();
+// can't test the content of the string, but can verify that the string is
+// parsable by Date.parse
- // can't test the content of the string, but can verify that the string is
- // parsable by Date.parse
+new TestCase( SECTION,
+ "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
+ true,
+ Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
- testcases[tc++] = new TestCase( SECTION,
- "Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000",
- true,
- Math.abs(Date.parse(now.toString()) - now.valueOf()) < 1000 );
+new TestCase( SECTION,
+ "typeof now.toString()",
+ "string",
+ typeof now.toString() );
+// 1970
- testcases[tc++] = new TestCase( SECTION,
- "typeof now.toString()",
- "string",
- typeof now.toString() );
- // 1970
+TZ_ADJUST = TZ_DIFF * msPerHour;
- TZ_ADJUST = TZ_DIFF * msPerHour;
+new TestCase( SECTION,
+ "Date.parse( (new Date(0)).toString() )",
+ 0,
+ Date.parse( (new Date(0)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date(0)).toString() )",
- 0,
- Date.parse( (new Date(0)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
+ TZ_ADJUST,
+ Date.parse( (new Date(TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TZ_ADJUST+")).toString() )",
- TZ_ADJUST,
- Date.parse( (new Date(TZ_ADJUST)).toString() ) )
+// 1900
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900+")).toString() )",
+ TIME_1900,
+ Date.parse( (new Date(TIME_1900)).toString() ) );
- // 1900
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_1900+")).toString() )",
- TIME_1900,
- Date.parse( (new Date(TIME_1900)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
+ TIME_1900 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_1900 -TZ_ADJUST+")).toString() )",
- TIME_1900 -TZ_ADJUST,
- Date.parse( (new Date(TIME_1900 -TZ_ADJUST)).toString() ) )
+// 2000
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000+")).toString() )",
+ TIME_2000,
+ Date.parse( (new Date(TIME_2000)).toString() ) );
- // 2000
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_2000+")).toString() )",
- TIME_2000,
- Date.parse( (new Date(TIME_2000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
+ TIME_2000 -TZ_ADJUST,
+ Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+TIME_2000 -TZ_ADJUST+")).toString() )",
- TIME_2000 -TZ_ADJUST,
- Date.parse( (new Date(TIME_2000 -TZ_ADJUST)).toString() ) )
+// 29 Feb 2000
- // 29 Feb 2000
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
+ UTC_29_FEB_2000,
+ Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) );
- var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+UTC_29_FEB_2000+")).toString() )",
- UTC_29_FEB_2000,
- Date.parse( (new Date(UTC_29_FEB_2000)).toString() ) )
-
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
- UTC_29_FEB_2000-1000,
- Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-1000)+")).toString() )",
+ UTC_29_FEB_2000-1000,
+ Date.parse( (new Date(UTC_29_FEB_2000-1000)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
- UTC_29_FEB_2000-TZ_ADJUST,
- Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) )
- // 2O05
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_29_FEB_2000-TZ_ADJUST)+")).toString() )",
+ UTC_29_FEB_2000-TZ_ADJUST,
+ Date.parse( (new Date(UTC_29_FEB_2000-TZ_ADJUST)).toString() ) );
+// 2O05
- var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
- UTC_1_JAN_2005,
- Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) )
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
+TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+new TestCase( SECTION,
+ "Date.parse( (new Date("+UTC_1_JAN_2005+")).toString() )",
+ UTC_1_JAN_2005,
+ Date.parse( (new Date(UTC_1_JAN_2005)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
- UTC_1_JAN_2005-1000,
- Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-1000)+")).toString() )",
+ UTC_1_JAN_2005-1000,
+ Date.parse( (new Date(UTC_1_JAN_2005-1000)).toString() ) );
- testcases[tc++] = new TestCase( SECTION,
- "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
- UTC_1_JAN_2005-TZ_ADJUST,
- Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) )
+new TestCase( SECTION,
+ "Date.parse( (new Date("+(UTC_1_JAN_2005-TZ_ADJUST)+")).toString() )",
+ UTC_1_JAN_2005-TZ_ADJUST,
+ Date.parse( (new Date(UTC_1_JAN_2005-TZ_ADJUST)).toString() ) );
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.20.js b/mozilla/js/tests/ecma/Date/15.9.5.20.js
index 6782eaa50dc..324995476bd 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.20.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.20.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.20.js
- ECMA Section: 15.9.5.20
- Description: Date.prototype.getMilliseconds
+ File Name: 15.9.5.20.js
+ ECMA Section: 15.9.5.20
+ Description: Date.prototype.getMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.20";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getMilliseconds()";
+var SECTION = "15.9.5.20";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getMilliseconds()",
+ NaN,
+ (new Date(NaN)).getMilliseconds() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getMilliseconds()",
- NaN,
- (new Date(NaN)).getMilliseconds() );
+new TestCase( SECTION,
+ "Date.prototype.getMilliseconds.length",
+ 0,
+ Date.prototype.getMilliseconds.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getMilliseconds.length",
- 0,
- Date.prototype.getMilliseconds.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getMilliseconds()",
- msFromTime(LocalTime(t)),
- (new Date(t)).getMilliseconds() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMilliseconds()",
+ msFromTime(LocalTime(t)),
+ (new Date(t)).getMilliseconds() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-1.js b/mozilla/js/tests/ecma/Date/15.9.5.21-1.js
index f8d9d6ef337..77eed428003 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( now );
+addTestCase( now );
/*
- addTestCase( time );
+ addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCMilliseconds()",
- NaN,
- (new Date(NaN)).getUTCMilliseconds() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCMilliseconds.length",
- 0,
- Date.prototype.getUTCMilliseconds.length );
+ new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
*/
- test();
+test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-2.js b/mozilla/js/tests/ecma/Date/15.9.5.21-2.js
index a25cec5f6a7..0cefc9b7d59 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( time );
+addTestCase( time );
/*
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCMilliseconds()",
- NaN,
- (new Date(NaN)).getUTCMilliseconds() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCMilliseconds.length",
- 0,
- Date.prototype.getUTCMilliseconds.length );
+ new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
*/
- test();
-function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+test();
+
+function addTestCase( t ) {
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-3.js b/mozilla/js/tests/ecma/Date/15.9.5.21-3.js
index cf6a85fc7af..a6a70e71465 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( TIME_1970 );
+
+test();
- addTestCase( TIME_1970 );
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-4.js b/mozilla/js/tests/ecma/Date/15.9.5.21-4.js
index d6f576771ed..79b825de9f2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( TIME_1900 );
+test();
- addTestCase( TIME_1900 );
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-5.js b/mozilla/js/tests/ecma/Date/15.9.5.21-5.js
index bc872683271..d1ac8597284 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( TIME_2000 );
+
+test();
- addTestCase( TIME_2000 );
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-6.js b/mozilla/js/tests/ecma/Date/15.9.5.21-6.js
index a16720b2ae0..cc0a8e5e8fb 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_FEB_29_2000 );
+test();
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-7.js b/mozilla/js/tests/ecma/Date/15.9.5.21-7.js
index 251456ee3a4..334872b409d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( UTC_JAN_1_2005 );
+test();
- addTestCase( UTC_JAN_1_2005 );
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.21-8.js b/mozilla/js/tests/ecma/Date/15.9.5.21-8.js
index 2b391e5012c..82388246374 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.21-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.21-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,59 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.21.js
- ECMA Section: 15.9.5.21
- Description: Date.prototype.getUTCMilliseconds
+ File Name: 15.9.5.21.js
+ ECMA Section: 15.9.5.21
+ Description: Date.prototype.getUTCMilliseconds
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return msFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return msFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.21";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMilliseconds()";
+var SECTION = "15.9.5.21";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMilliseconds()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMilliseconds()",
+ NaN,
+ (new Date(NaN)).getUTCMilliseconds() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCMilliseconds()",
- NaN,
- (new Date(NaN)).getUTCMilliseconds() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCMilliseconds.length",
+ 0,
+ Date.prototype.getUTCMilliseconds.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCMilliseconds.length",
- 0,
- Date.prototype.getUTCMilliseconds.length );
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMilliseconds()",
- msFromTime(t),
- (new Date(t)).getUTCMilliseconds() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMilliseconds()",
+ msFromTime(t),
+ (new Date(t)).getUTCMilliseconds() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-1.js b/mozilla/js/tests/ecma/Date/15.9.5.22-1.js
index 5f8280fdd23..6a0f4e48163 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,86 +35,73 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
-
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
// addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+
+test();
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-2.js b/mozilla/js/tests/ecma/Date/15.9.5.22-2.js
index 09f0d40f564..8df39133b80 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,85 +35,72 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( time );
+addTestCase( time );
/*
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1970 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-3.js b/mozilla/js/tests/ecma/Date/15.9.5.22-3.js
index 88aa740ce48..62fc49579b4 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,71 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_1970 );
+addTestCase( TIME_1970 );
/*
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_1900 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-4.js b/mozilla/js/tests/ecma/Date/15.9.5.22-4.js
index a16c6e39670..8723ca6ad2b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_1900 );
+addTestCase( TIME_1900 );
/*
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( TIME_2000 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-5.js b/mozilla/js/tests/ecma/Date/15.9.5.22-5.js
index 8c89c3b7415..de190794aa5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( TIME_2000 );
+addTestCase( TIME_2000 );
/*
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( UTC_FEB_29_2000 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-6.js b/mozilla/js/tests/ecma/Date/15.9.5.22-6.js
index fe760a1c06b..66d4bfc69f5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_FEB_29_2000 );
/*
- addTestCase( UTC_JAN_1_2005 );
+ addTestCase( UTC_JAN_1_2005 );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-7.js b/mozilla/js/tests/ecma/Date/15.9.5.22-7.js
index ccc08b1d506..6694627197a 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,79 +35,66 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( UTC_JAN_1_2005 );
+addTestCase( UTC_JAN_1_2005 );
/*
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+ new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
+ new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
*/
- test();
-function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function addTestCase( t ) {
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.22-8.js b/mozilla/js/tests/ecma/Date/15.9.5.22-8.js
index 87e7ced55d0..bc5c8d04a28 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.22-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.22-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,76 +35,63 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.22.js
- ECMA Section: 15.9.5.22
- Description: Date.prototype.getTimezoneOffset
+ File Name: 15.9.5.22.js
+ ECMA Section: 15.9.5.22
+ Description: Date.prototype.getTimezoneOffset
- Returns the difference between local time and UTC time in minutes.
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return (t - LocalTime(t)) / msPerMinute.
+ Returns the difference between local time and UTC time in minutes.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return (t - LocalTime(t)) / msPerMinute.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.22";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTimezoneOffset()";
+var SECTION = "15.9.5.22";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTimezoneOffset()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+new TestCase( SECTION,
+ "(new Date(NaN)).getTimezoneOffset()",
+ NaN,
+ (new Date(NaN)).getTimezoneOffset() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getTimezoneOffset()",
- NaN,
- (new Date(NaN)).getTimezoneOffset() );
+new TestCase( SECTION,
+ "Date.prototype.getTimezoneOffset.length",
+ 0,
+ Date.prototype.getTimezoneOffset.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getTimezoneOffset.length",
- 0,
- Date.prototype.getTimezoneOffset.length );
- test();
function addTestCase( t ) {
- for ( m = 0; m <= 1000; m+=100 ) {
- t++;
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getTimezoneOffset()",
- (t - LocalTime(t)) / msPerMinute,
- (new Date(t)).getTimezoneOffset() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( m = 0; m <= 1000; m+=100 ) {
+ t++;
+ new TestCase( SECTION,
+ "(new Date("+t+")).getTimezoneOffset()",
+ (t - LocalTime(t)) / msPerMinute,
+ (new Date(t)).getTimezoneOffset() );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-1.js b/mozilla/js/tests/ecma/Date/15.9.5.23-1.js
index 46f221e110b..284d0c392cd 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,139 +35,122 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
-
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( 0, 0 );
+var now = "now";
+addTestCase( 0, 0 );
/*
- addTestCase( now, -2208988800000 );
- addTestCase( now, -86400000 );
- addTestCase( now, 946684800000 );
+ addTestCase( now, -2208988800000 );
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+ // this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, -2208988800000 );
- addTestCase( now, 946684800000 );
+addTestCase( now, -2208988800000 );
+addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
+
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-10.js b/mozilla/js/tests/ecma/Date/15.9.5.23-10.js
index 35f2b3792bd..8789fb14685 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-10.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,138 +35,121 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
-
- getTestCases();
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, -2208988800000 );
+var now = "now";
+addTestCase( now, -2208988800000 );
/*
- addTestCase( now, -86400000 );
- addTestCase( now, 946684800000 );
+ addTestCase( now, -86400000 );
+ addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+ // this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, -2208988800000 );
- addTestCase( now, 946684800000 );
+addTestCase( now, -2208988800000 );
+addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
+
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-11.js b/mozilla/js/tests/ecma/Date/15.9.5.23-11.js
index 713ace56af6..b01b2c2f8ad 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-11.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,137 +35,121 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
-
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, -86400000 );
+var now = "now";
+addTestCase( now, -86400000 );
/*
- addTestCase( now, 946684800000 );
+ addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+ // this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, -2208988800000 );
- addTestCase( now, 946684800000 );
+addTestCase( now, -2208988800000 );
+addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
+
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-12.js b/mozilla/js/tests/ecma/Date/15.9.5.23-12.js
index c3c2e6e4703..8ca123021c0 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-12.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-12.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,135 +35,116 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
-
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, 946684800000 );
+var now = "now";
+addTestCase( now, 946684800000 );
/*
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, -2208988800000 );
- addTestCase( now, 946684800000 );
+addTestCase( now, -2208988800000 );
+addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-13.js b/mozilla/js/tests/ecma/Date/15.9.5.23-13.js
index cb19f2a4405..54058b6faf7 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-13.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-13.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,132 +35,113 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
-
- var testcases = new Array();
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, -2208988800000 );
+var now = "now";
+addTestCase( now, -2208988800000 );
/*
- addTestCase( now, 946684800000 );
+ addTestCase( now, 946684800000 );
- // this daylight savings case fails -- need to fix date test functions
+ // this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-14.js b/mozilla/js/tests/ecma/Date/15.9.5.23-14.js
index 6d806cabf1f..d6b6872b377 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-14.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-14.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,130 +35,111 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-14";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
-
- var testcases = new Array();
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, 946684800000 );
+var now = "now";
+addTestCase( now, 946684800000 );
/*
- // this daylight savings case fails -- need to fix date test functions
+// this daylight savings case fails -- need to fix date test functions
// addTestCase( now, -69609600000 );
- addTestCase( now, 0 );
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+addTestCase( now, 0 );
+addTestCase( now, String( TIME_1900 ) );
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
+addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-15.js b/mozilla/js/tests/ecma/Date/15.9.5.23-15.js
index b2a06586d6f..ef3bd452ce7 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-15.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-15.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,126 +35,108 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, 0 );
+var now = "now";
+addTestCase( now, 0 );
/*
- addTestCase( now, String( TIME_1900 ) );
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+ addTestCase( now, String( TIME_1900 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-16.js b/mozilla/js/tests/ecma/Date/15.9.5.23-16.js
index 67b685cac40..e19181e71be 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-16.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-16.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,125 +35,107 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, String( TIME_1900 ) );
+var now = "now";
+addTestCase( now, String( TIME_1900 ) );
/*
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
- addTestCase( now, String( TIME_2000 ) );
+ addTestCase( now, String( TZ_DIFF* msPerHour ) );
+ addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-17.js b/mozilla/js/tests/ecma/Date/15.9.5.23-17.js
index 19dcf43f99d..dcc5780d75f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-17.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-17.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,124 +35,106 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
- test();
-
-function getTestCases() {
- var now = "now";
- addTestCase( now, String( TZ_DIFF* msPerHour ) );
+var now = "now";
+addTestCase( now, String( TZ_DIFF* msPerHour ) );
/*
- addTestCase( now, String( TIME_2000 ) );
+ addTestCase( now, String( TIME_2000 ) );
*/
-}
+
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-18.js b/mozilla/js/tests/ecma/Date/15.9.5.23-18.js
index cf916003c95..554d35e23f0 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-18.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-18.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,121 +35,104 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-1.js
- ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
- Description:
+ File Name: 15.9.5.23-1.js
+ ECMA Section: 15.9.5.23 Date.prototype.setTime(time)
+ Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
+writeHeaderToLog( SECTION + " Date.prototype.setTime(time)");
- var testcases = new Array();
- getTestCases();
- test();
+var now = "now";
+addTestCase( now, String( TIME_2000 ) );
-function getTestCases() {
- var now = "now";
- addTestCase( now, String( TIME_2000 ) );
-}
+test();
function addTestCase( startTime, setTime ) {
- if ( startTime == "now" ) {
- DateCase = new Date();
- } else {
- DateCase = new Date( startTime );
- }
+ if ( startTime == "now" ) {
+ DateCase = new Date();
+ } else {
+ DateCase = new Date( startTime );
+ }
+
+ DateCase.setTime( setTime );
+ var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
+ var UTCDate = UTCDateFromTime ( Number(setTime) );
+ var LocalDate = LocalDateFromTime( Number(setTime) );
- DateCase.setTime( setTime );
- var DateString = "var d = new Date("+startTime+"); d.setTime("+setTime+"); d" ;
- var UTCDate = UTCDateFromTime ( Number(setTime) );
- var LocalDate = LocalDateFromTime( Number(setTime) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes, DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds, DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
- return (d);
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-2.js b/mozilla/js/tests/ecma/Date/15.9.5.23-2.js
index 37b540d0e54..7d0606a2345 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,80 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
-
- test_times = new Array( now, TIME_1970, TIME_1900, TIME_2000 );
+test_times = new Array( now, TIME_1970, TIME_1900, TIME_2000 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(now), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(now), test_times[j] );
+}
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).setTime()",
- NaN,
- (new Date(NaN)).setTime() );
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.setTime.length",
- 1,
- Date.prototype.setTime.length );
- test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-3-n.js b/mozilla/js/tests/ecma/Date/15.9.5.23-3-n.js
index a0da4db6cf6..7161a1e8ed2 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-3-n.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,43 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-3-n.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var MYDATE = new MyDate(TIME_1970);
- var MYDATE = new MyDate(TIME_1970);
+DESCRIPTION = "MYDATE.setTime(TIME_2000)";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- "MYDATE.setTime(TIME_2000)",
- "error",
- MYDATE.setTime(TIME_2000) );
+new TestCase( SECTION,
+ "MYDATE.setTime(TIME_2000)",
+ "error",
+ eval("MYDATE.setTime(TIME_2000)") );
+
+test();
function MyDate(value) {
- this.value = value;
- this.setTime = Date.prototype.setTime;
- return this;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-4.js b/mozilla/js/tests/ecma/Date/15.9.5.23-4.js
index d1905e099f9..52ccf0457da 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,108 +35,94 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(time), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(time), test_times[j] );
+}
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).setTime()",
- NaN,
- (new Date(NaN)).setTime() );
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.setTime.length",
- 1,
- Date.prototype.setTime.length );
- test();
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-5.js b/mozilla/js/tests/ecma/Date/15.9.5.23-5.js
index 1cd47300b32..f2b02c84cff 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,108 +35,95 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(TIME_1970), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1970), test_times[j] );
+}
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).setTime()",
- NaN,
- (new Date(NaN)).setTime() );
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.setTime.length",
- 1,
- Date.prototype.setTime.length );
- test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-6.js b/mozilla/js/tests/ecma/Date/15.9.5.23-6.js
index 9f9e4663150..1672763ae2b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,108 +35,94 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(TIME_1900), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_1900), test_times[j] );
+}
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).setTime()",
- NaN,
- (new Date(NaN)).setTime() );
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.setTime.length",
- 1,
- Date.prototype.setTime.length );
- test();
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-7.js b/mozilla/js/tests/ecma/Date/15.9.5.23-7.js
index 2062f18ce4e..408000957e3 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,108 +35,95 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(TIME_2000), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(TIME_2000), test_times[j] );
+}
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).setTime()",
- NaN,
- (new Date(NaN)).setTime() );
+new TestCase( SECTION,
+ "(new Date(NaN)).setTime()",
+ NaN,
+ (new Date(NaN)).setTime() );
+
+new TestCase( SECTION,
+ "Date.prototype.setTime.length",
+ 1,
+ Date.prototype.setTime.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.setTime.length",
- 1,
- Date.prototype.setTime.length );
- test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-8.js b/mozilla/js/tests/ecma/Date/15.9.5.23-8.js
index 41b590a906a..daaabe7d6a8 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,97 +35,84 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
-
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(UTC_FEB_29_2000), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_FEB_29_2000), test_times[j] );
+}
+
+test();
- test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.23-9.js b/mozilla/js/tests/ecma/Date/15.9.5.23-9.js
index 13f4c81f9f6..12a42e5a59b 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.23-9.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.23-9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,98 +35,85 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.23-2.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: 15.9.5.23-2.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.23-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "15.9.5.23-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.setTime()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
- UTC_FEB_29_2000, UTC_JAN_1_2005 );
+test_times = new Array( now, time, TIME_1970, TIME_1900, TIME_2000,
+ UTC_FEB_29_2000, UTC_JAN_1_2005 );
- for ( var j = 0; j < test_times.length; j++ ) {
- addTestCase( new Date(UTC_JAN_1_2005), test_times[j] );
- }
+for ( var j = 0; j < test_times.length; j++ ) {
+ addTestCase( new Date(UTC_JAN_1_2005), test_times[j] );
+}
+
+test();
- test();
function addTestCase( d, t ) {
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+t+")",
- t,
- d.setTime(t) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+t+")",
+ t,
+ d.setTime(t) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1.1)+")",
- TimeClip(t+1.1),
- d.setTime(t+1.1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1.1)+")",
+ TimeClip(t+1.1),
+ d.setTime(t+1.1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+1)+")",
- t+1,
- d.setTime(t+1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+1)+")",
+ t+1,
+ d.setTime(t+1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-1)+")",
- t-1,
- d.setTime(t-1) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-1)+")",
+ t-1,
+ d.setTime(t-1) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
- t-TZ_ADJUST,
- d.setTime(t-TZ_ADJUST) );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t-TZ_ADJUST)+")",
+ t-TZ_ADJUST,
+ d.setTime(t-TZ_ADJUST) );
- testcases[tc++] = new TestCase( SECTION,
- "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
- t+TZ_ADJUST,
- d.setTime(t+TZ_ADJUST) );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "( "+d+" ).setTime("+(t+TZ_ADJUST)+")",
+ t+TZ_ADJUST,
+ d.setTime(t+TZ_ADJUST) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-1.js b/mozilla/js/tests/ecma/Date/15.9.5.24-1.js
index b6de886fab1..97d04befc7f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,133 +35,116 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, 0 );
+addTestCase( 0, 0 );
/*
- addTestCase( 0, -86400000 );
- addTestCase( 0, -2208988800000 );
- addTestCase( 0, 946684800000 );
+ addTestCase( 0, -86400000 );
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
// This test case is incorrect. Need to fix the DaylightSavings functions in
// shell.js for this to work properly.
// addTestCase( 0, -69609600000 );
// addTestCase( 0, "-69609600000" );
- addTestCase( 0, "0" );
- addTestCase( 0, "-2208988800000" );
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+addTestCase( 0, "0" );
+addTestCase( 0, "-2208988800000" );
+addTestCase( 0, "-86400000" );
+addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-2.js b/mozilla/js/tests/ecma/Date/15.9.5.24-2.js
index 4ac264cf9e0..8bb17caf7ac 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,132 +35,115 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, -86400000 );
+addTestCase( 0, -86400000 );
/*
- addTestCase( 0, -2208988800000 );
- addTestCase( 0, 946684800000 );
+ addTestCase( 0, -2208988800000 );
+ addTestCase( 0, 946684800000 );
// This test case is incorrect. Need to fix the DaylightSavings functions in
// shell.js for this to work properly.
// addTestCase( 0, -69609600000 );
// addTestCase( 0, "-69609600000" );
- addTestCase( 0, "0" );
- addTestCase( 0, "-2208988800000" );
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+addTestCase( 0, "0" );
+addTestCase( 0, "-2208988800000" );
+addTestCase( 0, "-86400000" );
+addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-3.js b/mozilla/js/tests/ecma/Date/15.9.5.24-3.js
index 0d3a472c576..5e87e69d399 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,131 +35,114 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, -2208988800000 );
+addTestCase( 0, -2208988800000 );
/*
- addTestCase( 0, 946684800000 );
+ addTestCase( 0, 946684800000 );
// This test case is incorrect. Need to fix the DaylightSavings functions in
// shell.js for this to work properly.
// addTestCase( 0, -69609600000 );
// addTestCase( 0, "-69609600000" );
- addTestCase( 0, "0" );
- addTestCase( 0, "-2208988800000" );
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+addTestCase( 0, "0" );
+addTestCase( 0, "-2208988800000" );
+addTestCase( 0, "-86400000" );
+addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-4.js b/mozilla/js/tests/ecma/Date/15.9.5.24-4.js
index 55652de03c6..f946223a7cb 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, 946684800000 );
+addTestCase( 0, 946684800000 );
/*
// This test case is incorrect. Need to fix the DaylightSavings functions in
@@ -82,82 +65,83 @@ function getTestCases() {
// addTestCase( 0, -69609600000 );
// addTestCase( 0, "-69609600000" );
- addTestCase( 0, "0" );
- addTestCase( 0, "-2208988800000" );
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+addTestCase( 0, "0" );
+addTestCase( 0, "-2208988800000" );
+addTestCase( 0, "-86400000" );
+addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-5.js b/mozilla/js/tests/ecma/Date/15.9.5.24-5.js
index 70e38c71c63..90069e4130c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,123 +35,106 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, "0" );
+addTestCase( 0, "0" );
/*
- addTestCase( 0, "-2208988800000" );
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+ addTestCase( 0, "-2208988800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-6.js b/mozilla/js/tests/ecma/Date/15.9.5.24-6.js
index 2f0326700df..26a38bf62bb 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,122 +35,105 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, "-2208988800000" );
+addTestCase( 0, "-2208988800000" );
/*
- addTestCase( 0, "-86400000" );
- addTestCase( 0, "946684800000" );
+ addTestCase( 0, "-86400000" );
+ addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-7.js b/mozilla/js/tests/ecma/Date/15.9.5.24-7.js
index 45fb7a18099..436987a7ad7 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,121 +35,104 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
-
- addTestCase( 0, "-86400000" );
+addTestCase( 0, "-86400000" );
/*
- addTestCase( 0, "946684800000" );
+ addTestCase( 0, "946684800000" );
*/
-}
+
+test();
+
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.24-8.js b/mozilla/js/tests/ecma/Date/15.9.5.24-8.js
index 5db2766af90..d7cc324e346 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.24-8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.24-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,117 +35,100 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.24-1.js
- ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
- Description:
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: 15.9.5.24-1.js
+ ECMA Section: 15.9.5.24 Date.prototype.setTime(time)
+ Description:
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var TITLE = "Date.prototype.setTime"
- var SECTION = "15.9.5.24-1";
- var VERSION = "ECMA_1";
- startTest();
+var TITLE = "Date.prototype.setTime"
+var SECTION = "15.9.5.24-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
+writeHeaderToLog( SECTION + " Date.prototype.setMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
+addTestCase( 0, "946684800000" );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
- addTestCase( 0, "946684800000" );
-}
function addTestCase( startms, newms ) {
- var DateCase = new Date( startms );
- DateCase.setMilliseconds( newms );
- var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
- var UTCDate = UTCDateFromTime( Number(newms) );
- var LocalDate = LocalDateFromTime( Number(newms) );
+ var DateCase = new Date( startms );
+ DateCase.setMilliseconds( newms );
+ var DateString = "var date = new Date("+ startms +"); date.setMilliseconds("+ newms +"); date";
+ var UTCDate = UTCDateFromTime( Number(newms) );
+ var LocalDate = LocalDateFromTime( Number(newms) );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.25-1.js b/mozilla/js/tests/ecma/Date/15.9.5.25-1.js
index d656a0a8c34..0af879d8f9c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.25-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.25-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 15.9.5.25-1.js
ECMA Section: 15.9.5.25 Date.prototype.setUTCMilliseconds(ms)
@@ -53,25 +55,6 @@
writeHeaderToLog( SECTION + " Date.prototype.setUTCMilliseconds(ms)");
- var testcases = new Array();
- getTestCases();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
addNewTestCase( 0, 0, "TDATE = new Date(0);(TDATE).setUTCMilliseconds(0);TDATE",
UTCDateFromTime(SetUTCMilliseconds(0,0)),
LocalDateFromTime(SetUTCMilliseconds(0,0)) );
@@ -125,39 +108,40 @@ function getTestCases() {
addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('946684800000');TEST_DATE", UTCDateFromTime(946684800000), LocalDateFromTime(946684800000) );
addNewTestCase( "TEST_DATE = new Date(0);(TEST_DATE).setMilliseconds('-69609600000');TEST_DATE", UTCDateFromTime(-69609600000), LocalDateFromTime(-69609600000) );
*/
-}
+
+test();
+
function addNewTestCase( initialTime, ms, DateString, UTCDate, LocalDate) {
DateCase = new Date(initialTime);
DateCase.setUTCMilliseconds(ms);
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
+ new TestCase( SECTION,
DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
"[object Date]",
DateCase.toString() );
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.26-1.js b/mozilla/js/tests/ecma/Date/15.9.5.26-1.js
index 503b87d07f9..d7937571b7c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.26-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.26-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,185 +35,168 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/** File Name: 15.9.5.26-1.js
- ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms])
- Description:
+ ECMA Section: 15.9.5.26 Date.prototype.setSeconds(sec [,ms])
+ Description:
- If ms is not specified, this behaves as if ms were specified with the
- value getMilliseconds( ).
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
- 1. Let t be the result of LocalTime(this time value).
- 2. Call ToNumber(sec).
- 3. If ms is not specified, compute msFromTime(t); otherwise, call
- ToNumber(ms).
- 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2),
- Result(3)).
- 5. Compute UTC(MakeDate(Day(t), Result(4))).
- 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
- 7. Return the value of the [[Value]] property of the this value.
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2),
+ Result(3)).
+ 5. Compute UTC(MakeDate(Day(t), Result(4))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.26-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.26-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )");
+writeHeaderToLog( SECTION + " Date.prototype.setSeconds(sec [,ms] )");
- var testcases = new Array();
- getTestCases();
- test();
+addNewTestCase( 0, 0, 0,
+ "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE",
+ UTCDateFromTime(SetSeconds(0,0,0)),
+ LocalDateFromTime(SetSeconds(0,0,0)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,59,999)),
+ LocalDateFromTime(SetSeconds(28800000,59,999)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,999)),
+ LocalDateFromTime(SetSeconds(28800000,999,999)) );
-function getTestCases() {
- addNewTestCase( 0, 0, 0,
- "TDATE = new Date(0);(TDATE).setSeconds(0,0);TDATE",
- UTCDateFromTime(SetSeconds(0,0,0)),
- LocalDateFromTime(SetSeconds(0,0,0)) );
+addNewTestCase( 28800000,999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,999,0)),
+ LocalDateFromTime(SetSeconds(28800000,999,0)) );
- addNewTestCase( 28800000,59,999,
- "TDATE = new Date(28800000);(TDATE).setSeconds(59,999);TDATE",
- UTCDateFromTime(SetSeconds(28800000,59,999)),
- LocalDateFromTime(SetSeconds(28800000,59,999)) );
+addNewTestCase( 28800000,-28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE",
+ UTCDateFromTime(SetSeconds(28800000,-28800)),
+ LocalDateFromTime(SetSeconds(28800000,-28800)) );
- addNewTestCase( 28800000,999,999,
- "TDATE = new Date(28800000);(TDATE).setSeconds(999,999);TDATE",
- UTCDateFromTime(SetSeconds(28800000,999,999)),
- LocalDateFromTime(SetSeconds(28800000,999,999)) );
+addNewTestCase( 946684800000,1234567,void 0,
+ "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE",
+ UTCDateFromTime(SetSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetSeconds(946684800000,1234567)) );
- addNewTestCase( 28800000,999, void 0,
- "TDATE = new Date(28800000);(TDATE).setSeconds(999);TDATE",
- UTCDateFromTime(SetSeconds(28800000,999,0)),
- LocalDateFromTime(SetSeconds(28800000,999,0)) );
-
- addNewTestCase( 28800000,-28800, void 0,
- "TDATE = new Date(28800000);(TDATE).setSeconds(-28800);TDATE",
- UTCDateFromTime(SetSeconds(28800000,-28800)),
- LocalDateFromTime(SetSeconds(28800000,-28800)) );
-
- addNewTestCase( 946684800000,1234567,void 0,
- "TDATE = new Date(946684800000);(TDATE).setSeconds(1234567);TDATE",
- UTCDateFromTime(SetSeconds(946684800000,1234567)),
- LocalDateFromTime(SetSeconds(946684800000,1234567)) );
-
- addNewTestCase( -2208988800000,59,999,
- "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE",
- UTCDateFromTime(SetSeconds(-2208988800000,59,999)),
- LocalDateFromTime(SetSeconds(-2208988800000,59,999)) );
+addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setSeconds(59,999);TDATE",
+ UTCDateFromTime(SetSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetSeconds(-2208988800000,59,999)) );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
-function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) {
- DateCase = new Date( startTime );
- if ( ms != void 0 ) {
- DateCase.setSeconds( sec, ms );
- } else {
- DateCase.setSeconds( sec );
- }
- var item = testcases.length;
+test();
+
+function addNewTestCase( startTime, sec, ms, DateString,UTCDate, LocalDate) {
+ DateCase = new Date( startTime );
+ if ( ms != void 0 ) {
+ DateCase.setSeconds( sec, ms );
+ } else {
+ DateCase.setSeconds( sec );
+ }
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetSeconds( t, s, m ) {
- var MS = ( m == void 0 ) ? msFromTime(t) : Number( m );
- var TIME = LocalTime( t );
- var SEC = Number(s);
- var RESULT4 = MakeTime( HourFromTime( TIME ),
- MinFromTime( TIME ),
- SEC,
- MS );
- var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4));
- return ( TimeClip(UTC_TIME) );
+ var MS = ( m == void 0 ) ? msFromTime(t) : Number( m );
+ var TIME = LocalTime( t );
+ var SEC = Number(s);
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ var UTC_TIME = UTC(MakeDate(Day(TIME), RESULT4));
+ return ( TimeClip(UTC_TIME) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.27-1.js b/mozilla/js/tests/ecma/Date/15.9.5.27-1.js
index 8e077c9b219..2eb588c0757 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.27-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.27-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,184 +35,168 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.27-1.js
- ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms])
- Description:
+ File Name: 15.9.5.27-1.js
+ ECMA Section: 15.9.5.27 Date.prototype.setUTCSeconds(sec [,ms])
+ Description:
- If ms is not specified, this behaves as if ms were specified with the
- value getUTCMilliseconds( ).
+ If ms is not specified, this behaves as if ms were specified with the
+ value getUTCMilliseconds( ).
- 1. Let t be this time value.
- 2. Call ToNumber(sec).
- 3. If ms is not specified, compute msFromTime(t); otherwise, call
- ToNumber(ms)
- 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3))
- 5. Compute MakeDate(Day(t), Result(4)).
- 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
- 7. Return the value of the [[Value]] property of the this value.
+ 1. Let t be this time value.
+ 2. Call ToNumber(sec).
+ 3. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms)
+ 4. Compute MakeTime(HourFromTime(t), MinFromTime(t), Result(2), Result(3))
+ 5. Compute MakeDate(Day(t), Result(4)).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.27-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.27-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCSeconds(sec [,ms] )");
- getTestCases();
- test();
+addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE",
+ UTCDateFromTime(SetUTCSeconds(0,0,0)),
+ LocalDateFromTime(SetUTCSeconds(0,0,0)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000,59,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,59,999)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000,999,999,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,999)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,999)) );
-function getTestCases() {
- addNewTestCase( 0, 0, 0, "TDATE = new Date(0);(TDATE).setUTCSeconds(0,0);TDATE",
- UTCDateFromTime(SetUTCSeconds(0,0,0)),
- LocalDateFromTime(SetUTCSeconds(0,0,0)) );
+addNewTestCase( 28800000, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,999,0)),
+ LocalDateFromTime(SetUTCSeconds(28800000,999,0)) );
- addNewTestCase( 28800000,59,999,
- "TDATE = new Date(28800000);(TDATE).setUTCSeconds(59,999);TDATE",
- UTCDateFromTime(SetUTCSeconds(28800000,59,999)),
- LocalDateFromTime(SetUTCSeconds(28800000,59,999)) );
+addNewTestCase( 28800000, -28800, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE",
+ UTCDateFromTime(SetUTCSeconds(28800000,-28800)),
+ LocalDateFromTime(SetUTCSeconds(28800000,-28800)) );
- addNewTestCase( 28800000,999,999,
- "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999,999);TDATE",
- UTCDateFromTime(SetUTCSeconds(28800000,999,999)),
- LocalDateFromTime(SetUTCSeconds(28800000,999,999)) );
+addNewTestCase( 946684800000, 1234567, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE",
+ UTCDateFromTime(SetUTCSeconds(946684800000,1234567)),
+ LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) );
- addNewTestCase( 28800000, 999, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCSeconds(999);TDATE",
- UTCDateFromTime(SetUTCSeconds(28800000,999,0)),
- LocalDateFromTime(SetUTCSeconds(28800000,999,0)) );
-
- addNewTestCase( 28800000, -28800, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCSeconds(-28800);TDATE",
- UTCDateFromTime(SetUTCSeconds(28800000,-28800)),
- LocalDateFromTime(SetUTCSeconds(28800000,-28800)) );
-
- addNewTestCase( 946684800000, 1234567, void 0,
- "TDATE = new Date(946684800000);(TDATE).setUTCSeconds(1234567);TDATE",
- UTCDateFromTime(SetUTCSeconds(946684800000,1234567)),
- LocalDateFromTime(SetUTCSeconds(946684800000,1234567)) );
-
- addNewTestCase( -2208988800000,59,999,
- "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE",
- UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)),
- LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) );
+addNewTestCase( -2208988800000,59,999,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCSeconds(59,999);TDATE",
+ UTCDateFromTime(SetUTCSeconds(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCSeconds(-2208988800000,59,999)) );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
+
+test();
+
function addNewTestCase( startTime, sec, ms, DateString, UTCDate, LocalDate) {
- DateCase = new Date( startTime );
- if ( ms == void 0) {
- DateCase.setSeconds( sec );
- } else {
- DateCase.setSeconds( sec, ms );
- }
+ DateCase = new Date( startTime );
+ if ( ms == void 0) {
+ DateCase.setSeconds( sec );
+ } else {
+ DateCase.setSeconds( sec, ms );
+ }
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCSeconds( t, s, m ) {
- var TIME = t;
- var SEC = Number(s);
- var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m );
- var RESULT4 = MakeTime( HourFromTime( TIME ),
- MinFromTime( TIME ),
- SEC,
- MS );
- return ( TimeClip(MakeDate(Day(TIME), RESULT4)) );
+ var TIME = t;
+ var SEC = Number(s);
+ var MS = ( m == void 0 ) ? msFromTime(TIME) : Number( m );
+ var RESULT4 = MakeTime( HourFromTime( TIME ),
+ MinFromTime( TIME ),
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT4)) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.28-1.js b/mozilla/js/tests/ecma/Date/15.9.5.28-1.js
index f03796d3107..2966d1f4c35 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.28-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.28-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,198 +35,181 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.28-1.js
- ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
- Description:
- If sec is not specified, this behaves as if sec were specified with the
- value getSeconds ( ).
+ File Name: 15.9.5.28-1.js
+ ECMA Section: 15.9.5.28 Date.prototype.setMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getSeconds ( ).
- If ms is not specified, this behaves as if ms were specified with the
- value getMilliseconds( ).
+ If ms is not specified, this behaves as if ms were specified with the
+ value getMilliseconds( ).
- 1. Let t be the result of LocalTime(this time value).
- 2. Call ToNumber(min).
- 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
- 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
- 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
- 6. Compute UTC(MakeDate(Day(t), Result(5))).
- 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
- 8. Return the value of the [[Value]] property of the this value.
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute UTC(MakeDate(Day(t), Result(5))).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.28-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.28-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
+writeHeaderToLog( SECTION + " Date.prototype.setMinutes(sec [,ms] )");
- getTestCases();
- test();
+addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
+ UTCDateFromTime(SetMinutes(0,0,0,0)),
+ LocalDateFromTime(SetMinutes(0,0,0,0)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59)),
+ LocalDateFromTime(SetMinutes(28800000,59,59)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
-function getTestCases() {
- addNewTestCase( 0, 0, void 0, void 0,
- "TDATE = new Date(0);(TDATE).setMinutes(0);TDATE",
- UTCDateFromTime(SetMinutes(0,0,0,0)),
- LocalDateFromTime(SetMinutes(0,0,0,0)) );
+addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,59,0)),
+ LocalDateFromTime(SetMinutes(28800000,59,0)) );
- addNewTestCase( 28800000, 59, 59, void 0,
- "TDATE = new Date(28800000);(TDATE).setMinutes(59,59);TDATE",
- UTCDateFromTime(SetMinutes(28800000,59,59)),
- LocalDateFromTime(SetMinutes(28800000,59,59)) );
+addNewTestCase( 28800000, -480, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
+ UTCDateFromTime(SetMinutes(28800000,-480)),
+ LocalDateFromTime(SetMinutes(28800000,-480)) );
- addNewTestCase( 28800000, 59, 59, 999,
- "TDATE = new Date(28800000);(TDATE).setMinutes(59,59,999);TDATE",
- UTCDateFromTime(SetMinutes(28800000,59,59,999)),
- LocalDateFromTime(SetMinutes(28800000,59,59,999)) );
+addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
+ UTCDateFromTime(SetMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetMinutes(946684800000,1234567)) );
- addNewTestCase( 28800000, 59, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setMinutes(59);TDATE",
- UTCDateFromTime(SetMinutes(28800000,59,0)),
- LocalDateFromTime(SetMinutes(28800000,59,0)) );
+addNewTestCase( -2208988800000,59, 59, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
- addNewTestCase( 28800000, -480, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setMinutes(-480);TDATE",
- UTCDateFromTime(SetMinutes(28800000,-480)),
- LocalDateFromTime(SetMinutes(28800000,-480)) );
-
- addNewTestCase( 946684800000, 1234567, void 0, void 0,
- "TDATE = new Date(946684800000);(TDATE).setMinutes(1234567);TDATE",
- UTCDateFromTime(SetMinutes(946684800000,1234567)),
- LocalDateFromTime(SetMinutes(946684800000,1234567)) );
-
- addNewTestCase( -2208988800000,59, 59, void 0,
- "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59);TDATE",
- UTCDateFromTime(SetMinutes(-2208988800000,59,59)),
- LocalDateFromTime(SetMinutes(-2208988800000,59,59)) );
-
- addNewTestCase( -2208988800000, 59, 59, 999,
- "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
- UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
- LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
+addNewTestCase( -2208988800000, 59, 59, 999,
+ "TDATE = new Date(-2208988800000);(TDATE).setMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetMinutes(-2208988800000,59,59,999)),
+ LocalDateFromTime(SetMinutes(-2208988800000,59,59,999)) );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
+test();
+
function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
- DateCase = new Date( time );
+ DateCase = new Date( time );
- if ( sec == void 0 ) {
- DateCase.setMinutes( min );
+ if ( sec == void 0 ) {
+ DateCase.setMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setMinutes( min, sec );
} else {
- if ( ms == void 0 ) {
- DateCase.setMinutes( min, sec );
- } else {
- DateCase.setMinutes( min, sec, ms );
- }
+ DateCase.setMinutes( min, sec, ms );
}
+ }
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetMinutes( t, min, sec, ms ) {
- var TIME = LocalTime(t);
- var MIN = Number(min);
- var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
- var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
- var RESULT5 = MakeTime( HourFromTime( TIME ),
- MIN,
- SEC,
- MS );
- return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
+ var TIME = LocalTime(t);
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(UTC( MakeDate(Day(TIME),RESULT5))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.29-1.js b/mozilla/js/tests/ecma/Date/15.9.5.29-1.js
index 3ea01a34956..ce9d1c700f1 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.29-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.29-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,192 +35,175 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.29-1.js
- ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] )
- Description:
- If sec is not specified, this behaves as if sec were specified with the
- value getUTCSeconds ( ).
+ File Name: 15.9.5.29-1.js
+ ECMA Section: 15.9.5.29 Date.prototype.setUTCMinutes(min [, sec [, ms ]] )
+ Description:
+ If sec is not specified, this behaves as if sec were specified with the
+ value getUTCSeconds ( ).
- If ms is not specified, this behaves as if ms were specified with the value
- getUTCMilliseconds( ).
+ If ms is not specified, this behaves as if ms were specified with the value
+ getUTCMilliseconds( ).
- 1. Let t be this time value.
- 2. Call ToNumber(min).
- 3. If sec is not specified, compute SecFromTime(t); otherwise, call
- ToNumber(sec).
- 4. If ms is not specified, compute msFromTime(t); otherwise, call
- ToNumber(ms).
- 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
- 6. Compute MakeDate(Day(t), Result(5)).
- 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
- 8. Return the value of the [[Value]] property of the this value.
+ 1. Let t be this time value.
+ 2. Call ToNumber(min).
+ 3. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 4. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 5. Compute MakeTime(HourFromTime(t), Result(2), Result(3), Result(4)).
+ 6. Compute MakeDate(Day(t), Result(5)).
+ 7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
+ 8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.29-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.29-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCMinutes( min [, sec, ms] )");
- getTestCases();
- test();
+addNewTestCase( 0, 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE",
+ UTCDateFromTime(SetUTCMinutes(0,0,0,0)),
+ LocalDateFromTime(SetUTCMinutes(0,0,0,0)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000, 59, 59, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000, 59, 59, 999,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) );
-function getTestCases() {
- addNewTestCase( 0, 0, void 0, void 0,
- "TDATE = new Date(0);(TDATE).setUTCMinutes(0);TDATE",
- UTCDateFromTime(SetUTCMinutes(0,0,0,0)),
- LocalDateFromTime(SetUTCMinutes(0,0,0,0)) );
+addNewTestCase( 28800000, 59, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,59)),
+ LocalDateFromTime(SetUTCMinutes(28800000,59)) );
- addNewTestCase( 28800000, 59, 59, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59);TDATE",
- UTCDateFromTime(SetUTCMinutes(28800000,59,59)),
- LocalDateFromTime(SetUTCMinutes(28800000,59,59)) );
+addNewTestCase( 28800000, -480, 0, 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE",
+ UTCDateFromTime(SetUTCMinutes(28800000,-480)),
+ LocalDateFromTime(SetUTCMinutes(28800000,-480)) );
- addNewTestCase( 28800000, 59, 59, 999,
- "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59,59,999);TDATE",
- UTCDateFromTime(SetUTCMinutes(28800000,59,59,999)),
- LocalDateFromTime(SetUTCMinutes(28800000,59,59,999)) );
+addNewTestCase( 946684800000, 1234567, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE",
+ UTCDateFromTime(SetUTCMinutes(946684800000,1234567)),
+ LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) );
- addNewTestCase( 28800000, 59, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCMinutes(59);TDATE",
- UTCDateFromTime(SetUTCMinutes(28800000,59)),
- LocalDateFromTime(SetUTCMinutes(28800000,59)) );
-
- addNewTestCase( 28800000, -480, 0, 0,
- "TDATE = new Date(28800000);(TDATE).setUTCMinutes(-480);TDATE",
- UTCDateFromTime(SetUTCMinutes(28800000,-480)),
- LocalDateFromTime(SetUTCMinutes(28800000,-480)) );
-
- addNewTestCase( 946684800000, 1234567, void 0, void 0,
- "TDATE = new Date(946684800000);(TDATE).setUTCMinutes(1234567);TDATE",
- UTCDateFromTime(SetUTCMinutes(946684800000,1234567)),
- LocalDateFromTime(SetUTCMinutes(946684800000,1234567)) );
-
- addNewTestCase( -2208988800000, 59, 999, void 0,
- "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE",
- UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)),
- LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) );
+addNewTestCase( -2208988800000, 59, 999, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCMinutes(59,999);TDATE",
+ UTCDateFromTime(SetUTCMinutes(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCMinutes(-2208988800000,59,999)) );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
+test();
+
function addNewTestCase( time, min, sec, ms, DateString, UTCDate, LocalDate) {
- var DateCase = new Date( time );
+ var DateCase = new Date( time );
- if ( sec == void 0 ) {
- DateCase.setUTCMinutes( min );
+ if ( sec == void 0 ) {
+ DateCase.setUTCMinutes( min );
+ } else {
+ if ( ms == void 0 ) {
+ DateCase.setUTCMinutes( min, sec );
} else {
- if ( ms == void 0 ) {
- DateCase.setUTCMinutes( min, sec );
- } else {
- DateCase.setUTCMinutes( min, sec, ms );
- }
+ DateCase.setUTCMinutes( min, sec, ms );
}
+ }
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+// new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
-// testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+// new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCMinutes( t, min, sec, ms ) {
- var TIME = t;
- var MIN = Number(min);
- var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
- var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
- var RESULT5 = MakeTime( HourFromTime( TIME ),
- MIN,
- SEC,
- MS );
- return ( TimeClip(MakeDate(Day(TIME),RESULT5)) );
+ var TIME = t;
+ var MIN = Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT5 = MakeTime( HourFromTime( TIME ),
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME),RESULT5)) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.3-1-n.js b/mozilla/js/tests/ecma/Date/15.9.5.3-1-n.js
index a2a12d6ee72..9faa8ceadf5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.3-1-n.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.3-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,55 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.3-1.js
- ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
- Description:
+ File Name: 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
- The valueOf function returns a number, which is this time value.
+ The valueOf function returns a number, which is this time value.
- The valueOf function is not generic; it generates a runtime error if
- its this value is not a Date object. Therefore it cannot be transferred
- to other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.3-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.valueOf";
+var SECTION = "15.9.5.3-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.valueOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var OBJ = new MyObject( new Date(0) );
- var OBJ = new MyObject( new Date(0) );
+DESCRIPTION = "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()",
- "error",
- OBJ.valueOf() );
- test();
+new TestCase( SECTION,
+ "var OBJ = new MyObject( new Date(0) ); OBJ.valueOf()",
+ "error",
+ eval("OBJ.valueOf()") );
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = Date.prototype.valueOf;
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
// The following line causes an infinte loop
// this.toString = new Function( "return this+\"\";");
- return this;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return this;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.3-2.js b/mozilla/js/tests/ecma/Date/15.9.5.3-2.js
index d66e67107d8..68594b10a38 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.3-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,89 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.3-2.js
- ECMA Section: 15.9.5.3-2 Date.prototype.valueOf
- Description:
+ File Name: 15.9.5.3-2.js
+ ECMA Section: 15.9.5.3-2 Date.prototype.valueOf
+ Description:
- The valueOf function returns a number, which is this time value.
+ The valueOf function returns a number, which is this time value.
- The valueOf function is not generic; it generates a runtime error if
- its this value is not a Date object. Therefore it cannot be transferred
- to other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.valueOf";
+var SECTION = "15.9.5.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.valueOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
+var now = (new Date()).valueOf();
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_29_FEB_2000 );
+addTestCase( UTC_1_JAN_2005 );
- var TZ_ADJUST = TZ_DIFF * msPerHour;
- var now = (new Date()).valueOf();
- var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
-
- addTestCase( now );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_29_FEB_2000 );
- addTestCase( UTC_1_JAN_2005 );
-
- test();
+test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+").valueOf()",
- t,
- (new Date(t)).valueOf() );
+ new TestCase( SECTION,
+ "(new Date("+t+").valueOf()",
+ t,
+ (new Date(t)).valueOf() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+").valueOf()",
- t+1,
- (new Date(t+1)).valueOf() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+").valueOf()",
+ t+1,
+ (new Date(t+1)).valueOf() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+").valueOf()",
- t-1,
- (new Date(t-1)).valueOf() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+").valueOf()",
+ t-1,
+ (new Date(t-1)).valueOf() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+").valueOf()",
- t-TZ_ADJUST,
- (new Date(t-TZ_ADJUST)).valueOf() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").valueOf()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).valueOf() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+").valueOf()",
- t+TZ_ADJUST,
- (new Date(t+TZ_ADJUST)).valueOf() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").valueOf()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).valueOf() );
}
function MyObject( value ) {
- this.value = value;
- this.valueOf = Date.prototype.valueOf;
- this.toString = new Function( "return this+\"\";");
- return this;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
+ this.toString = new Function( "return this+\"\";");
+ return this;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.30-1.js b/mozilla/js/tests/ecma/Date/15.9.5.30-1.js
index 4308c62c68d..609342754b9 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.30-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.30-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,197 +35,179 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.30-1.js
- ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] )
- Description:
- If min is not specified, this behaves as if min were specified with the
- value getMinutes( ). If sec is not specified, this behaves as if sec were
- specified with the value getSeconds ( ). If ms is not specified, this
- behaves as if ms were specified with the value getMilliseconds( ).
+ File Name: 15.9.5.30-1.js
+ ECMA Section: 15.9.5.30 Date.prototype.setHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the
+ value getMinutes( ). If sec is not specified, this behaves as if sec were
+ specified with the value getSeconds ( ). If ms is not specified, this
+ behaves as if ms were specified with the value getMilliseconds( ).
- 1. Let t be the result of LocalTime(this time value).
- 2. Call ToNumber(hour).
- 3. If min is not specified, compute MinFromTime(t); otherwise, call
- ToNumber(min).
- 4. If sec is not specified, compute SecFromTime(t); otherwise, call
- ToNumber(sec).
- 5. If ms is not specified, compute msFromTime(t); otherwise, call
- ToNumber(ms).
- 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
- 7. Compute UTC(MakeDate(Day(t), Result(6))).
- 8. Set the [[Value]] property of the this value to TimeClip(Result(7)).
- 9. Return the value of the [[Value]] property of the this value.
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(hour).
+ 3. If min is not specified, compute MinFromTime(t); otherwise, call
+ ToNumber(min).
+ 4. If sec is not specified, compute SecFromTime(t); otherwise, call
+ ToNumber(sec).
+ 5. If ms is not specified, compute msFromTime(t); otherwise, call
+ ToNumber(ms).
+ 6. Compute MakeTime(Result(2), Result(3), Result(4), Result(5)).
+ 7. Compute UTC(MakeDate(Day(t), Result(6))).
+ 8. Set the [[Value]] property of the this value to TimeClip(Result(7)).
+ 9. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.30-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.30-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )");
+writeHeaderToLog( SECTION + " Date.prototype.setHours( hour [, min, sec, ms] )");
- getTestCases();
- test();
+addNewTestCase( 0,0,0,0,void 0,
+ "TDATE = new Date(0);(TDATE).setHours(0);TDATE" );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000, 23, 59, 999,void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000, 999, 999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" );
-function getTestCases() {
- addNewTestCase( 0,0,0,0,void 0,
- "TDATE = new Date(0);(TDATE).setHours(0);TDATE" );
+addNewTestCase( 28800000,999,0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" );
- addNewTestCase( 28800000, 23, 59, 999,void 0,
- "TDATE = new Date(28800000);(TDATE).setHours(23,59,999);TDATE" );
+addNewTestCase( 28800000,-8, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" );
- addNewTestCase( 28800000, 999, 999, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setHours(999,999);TDATE" );
-
- addNewTestCase( 28800000,999,0, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setHours(999);TDATE" );
-
- addNewTestCase( 28800000,-8, void 0, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setHours(-8);TDATE" );
-
- addNewTestCase( 946684800000,8760, void 0, void 0, void 0,
+addNewTestCase( 946684800000,8760, void 0, void 0, void 0,
"TDATE = new Date(946684800000);(TDATE).setHours(8760);TDATE" );
- addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999,
- "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" );
+addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 999,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,999)" );
- addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000,
- "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" );
+addNewTestCase( TIME_2000 - msPerDay, 23, 59, 59, 1000,
+ "d = new Date( " + (TIME_2000-msPerDay) +"); d.setHours(23,59,59,1000)" );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setHours(59,999);TDATE",
- UTCDateFromTime(SetHours(-2208988800000,59,999)),
- LocalDateFromTime(SetHours(-2208988800000,59,999)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setHours(59,999);TDATE",
+ UTCDateFromTime(SetHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetHours(-2208988800000,59,999)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
+test();
+
function addNewTestCase( time, hours, min, sec, ms, DateString) {
- var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms ));
- var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms ));
+ var UTCDate = UTCDateFromTime( SetHours( time, hours, min, sec, ms ));
+ var LocalDate = LocalDateFromTime( SetHours( time, hours, min, sec, ms ));
- var DateCase = new Date( time );
+ var DateCase = new Date( time );
- if ( min == void 0 ) {
- DateCase.setHours( hours );
+ if ( min == void 0 ) {
+ DateCase.setHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setHours( hours, min );
} else {
- if ( sec == void 0 ) {
- DateCase.setHours( hours, min );
- } else {
- if ( ms == void 0 ) {
- DateCase.setHours( hours, min, sec );
- } else {
- DateCase.setHours( hours, min, sec, ms );
- }
- }
+ if ( ms == void 0 ) {
+ DateCase.setHours( hours, min, sec );
+ } else {
+ DateCase.setHours( hours, min, sec, ms );
+ }
}
+ }
- var item = testcases.length;
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ DateCase.toString = Object.prototype.toString;
- DateCase.toString = Object.prototype.toString;
-
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.day = WeekDay( t );
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( t );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- return (d);
+ return (d);
}
function SetHours( t, hour, min, sec, ms ) {
- var TIME = LocalTime(t);
- var HOUR = Number(hour);
- var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
- var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
- var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
- var RESULT6 = MakeTime( HOUR,
- MIN,
- SEC,
- MS );
- var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) );
- return ( TimeClip(UTC_TIME) );
+ var TIME = LocalTime(t);
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ var UTC_TIME = UTC( MakeDate(Day(TIME), RESULT6) );
+ return ( TimeClip(UTC_TIME) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.31-1.js b/mozilla/js/tests/ecma/Date/15.9.5.31-1.js
index d3773bd55c4..d47359988b8 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.31-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.31-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,13 +35,14 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.31-1.js
- ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )
- Description:
- If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ).
- If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ).
- If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ).
+ File Name: 15.9.5.31-1.js
+ ECMA Section: 15.9.5.31 Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )
+ Description:
+ If min is not specified, this behaves as if min were specified with the value getUTCMinutes( ).
+ If sec is not specified, this behaves as if sec were specified with the value getUTCSeconds ( ).
+ If ms is not specified, this behaves as if ms were specified with the value getUTCMilliseconds( ).
1.Let t be this time value.
2.Call ToNumber(hour).
@@ -52,176 +54,158 @@
8.Set the [[Value]] property of the this value to TimeClip(Result(7)).
1.Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.31-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.31-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCHours(hour [, min [, sec [, ms ]]] )");
- getTestCases();
- test();
+addNewTestCase( 0, 0, void 0, void 0, void 0,
+ "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE",
+ UTCDateFromTime(SetUTCHours(0,0,0,0)),
+ LocalDateFromTime(SetUTCHours(0,0,0,0)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( 28800000, 23, 59, 999, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,23,59,999)),
+ LocalDateFromTime(SetUTCHours(28800000,23,59,999)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( 28800000,999,999, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,999)),
+ LocalDateFromTime(SetUTCHours(28800000,999,999)) );
-function getTestCases() {
- addNewTestCase( 0, 0, void 0, void 0, void 0,
- "TDATE = new Date(0);(TDATE).setUTCHours(0);TDATE",
- UTCDateFromTime(SetUTCHours(0,0,0,0)),
- LocalDateFromTime(SetUTCHours(0,0,0,0)) );
+addNewTestCase( 28800000, 999, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,999,0)),
+ LocalDateFromTime(SetUTCHours(28800000,999,0)) );
- addNewTestCase( 28800000, 23, 59, 999, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCHours(23,59,999);TDATE",
- UTCDateFromTime(SetUTCHours(28800000,23,59,999)),
- LocalDateFromTime(SetUTCHours(28800000,23,59,999)) );
+addNewTestCase( 28800000, -8670, void 0, void 0, void 0,
+ "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE",
+ UTCDateFromTime(SetUTCHours(28800000,-8670)),
+ LocalDateFromTime(SetUTCHours(28800000,-8670)) );
- addNewTestCase( 28800000,999,999, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCHours(999,999);TDATE",
- UTCDateFromTime(SetUTCHours(28800000,999,999)),
- LocalDateFromTime(SetUTCHours(28800000,999,999)) );
+addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
+ "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
+ UTCDateFromTime(SetUTCHours(946684800000,1234567)),
+ LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
- addNewTestCase( 28800000, 999, void 0, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCHours(999);TDATE",
- UTCDateFromTime(SetUTCHours(28800000,999,0)),
- LocalDateFromTime(SetUTCHours(28800000,999,0)) );
-
- addNewTestCase( 28800000, -8670, void 0, void 0, void 0,
- "TDATE = new Date(28800000);(TDATE).setUTCHours(-8670);TDATE",
- UTCDateFromTime(SetUTCHours(28800000,-8670)),
- LocalDateFromTime(SetUTCHours(28800000,-8670)) );
-
- addNewTestCase( 946684800000, 1234567, void 0, void 0, void 0,
- "TDATE = new Date(946684800000);(TDATE).setUTCHours(1234567);TDATE",
- UTCDateFromTime(SetUTCHours(946684800000,1234567)),
- LocalDateFromTime(SetUTCHours(946684800000,1234567)) );
-
- addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
- "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
- UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
- LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) );
+addNewTestCase( -2208988800000, 59, 999, void 0, void 0,
+ "TDATE = new Date(-2208988800000);(TDATE).setUTCHours(59,999);TDATE",
+ UTCDateFromTime(SetUTCHours(-2208988800000,59,999)),
+ LocalDateFromTime(SetUTCHours(-2208988800000,59,999)) );
/*
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456789);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456789)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,123456)) );
- addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
- LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
+ addNewTestCase( "TDATE = new Date(-2208988800000);(TDATE).setUTCMilliseconds(-123456);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)),
+ LocalDateFromTime(SetUTCMilliseconds(-2208988800000,-123456)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
- UTCDateFromTime(SetUTCMilliseconds(0,-999)),
- LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMilliseconds(-999);TDATE",
+ UTCDateFromTime(SetUTCMilliseconds(0,-999)),
+ LocalDateFromTime(SetUTCMilliseconds(0,-999)) );
*/
-}
+test();
+
function addNewTestCase( time, hours, min, sec, ms, DateString, UTCDate, LocalDate) {
- DateCase = new Date(time);
- if ( min == void 0 ) {
- DateCase.setUTCHours( hours );
+ DateCase = new Date(time);
+ if ( min == void 0 ) {
+ DateCase.setUTCHours( hours );
+ } else {
+ if ( sec == void 0 ) {
+ DateCase.setUTCHours( hours, min );
} else {
- if ( sec == void 0 ) {
- DateCase.setUTCHours( hours, min );
- } else {
- if ( ms == void 0 ) {
- DateCase.setUTCHours( hours, min, sec );
- } else {
- DateCase.setUTCHours( hours, min, sec, ms );
- }
- }
+ if ( ms == void 0 ) {
+ DateCase.setUTCHours( hours, min, sec );
+ } else {
+ DateCase.setUTCHours( hours, min, sec, ms );
+ }
}
+ }
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCHours( t, hour, min, sec, ms ) {
- var TIME = t;
- var HOUR = Number(hour);
- var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
- var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
- var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
- var RESULT6 = MakeTime( HOUR,
- MIN,
- SEC,
- MS );
- return ( TimeClip(MakeDate(Day(TIME), RESULT6)) );
+ var TIME = t;
+ var HOUR = Number(hour);
+ var MIN = ( min == void 0) ? MinFromTime(TIME) : Number(min);
+ var SEC = ( sec == void 0) ? SecFromTime(TIME) : Number(sec);
+ var MS = ( ms == void 0 ) ? msFromTime(TIME) : Number(ms);
+ var RESULT6 = MakeTime( HOUR,
+ MIN,
+ SEC,
+ MS );
+ return ( TimeClip(MakeDate(Day(TIME), RESULT6)) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.32-1.js b/mozilla/js/tests/ecma/Date/15.9.5.32-1.js
index 59fb514648e..64127f761b4 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.32-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.32-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,139 +35,122 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.32-1.js
- ECMA Section: 15.9.5.32 Date.prototype.setDate(date)
- Description:
- 1. Let t be the result of LocalTime(this time value).
- 2. Call ToNumber(date).
- 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
- 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))).
- 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
- 6. Return the value of the [[Value]] property of the this value.
+/**
+ File Name: 15.9.5.32-1.js
+ ECMA Section: 15.9.5.32 Date.prototype.setDate(date)
+ Description:
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute UTC(MakeDate(Result(3), TimeWithinDay(t))).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.32-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.32-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setDate(date) ");
+writeHeaderToLog( SECTION + " Date.prototype.setDate(date) ");
- getTestCases();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
- addNewTestCase( 0, 1,
- "TDATE = new Date(0);(TDATE).setDate(1);TDATE" );
+addNewTestCase( 0, 1,
+ "TDATE = new Date(0);(TDATE).setDate(1);TDATE" );
/*
- addNewTestCase( "TDATE = new Date(86400000);(TDATE).setDate(1);TDATE",
- UTCDateFromTime(SetDate(86400000,1)),
- LocalDateFromTime(SetDate(86400000,1)) );
+ addNewTestCase( "TDATE = new Date(86400000);(TDATE).setDate(1);TDATE",
+ UTCDateFromTime(SetDate(86400000,1)),
+ LocalDateFromTime(SetDate(86400000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1972)),
- LocalDateFromTime(SetUTCFullYear(0,1972)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1968)),
- LocalDateFromTime(SetUTCFullYear(0,1968)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1969)),
- LocalDateFromTime(SetUTCFullYear(0,1969)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
*/
-}
+
+test();
+
function addNewTestCase( t, d, DateString ) {
- var DateCase = new Date( t );
- DateCase.setDate( d );
+ var DateCase = new Date( t );
+ DateCase.setDate( d );
- var UTCDate = UTCDateFromTime(SetDate(t, d));
- var LocalDate=LocalDateFromTime(SetDate(t,d));
+ var UTCDate = UTCDateFromTime(SetDate(t, d));
+ var LocalDate=LocalDateFromTime(SetDate(t,d));
- var item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetDate( t, date ) {
- var T = LocalTime( t );
- var DATE = Number( date );
- var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
- var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) );
- return ( TimeClip(UTC_DATE) );
+ var T = LocalTime( t );
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ var UTC_DATE = UTC( MakeDate(RESULT3, TimeWithinDay(T)) );
+ return ( TimeClip(UTC_DATE) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.33-1.js b/mozilla/js/tests/ecma/Date/15.9.5.33-1.js
index 580671875a5..5e17440ab01 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.33-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.33-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,138 +35,121 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.33-1.js
- ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date)
- Description:
- 1. Let t be this time value.
- 2. Call ToNumber(date).
- 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
- 4. Compute MakeDate(Result(3), TimeWithinDay(t)).
- 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
- 6. Return the value of the [[Value]] property of the this value.
+/**
+ File Name: 15.9.5.33-1.js
+ ECMA Section: 15.9.5.33 Date.prototype.setUTCDate(date)
+ Description:
+ 1. Let t be this time value.
+ 2. Call ToNumber(date).
+ 3. Compute MakeDay(YearFromTime(t), MonthFromTime(t), Result(2)).
+ 4. Compute MakeDate(Result(3), TimeWithinDay(t)).
+ 5. Set the [[Value]] property of the this value to TimeClip(Result(4)).
+ 6. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.33-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.33-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) ");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCDate(date) ");
- getTestCases();
- test();
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE",
+ UTCDateFromTime(SetUTCDate(0,31)),
+ LocalDateFromTime(SetUTCDate(0,31)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(0,1)),
+ LocalDateFromTime(SetUTCDate(0,1)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(31);TDATE",
- UTCDateFromTime(SetUTCDate(0,31)),
- LocalDateFromTime(SetUTCDate(0,31)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCDate(1);TDATE",
- UTCDateFromTime(SetUTCDate(0,1)),
- LocalDateFromTime(SetUTCDate(0,1)) );
-
- addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE",
- UTCDateFromTime(SetUTCDate(86400000,1)),
- LocalDateFromTime(SetUTCDate(86400000,1)) );
+addNewTestCase( "TDATE = new Date(86400000);(TDATE).setUTCDate(1);TDATE",
+ UTCDateFromTime(SetUTCDate(86400000,1)),
+ LocalDateFromTime(SetUTCDate(86400000,1)) );
/*
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1972)),
- LocalDateFromTime(SetUTCFullYear(0,1972)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1968)),
- LocalDateFromTime(SetUTCFullYear(0,1968)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1969)),
- LocalDateFromTime(SetUTCFullYear(0,1969)) );
+ addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
*/
-}
+
+test();
+
function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
+ DateCase = eval( DateString );
- var item = testcases.length;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCDate( t, date ) {
- var T = t;
- var DATE = Number( date );
- var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
- return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) );
+ var T = t;
+ var DATE = Number( date );
+ var RESULT3 = MakeDay(YearFromTime(T), MonthFromTime(T), DATE );
+ return ( TimeClip(MakeDate(RESULT3, TimeWithinDay(t))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.34-1.js b/mozilla/js/tests/ecma/Date/15.9.5.34-1.js
index f3c3445dc70..9161792a870 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.34-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.34-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,202 +35,186 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.34-1.js
- ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] )
- Description:
- If date is not specified, this behaves as if date were specified with the
- value getDate( ).
+ File Name: 15.9.5.34-1.js
+ ECMA Section: 15.9.5.34 Date.prototype.setMonth(mon [, date ] )
+ Description:
+ If date is not specified, this behaves as if date were specified with the
+ value getDate( ).
- 1. Let t be the result of LocalTime(this time value).
- 2. Call ToNumber(date).
- 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date).
- 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)).
- 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))).
- 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
- 7. Return the value of the [[Value]] property of the this value.
+ 1. Let t be the result of LocalTime(this time value).
+ 2. Call ToNumber(date).
+ 3. If date is not specified, compute DateFromTime(t); otherwise, call ToNumber(date).
+ 4. Compute MakeDay(YearFromTime(t), Result(2), Result(3)).
+ 5. Compute UTC(MakeDate(Result(4), TimeWithinDay(t))).
+ 6. Set the [[Value]] property of the this value to TimeClip(Result(5)).
+ 7. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.34-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.34-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )");
+writeHeaderToLog( SECTION + " Date.prototype.setMonth(mon [, date ] )");
- var now = (new Date()).valueOf();
+var now = (new Date()).valueOf();
- getFunctionCases();
- getTestCases();
- test();
+getFunctionCases();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404
+d = new Date(0);
+d.setMonth(1,1,1,1,1,1);
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getFunctionCases() {
- // some tests for all functions
- testcases[testcases.length] = new TestCase(
- SECTION,
- "Date.prototype.setMonth.length",
- 2,
- Date.prototype.setMonth.length );
-
- testcases[testcases.length] = new TestCase(
- SECTION,
- "typeof Date.prototype.setMonth",
- "function",
- typeof Date.prototype.setMonth );
+addNewTestCase(
+ "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE",
+ UTCDateFromTime(SetMonth(0,1,1)),
+ LocalDateFromTime(SetMonth(0,1,1)) );
-/*
+// whatever today is
- testcases[testcases.length] = new TestCase(
- SECTION,
- "delete Date.prototype.setMonth",
- false,
- delete Date.prototype.setMonth );
-*/
+addNewTestCase( "TDATE = new Date(now); (TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime(SetMonth(now,11,31)),
+ LocalDateFromTime(SetMonth(now,11,31)) );
-}
+// 1970
+addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE",
+ UTCDateFromTime(SetMonth(0,0,1)),
+ LocalDateFromTime(SetMonth(0,0,1)) );
-function getTestCases() {
- // regression test for http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112404
- d = new Date(0);
- d.setMonth(1,1,1,1,1,1);
-
- addNewTestCase(
- "TDATE = new Date(0); TDATE.setMonth(1,1,1,1,1,1); TDATE",
- UTCDateFromTime(SetMonth(0,1,1)),
- LocalDateFromTime(SetMonth(0,1,1)) );
-
-
- // whatever today is
-
- addNewTestCase( "TDATE = new Date(now); (TDATE).setMonth(11,31); TDATE",
- UTCDateFromTime(SetMonth(now,11,31)),
- LocalDateFromTime(SetMonth(now,11,31)) );
-
- // 1970
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setMonth(0,1);TDATE",
- UTCDateFromTime(SetMonth(0,0,1)),
- LocalDateFromTime(SetMonth(0,0,1)) );
-
- addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+
- "(TDATE).setMonth(11,31); TDATE",
- UTCDateFromTime( SetMonth(TIME_1900,11,31) ),
- LocalDateFromTime( SetMonth(TIME_1900,11,31) ) );
+addNewTestCase( "TDATE = new Date("+TIME_1900+"); "+
+ "(TDATE).setMonth(11,31); TDATE",
+ UTCDateFromTime( SetMonth(TIME_1900,11,31) ),
+ LocalDateFromTime( SetMonth(TIME_1900,11,31) ) );
/*
- addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11,23,59,999);TDATE",
- UTCDateFromTime(SetMonth(28800000,11,23,59,999)),
- LocalDateFromTime(SetMonth(28800000,11,23,59,999)) );
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11,23,59,999);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,23,59,999)),
+ LocalDateFromTime(SetMonth(28800000,11,23,59,999)) );
- addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(99,99);TDATE",
- UTCDateFromTime(SetMonth(28800000,99,99)),
- LocalDateFromTime(SetMonth(28800000,99,99)) );
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(99,99);TDATE",
+ UTCDateFromTime(SetMonth(28800000,99,99)),
+ LocalDateFromTime(SetMonth(28800000,99,99)) );
- addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11);TDATE",
- UTCDateFromTime(SetMonth(28800000,11,0)),
- LocalDateFromTime(SetMonth(28800000,11,0)) );
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,11,0)),
+ LocalDateFromTime(SetMonth(28800000,11,0)) );
- addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(-11);TDATE",
- UTCDateFromTime(SetMonth(28800000,-11)),
- LocalDateFromTime(SetMonth(28800000,-11)) );
+ addNewTestCase( "TDATE = new Date(28800000);(TDATE).setMonth(-11);TDATE",
+ UTCDateFromTime(SetMonth(28800000,-11)),
+ LocalDateFromTime(SetMonth(28800000,-11)) );
- // 1900
+ // 1900
// addNewTestCase( "TDATE = new Date(); (TDATE).setMonth(11,31); TDATE;"
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
+
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
+}
+
+function getFunctionCases() {
+ // some tests for all functions
+ new TestCase(
+ SECTION,
+ "Date.prototype.setMonth.length",
+ 2,
+ Date.prototype.setMonth.length );
+
+ new TestCase(
+ SECTION,
+ "typeof Date.prototype.setMonth",
+ "function",
+ typeof Date.prototype.setMonth );
+
+
+/*
+
+new TestCase(
+SECTION,
+"delete Date.prototype.setMonth",
+false,
+delete Date.prototype.setMonth );
+*/
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetMonth( t, mon, date ) {
- var TIME = LocalTime(t);
- var MONTH = Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date );
- var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE );
- return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) );
+ var TIME = LocalTime(t);
+ var MONTH = Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(TIME) : Number( date );
+ var DAY = MakeDay( YearFromTime(TIME), MONTH, DATE );
+ return ( TimeClip (UTC(MakeDate( DAY, TimeWithinDay(TIME) ))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.35-1.js b/mozilla/js/tests/ecma/Date/15.9.5.35-1.js
index 824d86fd145..6a0cbf01359 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.35-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.35-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,125 +35,105 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.35-1.js
- ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date])
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.35-1.js
+ ECMA Section: 15.9.5.35 Date.prototype.setUTCMonth(mon [,date])
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.35-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.35-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) ");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCMonth(mon [,date] ) ");
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,0)),
+ LocalDateFromTime(SetUTCMonth(0,0)) );
- getTestCases();
- test();
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,11)),
+ LocalDateFromTime(SetUTCMonth(0,11)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
+ UTCDateFromTime(SetUTCMonth(0,3,4)),
+ LocalDateFromTime(SetUTCMonth(0,3,4)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(0);TDATE",
- UTCDateFromTime(SetUTCMonth(0,0)),
- LocalDateFromTime(SetUTCMonth(0,0)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(11);TDATE",
- UTCDateFromTime(SetUTCMonth(0,11)),
- LocalDateFromTime(SetUTCMonth(0,11)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCMonth(3,4);TDATE",
- UTCDateFromTime(SetUTCMonth(0,3,4)),
- LocalDateFromTime(SetUTCMonth(0,3,4)) );
-
-}
+test();
function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
+ DateCase = eval( DateString );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCMonth( t, month, date ) {
- var T = t;
- var MONTH = Number( month );
- var DATE = ( date == void 0) ? DateFromTime(T) : Number( date );
+ var T = t;
+ var MONTH = Number( month );
+ var DATE = ( date == void 0) ? DateFromTime(T) : Number( date );
- var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE );
- var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T));
+ var RESULT4 = MakeDay(YearFromTime(T), MONTH, DATE );
+ var RESULT5 = MakeDate( RESULT4, TimeWithinDay(T));
- return ( TimeClip(RESULT5) );
+ return ( TimeClip(RESULT5) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-1.js b/mozilla/js/tests/ecma/Date/15.9.5.36-1.js
index 72ecedbb402..66db3c1308c 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,227 +35,212 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// 1969
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969)),
+ LocalDateFromTime(SetFullYear(0,1969)) );
- // 1969
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11)),
+ LocalDateFromTime(SetFullYear(0,1969,11)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969);TDATE",
- UTCDateFromTime(SetFullYear(0,1969)),
- LocalDateFromTime(SetFullYear(0,1969)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11);TDATE",
- UTCDateFromTime(SetFullYear(0,1969,11)),
- LocalDateFromTime(SetFullYear(0,1969,11)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE",
- UTCDateFromTime(SetFullYear(0,1969,11,31)),
- LocalDateFromTime(SetFullYear(0,1969,11,31)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1969,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1969,11,31)),
+ LocalDateFromTime(SetFullYear(0,1969,11,31)) );
/*
- // 1970
+// 1970
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
- UTCDateFromTime(SetFullYear(0,1970)),
- LocalDateFromTime(SetFullYear(0,1970)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+UTCDateFromTime(SetFullYear(0,1970)),
+LocalDateFromTime(SetFullYear(0,1970)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
- UTCDateFromTime(SetFullYear(0,1970,0)),
- LocalDateFromTime(SetFullYear(0,1970,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+UTCDateFromTime(SetFullYear(0,1970,0)),
+LocalDateFromTime(SetFullYear(0,1970,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,1970,0,1)),
- LocalDateFromTime(SetFullYear(0,1970,0,1)) );
- // 1971
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
- UTCDateFromTime(SetFullYear(0,1971)),
- LocalDateFromTime(SetFullYear(0,1971)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,1970,0,1)),
+LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+// 1971
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+UTCDateFromTime(SetFullYear(0,1971)),
+LocalDateFromTime(SetFullYear(0,1971)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0)),
- LocalDateFromTime(SetFullYear(0,1971,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+UTCDateFromTime(SetFullYear(0,1971,0)),
+LocalDateFromTime(SetFullYear(0,1971,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0,1)),
- LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,1971,0,1)),
+LocalDateFromTime(SetFullYear(0,1971,0,1)) );
- // 1999
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
- UTCDateFromTime(SetFullYear(0,1999)),
- LocalDateFromTime(SetFullYear(0,1999)) );
+// 1999
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+UTCDateFromTime(SetFullYear(0,1999)),
+LocalDateFromTime(SetFullYear(0,1999)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11)),
- LocalDateFromTime(SetFullYear(0,1999,11)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11)),
+LocalDateFromTime(SetFullYear(0,1999,11)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11,31)),
- LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11,31)),
+LocalDateFromTime(SetFullYear(0,1999,11,31)) );
- // 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0)),
- LocalDateFromTime(SetFullYear(0,2000,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0)),
+LocalDateFromTime(SetFullYear(0,2000,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0,1)),
- LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0,1)),
+LocalDateFromTime(SetFullYear(0,2000,0,1)) );
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1)),
+LocalDateFromTime(SetFullYear(0,2000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1,29)),
+LocalDateFromTime(SetFullYear(0,2000,1,29)) );
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-2.js b/mozilla/js/tests/ecma/Date/15.9.5.36-2.js
index 6172c0e9481..5317d8e2fa9 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,213 +35,198 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-2";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// 1970
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970)),
+ LocalDateFromTime(SetFullYear(0,1970)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // 1970
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0)),
+ LocalDateFromTime(SetFullYear(0,1970,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970);TDATE",
- UTCDateFromTime(SetFullYear(0,1970)),
- LocalDateFromTime(SetFullYear(0,1970)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0);TDATE",
- UTCDateFromTime(SetFullYear(0,1970,0)),
- LocalDateFromTime(SetFullYear(0,1970,0)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,1970,0,1)),
- LocalDateFromTime(SetFullYear(0,1970,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1970,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1970,0,1)),
+ LocalDateFromTime(SetFullYear(0,1970,0,1)) );
/*
- // 1971
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
- UTCDateFromTime(SetFullYear(0,1971)),
- LocalDateFromTime(SetFullYear(0,1971)) );
+// 1971
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+UTCDateFromTime(SetFullYear(0,1971)),
+LocalDateFromTime(SetFullYear(0,1971)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0)),
- LocalDateFromTime(SetFullYear(0,1971,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+UTCDateFromTime(SetFullYear(0,1971,0)),
+LocalDateFromTime(SetFullYear(0,1971,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0,1)),
- LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,1971,0,1)),
+LocalDateFromTime(SetFullYear(0,1971,0,1)) );
- // 1999
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
- UTCDateFromTime(SetFullYear(0,1999)),
- LocalDateFromTime(SetFullYear(0,1999)) );
+// 1999
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+UTCDateFromTime(SetFullYear(0,1999)),
+LocalDateFromTime(SetFullYear(0,1999)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11)),
- LocalDateFromTime(SetFullYear(0,1999,11)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11)),
+LocalDateFromTime(SetFullYear(0,1999,11)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11,31)),
- LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11,31)),
+LocalDateFromTime(SetFullYear(0,1999,11,31)) );
- // 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0)),
- LocalDateFromTime(SetFullYear(0,2000,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0)),
+LocalDateFromTime(SetFullYear(0,2000,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0,1)),
- LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0,1)),
+LocalDateFromTime(SetFullYear(0,2000,0,1)) );
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1)),
+LocalDateFromTime(SetFullYear(0,2000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1,29)),
+LocalDateFromTime(SetFullYear(0,2000,1,29)) );
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-3.js b/mozilla/js/tests/ecma/Date/15.9.5.36-3.js
index 7fe7c0287be..a48cb9b2790 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,200 +35,185 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// 1971
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971)),
+ LocalDateFromTime(SetFullYear(0,1971)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0)),
+ LocalDateFromTime(SetFullYear(0,1971,0)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // 1971
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971);TDATE",
- UTCDateFromTime(SetFullYear(0,1971)),
- LocalDateFromTime(SetFullYear(0,1971)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0)),
- LocalDateFromTime(SetFullYear(0,1971,0)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,1971,0,1)),
- LocalDateFromTime(SetFullYear(0,1971,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1971,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,1971,0,1)),
+ LocalDateFromTime(SetFullYear(0,1971,0,1)) );
/*
- // 1999
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
- UTCDateFromTime(SetFullYear(0,1999)),
- LocalDateFromTime(SetFullYear(0,1999)) );
+// 1999
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+UTCDateFromTime(SetFullYear(0,1999)),
+LocalDateFromTime(SetFullYear(0,1999)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11)),
- LocalDateFromTime(SetFullYear(0,1999,11)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11)),
+LocalDateFromTime(SetFullYear(0,1999,11)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11,31)),
- LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+UTCDateFromTime(SetFullYear(0,1999,11,31)),
+LocalDateFromTime(SetFullYear(0,1999,11,31)) );
- // 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0)),
- LocalDateFromTime(SetFullYear(0,2000,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0)),
+LocalDateFromTime(SetFullYear(0,2000,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0,1)),
- LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0,1)),
+LocalDateFromTime(SetFullYear(0,2000,0,1)) );
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1)),
+LocalDateFromTime(SetFullYear(0,2000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1,29)),
+LocalDateFromTime(SetFullYear(0,2000,1,29)) );
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-4.js b/mozilla/js/tests/ecma/Date/15.9.5.36-4.js
index a1f5fe58051..2a6a43c093e 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,187 +35,172 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// 1999
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999)),
+ LocalDateFromTime(SetFullYear(0,1999)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11)),
+ LocalDateFromTime(SetFullYear(0,1999,11)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // 1999
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999);TDATE",
- UTCDateFromTime(SetFullYear(0,1999)),
- LocalDateFromTime(SetFullYear(0,1999)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11)),
- LocalDateFromTime(SetFullYear(0,1999,11)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
- UTCDateFromTime(SetFullYear(0,1999,11,31)),
- LocalDateFromTime(SetFullYear(0,1999,11,31)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(1999,11,31);TDATE",
+ UTCDateFromTime(SetFullYear(0,1999,11,31)),
+ LocalDateFromTime(SetFullYear(0,1999,11,31)) );
/*
- // 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0)),
- LocalDateFromTime(SetFullYear(0,2000,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0)),
+LocalDateFromTime(SetFullYear(0,2000,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0,1)),
- LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,0,1)),
+LocalDateFromTime(SetFullYear(0,2000,0,1)) );
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1)),
+LocalDateFromTime(SetFullYear(0,2000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1,29)),
+LocalDateFromTime(SetFullYear(0,2000,1,29)) );
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-5.js b/mozilla/js/tests/ecma/Date/15.9.5.36-5.js
index 9973412f854..0ce4fa4d05a 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,174 +35,160 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0)),
+ LocalDateFromTime(SetFullYear(0,2000,0)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0)),
- LocalDateFromTime(SetFullYear(0,2000,0)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,0,1)),
- LocalDateFromTime(SetFullYear(0,2000,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,0,1)),
+ LocalDateFromTime(SetFullYear(0,2000,0,1)) );
/*
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+UTCDateFromTime(SetFullYear(0,2000)),
+LocalDateFromTime(SetFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1)),
+LocalDateFromTime(SetFullYear(0,2000,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+UTCDateFromTime(SetFullYear(0,2000,1,29)),
+LocalDateFromTime(SetFullYear(0,2000,1,29)) );
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-6.js b/mozilla/js/tests/ecma/Date/15.9.5.36-6.js
index 79511edbfa9..5e7669d251a 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,161 +35,146 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// feb 29, 2000
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000)),
+ LocalDateFromTime(SetFullYear(0,2000)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1)),
+ LocalDateFromTime(SetFullYear(0,2000,1)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // feb 29, 2000
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000);TDATE",
- UTCDateFromTime(SetFullYear(0,2000)),
- LocalDateFromTime(SetFullYear(0,2000)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1)),
- LocalDateFromTime(SetFullYear(0,2000,1)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
- UTCDateFromTime(SetFullYear(0,2000,1,29)),
- LocalDateFromTime(SetFullYear(0,2000,1,29)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2000,1,29);TDATE",
+ UTCDateFromTime(SetFullYear(0,2000,1,29)),
+ LocalDateFromTime(SetFullYear(0,2000,1,29)) );
/*
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+UTCDateFromTime(SetFullYear(0,2005)),
+LocalDateFromTime(SetFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0)),
+LocalDateFromTime(SetFullYear(0,2005,0)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+UTCDateFromTime(SetFullYear(0,2005,0,1)),
+LocalDateFromTime(SetFullYear(0,2005,0,1)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.36-7.js b/mozilla/js/tests/ecma/Date/15.9.5.36-7.js
index 928c8550729..ebea473b2f5 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.36-7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.36-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,146 +35,130 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.36-1.js
- ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
- Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getMonth( ). If date is not specified, this behaves as if date were
- specified with the value getDate( ).
+/**
+ File Name: 15.9.5.36-1.js
+ ECMA Section: 15.9.5.36 Date.prototype.setFullYear(year [, mon [, date ]] )
+ Description:
+
+ If mon is not specified, this behaves as if mon were specified with the
+ value getMonth( ). If date is not specified, this behaves as if date were
+ specified with the value getDate( ).
1. Let t be the result of LocalTime(this time value); but if this time
- value is NaN, let t be +0.
+ value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute UTC(MakeDate(Result(5), TimeWithinDay(t))).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added test cases for Year 2000 Compatilibity Testing.
+ Added test cases for Year 2000 Compatilibity Testing.
*/
- var SECTION = "15.9.5.36-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.36-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// Jan 1, 2005
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005)),
+ LocalDateFromTime(SetFullYear(0,2005)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0)),
+ LocalDateFromTime(SetFullYear(0,2005,0)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- // Jan 1, 2005
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005);TDATE",
- UTCDateFromTime(SetFullYear(0,2005)),
- LocalDateFromTime(SetFullYear(0,2005)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
+ UTCDateFromTime(SetFullYear(0,2005,0,1)),
+ LocalDateFromTime(SetFullYear(0,2005,0,1)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0)),
- LocalDateFromTime(SetFullYear(0,2005,0)) );
+test();
- addNewTestCase( "TDATE = new Date(0);(TDATE).setFullYear(2005,0,1);TDATE",
- UTCDateFromTime(SetFullYear(0,2005,0,1)),
- LocalDateFromTime(SetFullYear(0,2005,0,1)) );
-
-}
function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
+ DateCase = eval( DateString );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetFullYear( t, year, mon, date ) {
- var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
- var YEAR = Number( year );
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var T = ( isNaN(t) ) ? 0 : LocalTime(t) ;
+ var YEAR = Number( year );
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
- var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
+ var DAY = MakeDay( YEAR, MONTH, DATE );
+ var UTC_DATE = UTC(MakeDate( DAY, TimeWithinDay(T)));
- return ( TimeClip(UTC_DATE) );
-}
\ No newline at end of file
+ return ( TimeClip(UTC_DATE) );
+}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.37-1.js b/mozilla/js/tests/ecma/Date/15.9.5.37-1.js
index 912ea8f800b..26f357c3698 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.37-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.37-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,217 +35,200 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.37-1.js
- ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
- Description:
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getUTCMonth( ). If date is not specified, this behaves as if date
- were specified with the value getUTCDate( ).
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
1. Let t be this time value; but if this time value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute MakeDate(Result(5), TimeWithinDay(t)).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added some Year 2000 test cases.
+ Added some Year 2000 test cases.
*/
- var SECTION = "15.9.5.37-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// Dates around 1970
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1970)),
+ LocalDateFromTime(SetUTCFullYear(0,1970)) );
-function getTestCases() {
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1971)),
+ LocalDateFromTime(SetUTCFullYear(0,1971)) );
- // Dates around 1970
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1972)),
+ LocalDateFromTime(SetUTCFullYear(0,1972)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1970);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1970)),
- LocalDateFromTime(SetUTCFullYear(0,1970)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1968)),
+ LocalDateFromTime(SetUTCFullYear(0,1968)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1971);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1971)),
- LocalDateFromTime(SetUTCFullYear(0,1971)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1972);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1972)),
- LocalDateFromTime(SetUTCFullYear(0,1972)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1968);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1968)),
- LocalDateFromTime(SetUTCFullYear(0,1968)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1969)),
- LocalDateFromTime(SetUTCFullYear(0,1969)) );
-
- addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1969)),
- LocalDateFromTime(SetUTCFullYear(0,1969)) );
+addNewTestCase( "TDATE = new Date(0);(TDATE).setUTCFullYear(1969);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1969)),
+ LocalDateFromTime(SetUTCFullYear(0,1969)) );
/*
- // Dates around 2000
+// Dates around 2000
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2000)),
- LocalDateFromTime(SetUTCFullYear(0,2000)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2000)),
+LocalDateFromTime(SetUTCFullYear(0,2000)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2001)),
- LocalDateFromTime(SetUTCFullYear(0,2001)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2001)),
+LocalDateFromTime(SetUTCFullYear(0,2001)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1999)),
- LocalDateFromTime(SetUTCFullYear(0,1999)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1999)),
+LocalDateFromTime(SetUTCFullYear(0,1999)) );
- // Dates around 29 February 2000
+// Dates around 29 February 2000
- var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
- 31*msPerDay + 28*msPerDay;
+var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+31*msPerDay + 28*msPerDay;
- var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
- addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+"TDATE.setUTCFullYear(2000);TDATE",
+UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
- addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+"TDATE.setUTCFullYear(2000);TDATE",
+UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
- // Dates around 2005
+// Dates around 2005
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2005)),
- LocalDateFromTime(SetUTCFullYear(0,2005)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2005)),
+LocalDateFromTime(SetUTCFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2004)),
- LocalDateFromTime(SetUTCFullYear(0,2004)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2004)),
+LocalDateFromTime(SetUTCFullYear(0,2004)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2006)),
- LocalDateFromTime(SetUTCFullYear(0,2006)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2006)),
+LocalDateFromTime(SetUTCFullYear(0,2006)) );
- // Dates around 1900
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1900)),
- LocalDateFromTime(SetUTCFullYear(0,1900)) );
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1900)),
+LocalDateFromTime(SetUTCFullYear(0,1900)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1899)),
- LocalDateFromTime(SetUTCFullYear(0,1899)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1899)),
+LocalDateFromTime(SetUTCFullYear(0,1899)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1901)),
- LocalDateFromTime(SetUTCFullYear(0,1901)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1901)),
+LocalDateFromTime(SetUTCFullYear(0,1901)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCFullYear( t, year, mon, date ) {
- var T = ( t != t ) ? 0 : t;
- var YEAR = Number(year);
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
- return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.37-2.js b/mozilla/js/tests/ecma/Date/15.9.5.37-2.js
index d83c1850bc8..c14ed47eadb 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.37-2.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.37-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,191 +35,174 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.37-1.js
- ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
- Description:
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getUTCMonth( ). If date is not specified, this behaves as if date
- were specified with the value getUTCDate( ).
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
1. Let t be this time value; but if this time value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute MakeDate(Result(5), TimeWithinDay(t)).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added some Year 2000 test cases.
+ Added some Year 2000 test cases.
*/
- var SECTION = "15.9.5.37-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// Dates around 2000
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2000)),
+ LocalDateFromTime(SetUTCFullYear(0,2000)) );
-function getTestCases() {
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2001)),
+ LocalDateFromTime(SetUTCFullYear(0,2001)) );
- // Dates around 2000
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2000)),
- LocalDateFromTime(SetUTCFullYear(0,2000)) );
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2001);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2001)),
- LocalDateFromTime(SetUTCFullYear(0,2001)) );
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1999)),
- LocalDateFromTime(SetUTCFullYear(0,1999)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1999);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1999)),
+ LocalDateFromTime(SetUTCFullYear(0,1999)) );
/*
- // Dates around 29 February 2000
+// Dates around 29 February 2000
- var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
- 31*msPerDay + 28*msPerDay;
+var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+31*msPerDay + 28*msPerDay;
- var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
+var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
- addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
+addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+"TDATE.setUTCFullYear(2000);TDATE",
+UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
- addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+"TDATE.setUTCFullYear(2000);TDATE",
+UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
- // Dates around 2005
+// Dates around 2005
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2005)),
- LocalDateFromTime(SetUTCFullYear(0,2005)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2005)),
+LocalDateFromTime(SetUTCFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2004)),
- LocalDateFromTime(SetUTCFullYear(0,2004)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2004)),
+LocalDateFromTime(SetUTCFullYear(0,2004)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2006)),
- LocalDateFromTime(SetUTCFullYear(0,2006)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2006)),
+LocalDateFromTime(SetUTCFullYear(0,2006)) );
- // Dates around 1900
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1900)),
- LocalDateFromTime(SetUTCFullYear(0,1900)) );
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1900)),
+LocalDateFromTime(SetUTCFullYear(0,1900)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1899)),
- LocalDateFromTime(SetUTCFullYear(0,1899)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1899)),
+LocalDateFromTime(SetUTCFullYear(0,1899)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1901)),
- LocalDateFromTime(SetUTCFullYear(0,1901)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1901)),
+LocalDateFromTime(SetUTCFullYear(0,1901)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCFullYear( t, year, mon, date ) {
- var T = ( t != t ) ? 0 : t;
- var YEAR = Number(year);
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
- return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.37-3.js b/mozilla/js/tests/ecma/Date/15.9.5.37-3.js
index 7e11db978b3..b660c9ae069 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.37-3.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.37-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,177 +35,160 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.37-1.js
- ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
- Description:
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getUTCMonth( ). If date is not specified, this behaves as if date
- were specified with the value getUTCDate( ).
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
1. Let t be this time value; but if this time value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute MakeDate(Result(5), TimeWithinDay(t)).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added some Year 2000 test cases.
+ Added some Year 2000 test cases.
*/
- var SECTION = "15.9.5.37-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// Dates around 29 February 2000
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
+31*msPerDay + 28*msPerDay;
-function getTestCases() {
+var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
- // Dates around 29 February 2000
+addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
- var UTC_FEB_29_1972 = TIME_1970 + TimeInYear(1970) + TimeInYear(1971) +
- 31*msPerDay + 28*msPerDay;
-
- var PST_FEB_29_1972 = UTC_FEB_29_1972 - TZ_DIFF * msPerHour;
-
- addNewTestCase( "TDATE = new Date("+UTC_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(UTC_FEB_29_1972,2000)) );
-
- addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
- "TDATE.setUTCFullYear(2000);TDATE",
- UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
- LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
+addNewTestCase( "TDATE = new Date("+PST_FEB_29_1972+"); "+
+ "TDATE.setUTCFullYear(2000);TDATE",
+ UTCDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)),
+ LocalDateFromTime(SetUTCFullYear(PST_FEB_29_1972,2000)) );
/*
- // Dates around 2005
+// Dates around 2005
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2005)),
- LocalDateFromTime(SetUTCFullYear(0,2005)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2005)),
+LocalDateFromTime(SetUTCFullYear(0,2005)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2004)),
- LocalDateFromTime(SetUTCFullYear(0,2004)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2004)),
+LocalDateFromTime(SetUTCFullYear(0,2004)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2006)),
- LocalDateFromTime(SetUTCFullYear(0,2006)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,2006)),
+LocalDateFromTime(SetUTCFullYear(0,2006)) );
- // Dates around 1900
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1900)),
- LocalDateFromTime(SetUTCFullYear(0,1900)) );
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1900)),
+LocalDateFromTime(SetUTCFullYear(0,1900)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1899)),
- LocalDateFromTime(SetUTCFullYear(0,1899)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1899)),
+LocalDateFromTime(SetUTCFullYear(0,1899)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1901)),
- LocalDateFromTime(SetUTCFullYear(0,1901)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1901)),
+LocalDateFromTime(SetUTCFullYear(0,1901)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCFullYear( t, year, mon, date ) {
- var T = ( t != t ) ? 0 : t;
- var YEAR = Number(year);
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
- return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.37-4.js b/mozilla/js/tests/ecma/Date/15.9.5.37-4.js
index 02116c80abc..56a101120dd 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.37-4.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.37-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,159 +35,142 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.37-1.js
- ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
- Description:
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getUTCMonth( ). If date is not specified, this behaves as if date
- were specified with the value getUTCDate( ).
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
1. Let t be this time value; but if this time value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute MakeDate(Result(5), TimeWithinDay(t)).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added some Year 2000 test cases.
+ Added some Year 2000 test cases.
*/
- var SECTION = "15.9.5.37-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// Dates around 2005
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2005)),
+ LocalDateFromTime(SetUTCFullYear(0,2005)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2004)),
+ LocalDateFromTime(SetUTCFullYear(0,2004)) );
-function getTestCases() {
- // Dates around 2005
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2005);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2005)),
- LocalDateFromTime(SetUTCFullYear(0,2005)) );
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2004);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2004)),
- LocalDateFromTime(SetUTCFullYear(0,2004)) );
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,2006)),
- LocalDateFromTime(SetUTCFullYear(0,2006)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(2006);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,2006)),
+ LocalDateFromTime(SetUTCFullYear(0,2006)) );
/*
- // Dates around 1900
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1900)),
- LocalDateFromTime(SetUTCFullYear(0,1900)) );
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1900)),
+LocalDateFromTime(SetUTCFullYear(0,1900)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1899)),
- LocalDateFromTime(SetUTCFullYear(0,1899)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1899)),
+LocalDateFromTime(SetUTCFullYear(0,1899)) );
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1901)),
- LocalDateFromTime(SetUTCFullYear(0,1901)) );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+UTCDateFromTime(SetUTCFullYear(0,1901)),
+LocalDateFromTime(SetUTCFullYear(0,1901)) );
*/
-}
-function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
- var item = testcases.length;
+test();
+
+function addNewTestCase( DateString, UTCDate, LocalDate) {
+ DateCase = eval( DateString );
+
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCFullYear( t, year, mon, date ) {
- var T = ( t != t ) ? 0 : t;
- var YEAR = Number(year);
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
- return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.37-5.js b/mozilla/js/tests/ecma/Date/15.9.5.37-5.js
index 7d6a3fb0f7d..c14a690a82d 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.37-5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.37-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,142 +35,125 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 15.9.5.37-1.js
- ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
- Description:
+/**
+ File Name: 15.9.5.37-1.js
+ ECMA Section: 15.9.5.37 Date.prototype.setUTCFullYear(year [, mon [, date ]] )
+ Description:
- If mon is not specified, this behaves as if mon were specified with the
- value getUTCMonth( ). If date is not specified, this behaves as if date
- were specified with the value getUTCDate( ).
+ If mon is not specified, this behaves as if mon were specified with the
+ value getUTCMonth( ). If date is not specified, this behaves as if date
+ were specified with the value getUTCDate( ).
1. Let t be this time value; but if this time value is NaN, let t be +0.
2. Call ToNumber(year).
3. If mon is not specified, compute MonthFromTime(t); otherwise, call
- ToNumber(mon).
+ ToNumber(mon).
4. If date is not specified, compute DateFromTime(t); otherwise, call
- ToNumber(date).
+ ToNumber(date).
5. Compute MakeDay(Result(2), Result(3), Result(4)).
6. Compute MakeDate(Result(5), TimeWithinDay(t)).
7. Set the [[Value]] property of the this value to TimeClip(Result(6)).
8. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
- Added some Year 2000 test cases.
+ Added some Year 2000 test cases.
*/
- var SECTION = "15.9.5.37-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.9.5.37-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
+writeHeaderToLog( SECTION + " Date.prototype.setUTCFullYear(year [, mon [, date ]] )");
- getTestCases();
- test();
+// Dates around 1900
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1900)),
+ LocalDateFromTime(SetUTCFullYear(0,1900)) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1899)),
+ LocalDateFromTime(SetUTCFullYear(0,1899)) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
+ UTCDateFromTime(SetUTCFullYear(0,1901)),
+ LocalDateFromTime(SetUTCFullYear(0,1901)) );
-function getTestCases() {
- // Dates around 1900
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1900);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1900)),
- LocalDateFromTime(SetUTCFullYear(0,1900)) );
+test();
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1899);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1899)),
- LocalDateFromTime(SetUTCFullYear(0,1899)) );
-
- addNewTestCase( "TDATE = new Date(0); TDATE.setUTCFullYear(1901);TDATE",
- UTCDateFromTime(SetUTCFullYear(0,1901)),
- LocalDateFromTime(SetUTCFullYear(0,1901)) );
-}
function addNewTestCase( DateString, UTCDate, LocalDate) {
- DateCase = eval( DateString );
+ DateCase = eval( DateString );
- var item = testcases.length;
// fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;
- testcases[item++] = new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
- testcases[item++] = new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
+ new TestCase( SECTION, DateString+".getTime()", UTCDate.value, DateCase.getTime() );
+ new TestCase( SECTION, DateString+".valueOf()", UTCDate.value, DateCase.valueOf() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
+ new TestCase( SECTION, DateString+".getUTCFullYear()", UTCDate.year, DateCase.getUTCFullYear() );
+ new TestCase( SECTION, DateString+".getUTCMonth()", UTCDate.month, DateCase.getUTCMonth() );
+ new TestCase( SECTION, DateString+".getUTCDate()", UTCDate.date, DateCase.getUTCDate() );
+ new TestCase( SECTION, DateString+".getUTCDay()", UTCDate.day, DateCase.getUTCDay() );
+ new TestCase( SECTION, DateString+".getUTCHours()", UTCDate.hours, DateCase.getUTCHours() );
+ new TestCase( SECTION, DateString+".getUTCMinutes()", UTCDate.minutes,DateCase.getUTCMinutes() );
+ new TestCase( SECTION, DateString+".getUTCSeconds()", UTCDate.seconds,DateCase.getUTCSeconds() );
+ new TestCase( SECTION, DateString+".getUTCMilliseconds()", UTCDate.ms, DateCase.getUTCMilliseconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
- testcases[item++] = new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
- testcases[item++] = new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
- testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
- testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
+ new TestCase( SECTION, DateString+".getFullYear()", LocalDate.year, DateCase.getFullYear() );
+ new TestCase( SECTION, DateString+".getMonth()", LocalDate.month, DateCase.getMonth() );
+ new TestCase( SECTION, DateString+".getDate()", LocalDate.date, DateCase.getDate() );
+ new TestCase( SECTION, DateString+".getDay()", LocalDate.day, DateCase.getDay() );
+ new TestCase( SECTION, DateString+".getHours()", LocalDate.hours, DateCase.getHours() );
+ new TestCase( SECTION, DateString+".getMinutes()", LocalDate.minutes, DateCase.getMinutes() );
+ new TestCase( SECTION, DateString+".getSeconds()", LocalDate.seconds, DateCase.getSeconds() );
+ new TestCase( SECTION, DateString+".getMilliseconds()", LocalDate.ms, DateCase.getMilliseconds() );
- DateCase.toString = Object.prototype.toString;
+ DateCase.toString = Object.prototype.toString;
- testcases[item++] = new TestCase( SECTION,
- DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
- "[object Date]",
- DateCase.toString() );
+ new TestCase( SECTION,
+ DateString+".toString=Object.prototype.toString;"+DateString+".toString()",
+ "[object Date]",
+ DateCase.toString() );
}
function MyDate() {
- this.year = 0;
- this.month = 0;
- this.date = 0;
- this.hours = 0;
- this.minutes = 0;
- this.seconds = 0;
- this.ms = 0;
+ this.year = 0;
+ this.month = 0;
+ this.date = 0;
+ this.hours = 0;
+ this.minutes = 0;
+ this.seconds = 0;
+ this.ms = 0;
}
function LocalDateFromTime(t) {
- t = LocalTime(t);
- return ( MyDateFromTime(t) );
+ t = LocalTime(t);
+ return ( MyDateFromTime(t) );
}
function UTCDateFromTime(t) {
- return ( MyDateFromTime(t) );
+ return ( MyDateFromTime(t) );
}
function MyDateFromTime( t ) {
- var d = new MyDate();
- d.year = YearFromTime(t);
- d.month = MonthFromTime(t);
- d.date = DateFromTime(t);
- d.hours = HourFromTime(t);
- d.minutes = MinFromTime(t);
- d.seconds = SecFromTime(t);
- d.ms = msFromTime(t);
+ var d = new MyDate();
+ d.year = YearFromTime(t);
+ d.month = MonthFromTime(t);
+ d.date = DateFromTime(t);
+ d.hours = HourFromTime(t);
+ d.minutes = MinFromTime(t);
+ d.seconds = SecFromTime(t);
+ d.ms = msFromTime(t);
- d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
- d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
- d.day = WeekDay( d.value );
+ d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
+ d.value = TimeClip( MakeDate( MakeDay( d.year, d.month, d.date ), d.time ) );
+ d.day = WeekDay( d.value );
- return (d);
+ return (d);
}
function SetUTCFullYear( t, year, mon, date ) {
- var T = ( t != t ) ? 0 : t;
- var YEAR = Number(year);
- var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
- var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
- var DAY = MakeDay( YEAR, MONTH, DATE );
+ var T = ( t != t ) ? 0 : t;
+ var YEAR = Number(year);
+ var MONTH = ( mon == void 0 ) ? MonthFromTime(T) : Number( mon );
+ var DATE = ( date == void 0 ) ? DateFromTime(T) : Number( date );
+ var DAY = MakeDay( YEAR, MONTH, DATE );
- return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
+ return ( TimeClip(MakeDate(DAY, TimeWithinDay(T))) );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.4-1.js b/mozilla/js/tests/ecma/Date/15.9.5.4-1.js
index 4d7ce5019ab..c313caf66fd 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.4-1.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,63 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.4-1.js
- ECMA Section: 15.9.5.4-1 Date.prototype.getTime
- Description:
+ File Name: 15.9.5.4-1.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
- 1. If the this value is not an object whose [[Class]] property is "Date",
- generate a runtime error.
- 2. Return this time value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTime";
+var SECTION = "15.9.5.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTime";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
+var now = (new Date()).valueOf();
+var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
+var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var TZ_ADJUST = TZ_DIFF * msPerHour;
- var now = (new Date()).valueOf();
- var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
- var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_29_FEB_2000 );
+addTestCase( UTC_1_JAN_2005 );
- addTestCase( now );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_29_FEB_2000 );
- addTestCase( UTC_1_JAN_2005 );
-
- test();
+test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+").getTime()",
- t,
- (new Date(t)).getTime() );
+ new TestCase( SECTION,
+ "(new Date("+t+").getTime()",
+ t,
+ (new Date(t)).getTime() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+").getTime()",
- t+1,
- (new Date(t+1)).getTime() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+").getTime()",
+ t+1,
+ (new Date(t+1)).getTime() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+").getTime()",
- t-1,
- (new Date(t-1)).getTime() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+").getTime()",
+ t-1,
+ (new Date(t-1)).getTime() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+").getTime()",
- t-TZ_ADJUST,
- (new Date(t-TZ_ADJUST)).getTime() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+").getTime()",
+ t-TZ_ADJUST,
+ (new Date(t-TZ_ADJUST)).getTime() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+").getTime()",
- t+TZ_ADJUST,
- (new Date(t+TZ_ADJUST)).getTime() );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+").getTime()",
+ t+TZ_ADJUST,
+ (new Date(t+TZ_ADJUST)).getTime() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.4-2-n.js b/mozilla/js/tests/ecma/Date/15.9.5.4-2-n.js
index 8d823434001..386a6d8ad8f 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.4-2-n.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.4-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,40 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.4-2-n.js
- ECMA Section: 15.9.5.4-1 Date.prototype.getTime
- Description:
- 1. If the this value is not an object whose [[Class]] property is "Date",
- generate a runtime error.
- 2. Return this time value.
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
+
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.4-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getTime";
+var SECTION = "15.9.5.4-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getTime";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var MYDATE = new MyDate( TIME_2000 );
- var MYDATE = new MyDate( TIME_2000 );
+DESCRIPTION = "MYDATE.getTime()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- "MYDATE.getTime()",
- "error",
- MYDATE.getTime() );
+new TestCase( SECTION,
+ "MYDATE.getTime()",
+ "error",
+ eval("MYDATE.getTime()") );
+
+test();
function MyDate( value ) {
- this.value = value;
- this.getTime = Date.prototype.getTime;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.5.js b/mozilla/js/tests/ecma/Date/15.9.5.5.js
index 54263979bc2..8f2493b3978 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,109 +35,96 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.5.js
- ECMA Section: 15.9.5.5
- Description: Date.prototype.getYear
+ File Name: 15.9.5.5.js
+ ECMA Section: 15.9.5.5
+ Description: Date.prototype.getYear
- This function is specified here for backwards compatibility only. The
- function getFullYear is much to be preferred for nearly all purposes,
- because it avoids the "year 2000 problem."
+ This function is specified here for backwards compatibility only. The
+ function getFullYear is much to be preferred for nearly all purposes,
+ because it avoids the "year 2000 problem."
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return YearFromTime(LocalTime(t)) 1900.
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return YearFromTime(LocalTime(t)) 1900.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getYear()";
+var SECTION = "15.9.5.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getYear()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getYear()",
+ NaN,
+ (new Date(NaN)).getYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getYear()",
- NaN,
- (new Date(NaN)).getYear() );
+new TestCase( SECTION,
+ "Date.prototype.getYear.length",
+ 0,
+ Date.prototype.getYear.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getYear.length",
- 0,
- Date.prototype.getYear.length );
+test();
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getYear()",
- GetYear(YearFromTime(LocalTime(t))),
- (new Date(t)).getYear() );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t))),
+ (new Date(t)).getYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getYear()",
- GetYear(YearFromTime(LocalTime(t+1))),
- (new Date(t+1)).getYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+1))),
+ (new Date(t+1)).getYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getYear()",
- GetYear(YearFromTime(LocalTime(t-1))),
- (new Date(t-1)).getYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-1))),
+ (new Date(t-1)).getYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getYear()",
- GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
- (new Date(t-TZ_ADJUST)).getYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t-TZ_ADJUST))),
+ (new Date(t-TZ_ADJUST)).getYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getYear()",
- GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
- (new Date(t+TZ_ADJUST)).getYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getYear()",
+ GetYear(YearFromTime(LocalTime(t+TZ_ADJUST))),
+ (new Date(t+TZ_ADJUST)).getYear() );
}
function GetYear( year ) {
/*
- if ( year >= 1900 && year < 2000 ) {
- return year - 1900;
- } else {
- return year;
- }
+ if ( year >= 1900 && year < 2000 ) {
+ return year - 1900;
+ } else {
+ return year;
+ }
*/
- return year - 1900;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return year - 1900;
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.6.js b/mozilla/js/tests/ecma/Date/15.9.5.6.js
index e0c70d11618..5fd2e378ee1 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.6.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,100 +35,86 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.6.js
- ECMA Section: 15.9.5.6
- Description: Date.prototype.getFullYear
+ File Name: 15.9.5.6.js
+ ECMA Section: 15.9.5.6
+ Description: Date.prototype.getFullYear
1. Let t be this time value.
2. If t is NaN, return NaN.
3. Return YearFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getFullYear()";
+var SECTION = "15.9.5.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getFullYear()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getFullYear()",
+ NaN,
+ (new Date(NaN)).getFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getFullYear()",
- NaN,
- (new Date(NaN)).getFullYear() );
+new TestCase( SECTION,
+ "Date.prototype.getFullYear.length",
+ 0,
+ Date.prototype.getFullYear.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getFullYear.length",
- 0,
- Date.prototype.getFullYear.length );
-
- test();
+test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getFullYear()",
- YearFromTime(LocalTime(t)),
- (new Date(t)).getFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getFullYear()",
+ YearFromTime(LocalTime(t)),
+ (new Date(t)).getFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getFullYear()",
- YearFromTime(LocalTime(t+1)),
- (new Date(t+1)).getFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getFullYear()",
+ YearFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getFullYear()",
- YearFromTime(LocalTime(t-1)),
- (new Date(t-1)).getFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getFullYear()",
+ YearFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getFullYear()",
- YearFromTime(LocalTime(t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getFullYear()",
- YearFromTime(LocalTime(t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getFullYear() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getFullYear()",
+ YearFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getFullYear() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.7.js b/mozilla/js/tests/ecma/Date/15.9.5.7.js
index b8bf722a4e9..5419b5171f1 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.7.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,100 +35,87 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.9.5.7.js
- ECMA Section: 15.9.5.7
- Description: Date.prototype.getUTCFullYear
- 1.Let t be this time value.
- 2.If t is NaN, return NaN.
- 3.Return YearFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 15.9.5.7.js
+ ECMA Section: 15.9.5.7
+ Description: Date.prototype.getUTCFullYear
+
+ 1.Let t be this time value.
+ 2.If t is NaN, return NaN.
+ 3.Return YearFromTime(t).
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCFullYear()";
+var SECTION = "15.9.5.7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCFullYear()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCFullYear()",
+ NaN,
+ (new Date(NaN)).getUTCFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCFullYear()",
- NaN,
- (new Date(NaN)).getUTCFullYear() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCFullYear.length",
+ 0,
+ Date.prototype.getUTCFullYear.length );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCFullYear.length",
- 0,
- Date.prototype.getUTCFullYear.length );
+test();
- test();
function addTestCase( t ) {
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCFullYear()",
- YearFromTime(t),
- (new Date(t)).getUTCFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCFullYear()",
+ YearFromTime(t),
+ (new Date(t)).getUTCFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCFullYear()",
- YearFromTime(t+1),
- (new Date(t+1)).getUTCFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCFullYear()",
+ YearFromTime(t+1),
+ (new Date(t+1)).getUTCFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCFullYear()",
- YearFromTime(t-1),
- (new Date(t-1)).getUTCFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCFullYear()",
+ YearFromTime(t-1),
+ (new Date(t-1)).getUTCFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()",
- YearFromTime(t-TZ_ADJUST),
- (new Date(t-TZ_ADJUST)).getUTCFullYear() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCFullYear() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()",
- YearFromTime(t+TZ_ADJUST),
- (new Date(t+TZ_ADJUST)).getUTCFullYear() );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCFullYear()",
+ YearFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCFullYear() );
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.8.js b/mozilla/js/tests/ecma/Date/15.9.5.8.js
index 80d5487e7a8..78a21799715 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.8.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,93 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.8.js
- ECMA Section: 15.9.5.8
- Description: Date.prototype.getMonth
+ File Name: 15.9.5.8.js
+ ECMA Section: 15.9.5.8
+ Description: Date.prototype.getMonth
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return MonthFromTime(LocalTime(t)).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(LocalTime(t)).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getMonth()";
+var SECTION = "15.9.5.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getMonth()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getMonth()",
+ NaN,
+ (new Date(NaN)).getMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getMonth()",
- NaN,
- (new Date(NaN)).getMonth() );
+new TestCase( SECTION,
+ "Date.prototype.getMonth.length",
+ 0,
+ Date.prototype.getMonth.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getMonth.length",
- 0,
- Date.prototype.getMonth.length );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
+ for ( var m = 0; m < 12; m++ ) {
t += TimeInMonth(m);
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getMonth()",
- MonthFromTime(LocalTime(t)),
- (new Date(t)).getMonth() );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getMonth()",
+ MonthFromTime(LocalTime(t)),
+ (new Date(t)).getMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getMonth()",
- MonthFromTime(LocalTime(t+1)),
- (new Date(t+1)).getMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getMonth()",
+ MonthFromTime(LocalTime(t+1)),
+ (new Date(t+1)).getMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getMonth()",
- MonthFromTime(LocalTime(t-1)),
- (new Date(t-1)).getMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getMonth()",
+ MonthFromTime(LocalTime(t-1)),
+ (new Date(t-1)).getMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
- MonthFromTime(LocalTime(t-TZ_ADJUST)),
- (new Date(t-TZ_ADJUST)).getMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t-TZ_ADJUST)),
+ (new Date(t-TZ_ADJUST)).getMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
- MonthFromTime(LocalTime(t+TZ_ADJUST)),
- (new Date(t+TZ_ADJUST)).getMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getMonth()",
+ MonthFromTime(LocalTime(t+TZ_ADJUST)),
+ (new Date(t+TZ_ADJUST)).getMonth() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.9.js b/mozilla/js/tests/ecma/Date/15.9.5.9.js
index 76f60799a9c..aea37d4e1dc 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.9.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,93 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.9.js
- ECMA Section: 15.9.5.9
- Description: Date.prototype.getUTCMonth
+ File Name: 15.9.5.9.js
+ ECMA Section: 15.9.5.9
+ Description: Date.prototype.getUTCMonth
- 1. Let t be this time value.
- 2. If t is NaN, return NaN.
- 3. Return MonthFromTime(t).
+ 1. Let t be this time value.
+ 2. If t is NaN, return NaN.
+ 3. Return MonthFromTime(t).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5.8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Date.prototype.getUTCMonth()";
+var SECTION = "15.9.5.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Date.prototype.getUTCMonth()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var TZ_ADJUST = TZ_DIFF * msPerHour;
- var TZ_ADJUST = TZ_DIFF * msPerHour;
+// get the current time
+var now = (new Date()).valueOf();
- // get the current time
- var now = (new Date()).valueOf();
+// calculate time for year 0
+for ( var time = 0, year = 1969; year >= 0; year-- ) {
+ time -= TimeInYear(year);
+}
+// get time for 29 feb 2000
- // calculate time for year 0
- for ( var time = 0, year = 1969; year >= 0; year-- ) {
- time -= TimeInYear(year);
- }
- // get time for 29 feb 2000
+var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
- var UTC_FEB_29_2000 = TIME_2000 + 31*msPerDay + 28*msPerHour;
+// get time for 1 jan 2005
- // get time for 1 jan 2005
+var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
+TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
- var UTC_JAN_1_2005 = TIME_2000 + TimeInYear(2000)+TimeInYear(2001)+
- TimeInYear(2002)+TimeInYear(2003)+TimeInYear(2004);
+addTestCase( now );
+addTestCase( time );
+addTestCase( TIME_1970 );
+addTestCase( TIME_1900 );
+addTestCase( TIME_2000 );
+addTestCase( UTC_FEB_29_2000 );
+addTestCase( UTC_JAN_1_2005 );
- addTestCase( now );
- addTestCase( time );
- addTestCase( TIME_1970 );
- addTestCase( TIME_1900 );
- addTestCase( TIME_2000 );
- addTestCase( UTC_FEB_29_2000 );
- addTestCase( UTC_JAN_1_2005 );
+new TestCase( SECTION,
+ "(new Date(NaN)).getUTCMonth()",
+ NaN,
+ (new Date(NaN)).getUTCMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date(NaN)).getUTCMonth()",
- NaN,
- (new Date(NaN)).getUTCMonth() );
+new TestCase( SECTION,
+ "Date.prototype.getUTCMonth.length",
+ 0,
+ Date.prototype.getUTCMonth.length );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getUTCMonth.length",
- 0,
- Date.prototype.getUTCMonth.length );
- test();
function addTestCase( t ) {
- for ( var m = 0; m < 12; m++ ) {
+ for ( var m = 0; m < 12; m++ ) {
t += TimeInMonth(m);
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+t+")).getUTCMonth()",
- MonthFromTime(t),
- (new Date(t)).getUTCMonth() );
+ new TestCase( SECTION,
+ "(new Date("+t+")).getUTCMonth()",
+ MonthFromTime(t),
+ (new Date(t)).getUTCMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+1)+")).getUTCMonth()",
- MonthFromTime(t+1),
- (new Date(t+1)).getUTCMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t+1)+")).getUTCMonth()",
+ MonthFromTime(t+1),
+ (new Date(t+1)).getUTCMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-1)+")).getUTCMonth()",
- MonthFromTime(t-1),
- (new Date(t-1)).getUTCMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t-1)+")).getUTCMonth()",
+ MonthFromTime(t-1),
+ (new Date(t-1)).getUTCMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
- MonthFromTime(t-TZ_ADJUST),
- (new Date(t-TZ_ADJUST)).getUTCMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t-TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t-TZ_ADJUST),
+ (new Date(t-TZ_ADJUST)).getUTCMonth() );
- testcases[tc++] = new TestCase( SECTION,
- "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
- MonthFromTime(t+TZ_ADJUST),
- (new Date(t+TZ_ADJUST)).getUTCMonth() );
+ new TestCase( SECTION,
+ "(new Date("+(t+TZ_ADJUST)+")).getUTCMonth()",
+ MonthFromTime(t+TZ_ADJUST),
+ (new Date(t+TZ_ADJUST)).getUTCMonth() );
- }
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ }
}
diff --git a/mozilla/js/tests/ecma/Date/15.9.5.js b/mozilla/js/tests/ecma/Date/15.9.5.js
index e40717b484f..60a02a3f6e3 100644
--- a/mozilla/js/tests/ecma/Date/15.9.5.js
+++ b/mozilla/js/tests/ecma/Date/15.9.5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.9.5.js
- ECMA Section: 15.9.5 Properties of the Date prototype object
- Description:
+ File Name: 15.9.5.js
+ ECMA Section: 15.9.5 Properties of the Date prototype object
+ Description:
- The Date prototype object is itself a Date object (its [[Class]] is
- "Date") whose value is NaN.
+ The Date prototype object is itself a Date object (its [[Class]] is
+ "Date") whose value is NaN.
- The value of the internal [[Prototype]] property of the Date prototype
- object is the Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Date prototype
+ object is the Object prototype object (15.2.3.1).
- In following descriptions of functions that are properties of the Date
- prototype object, the phrase "this Date object" refers to the object that
- is the this value for the invocation of the function; it is an error if
- this does not refer to an object for which the value of the internal
- [[Class]] property is "Date". Also, the phrase "this time value" refers
- to the number value for the time represented by this Date object, that is,
- the value of the internal [[Value]] property of this Date object.
+ In following descriptions of functions that are properties of the Date
+ prototype object, the phrase "this Date object" refers to the object that
+ is the this value for the invocation of the function; it is an error if
+ this does not refer to an object for which the value of the internal
+ [[Class]] property is "Date". Also, the phrase "this time value" refers
+ to the number value for the time represented by this Date object, that is,
+ the value of the internal [[Value]] property of this Date object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.9.5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Date Prototype Object";
+var SECTION = "15.9.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Date Prototype Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- Date.prototype.getClass = Object.prototype.toString;
+Date.prototype.getClass = Object.prototype.toString;
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.getClass",
- "[object Date]",
- Date.prototype.getClass() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.valueOf()",
- NaN,
- Date.prototype.valueOf() );
- testcases[tc++] = new TestCase( SECTION,
- "Date.prototype.__proto__ == Object.prototype",
- true,
- Date.prototype.__proto__ == Object.prototype );
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Date.prototype.getClass",
+ "[object Date]",
+ Date.prototype.getClass() );
+new TestCase( SECTION,
+ "Date.prototype.valueOf()",
+ NaN,
+ Date.prototype.valueOf() );
+new TestCase( SECTION,
+ "Date.prototype.__proto__ == Object.prototype",
+ true,
+ Date.prototype.__proto__ == Object.prototype );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Date/browser.js b/mozilla/js/tests/ecma/Date/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Date/shell.js b/mozilla/js/tests/ecma/Date/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.3-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.3-1.js
index 5dee331a6e7..fa730309d3f 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.3-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,89 +35,71 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.3-1.js
- ECMA Section: 10.1.3
- Description:
+ File Name: 10.1.3-1.js
+ ECMA Section: 10.1.3
+ Description:
- For each formal parameter, as defined in the FormalParameterList, create
- a property of the variable object whose name is the Identifier and whose
- attributes are determined by the type of code. The values of the
- parameters are supplied by the caller. If the caller supplies fewer
- parameter values than there are formal parameters, the extra formal
- parameters have value undefined. If two or more formal parameters share
- the same name, hence the same property, the corresponding property is
- given the value that was supplied for the last parameter with this name.
- If the value of this last parameter was not supplied by the caller,
- the value of the corresponding property is undefined.
+ For each formal parameter, as defined in the FormalParameterList, create
+ a property of the variable object whose name is the Identifier and whose
+ attributes are determined by the type of code. The values of the
+ parameters are supplied by the caller. If the caller supplies fewer
+ parameter values than there are formal parameters, the extra formal
+ parameters have value undefined. If two or more formal parameters share
+ the same name, hence the same property, the corresponding property is
+ given the value that was supplied for the last parameter with this name.
+ If the value of this last parameter was not supplied by the caller,
+ the value of the corresponding property is undefined.
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104191
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Variable Instantiation: Formal Parameters";
- var BUGNUMBER="104191";
+var SECTION = "10.1.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Variable Instantiation: Formal Parameters";
+var BUGNUMBER="104191";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var myfun1 = new Function( "a", "a", "return a" );
+var myfun2 = new Function( "a", "b", "a", "return a" );
- var myfun1 = new Function( "a", "a", "return a" );
- var myfun2 = new Function( "a", "b", "a", "return a" );
-
- function myfun3(a, b, a) {
- return a;
- }
-
- // myfun1, myfun2, myfun3 tostring
-
-
- testcases[tc++] = new TestCase(
- SECTION,
- String(myfun2) +"; myfun2(2,4,8)",
- 8,
- myfun2(2,4,8) );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "myfun2(2,4)",
- void 0,
- myfun2(2,4));
-
- testcases[tc++] = new TestCase(
- SECTION,
- String(myfun3) +"; myfun3(2,4,8)",
- 8,
- myfun3(2,4,8) );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "myfun3(2,4)",
- void 0,
- myfun3(2,4) );
-
-
-
-
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+function myfun3(a, b, a) {
+ return a;
}
+
+// myfun1, myfun2, myfun3 tostring
+
+
+new TestCase(
+ SECTION,
+ String(myfun2) +"; myfun2(2,4,8)",
+ 8,
+ myfun2(2,4,8) );
+
+new TestCase(
+ SECTION,
+ "myfun2(2,4)",
+ void 0,
+ myfun2(2,4));
+
+new TestCase(
+ SECTION,
+ String(myfun3) +"; myfun3(2,4,8)",
+ 8,
+ myfun3(2,4,8) );
+
+new TestCase(
+ SECTION,
+ "myfun3(2,4)",
+ void 0,
+ myfun3(2,4) );
+
+test();
+
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.3.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.3.js
index b87ef279da1..65ae364f3f8 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.3.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,12 +35,13 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.3.js
- ECMA Section: 10.1.3.js Variable Instantiation
- Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+ File Name: 10.1.3.js
+ ECMA Section: 10.1.3.js Variable Instantiation
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
var SECTION = "10.1.3";
@@ -50,126 +52,117 @@ var BUGNUMBER = "20256";
writeHeaderToLog( SECTION + " "+ TITLE);
-var testcases = getTestCases();
+
+// overriding a variable or function name with a function should succeed
+
+new TestCase(SECTION,
+ "function t() { return \"first\" };" +
+ "function t() { return \"second\" };t() ",
+ "second",
+ eval("function t() { return \"first\" };" +
+ "function t() { return \"second\" };t()"));
+
+
+new TestCase(SECTION,
+ "var t; function t(){}; typeof(t)",
+ "function",
+ eval("var t; function t(){}; typeof(t)"));
+
+
+// formal parameter tests
+
+new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( 4 );",
+ void 0,
+ eval("function t1(a,b) { return b; }; t1( 4 );") );
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(4);",
+ 4,
+ eval("function t1(a,b) { return a; }; t1(4)"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1();",
+ void 0,
+ eval("function t1(a,b) { return a; }; t1()"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1(1,2,4);",
+ 1,
+ eval("function t1(a,b) { return a; }; t1(1,2,4)"));
+/*
+
+new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );",
+void 0,
+eval("function t1(a,a) { return a; }; t1( 4 )"));
+
+new TestCase(SECTION,
+"function t1(a,a) { return a; }; t1( 1,2 );",
+2,
+eval("function t1(a,a) { return a; }; t1( 1,2 )"));
+*/
+// variable declarations
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a; }; t1( false, true );",
+ false,
+ eval("function t1(a,b) { return a; }; t1( false, true );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return b; }; t1( false, true );",
+ true,
+ eval("function t1(a,b) { return b; }; t1( false, true );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4, 2 );",
+ 6,
+ eval("function t1(a,b) { return a+b; }; t1( 4, 2 );"));
+
+new TestCase(SECTION,
+ "function t1(a,b) { return a+b; }; t1( 4 );",
+ Number.NaN,
+ eval("function t1(a,b) { return a+b; }; t1( 4 );"));
+
+// overriding a function name with a variable should fail
+
+new TestCase(SECTION,
+ "function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)",
+ "string",
+ eval("function t() { return 'function' };" +
+ "var t = 'variable'; typeof(t)"));
+
+// function as a constructor
+
+new TestCase(SECTION,
+ "function t1(a,b) { var a = b; return a; } t1(1,3);",
+ 3,
+ eval("function t1(a, b){ var a = b; return a;}; t1(1,3)"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a",
+ 3,
+ eval("function t2(a,b) { this.a = b; };" +
+ "x = new t2(1,3); x.a"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a",
+ 1,
+ eval("function t2(a,b) { this.a = a; };" +
+ "x = new t2(1,3); x.a"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; } " +
+ "x = new t2(1,3);x.a;",
+ 3,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.a;"));
+
+new TestCase(SECTION,
+ "function t2(a,b) { this.a = b; this.b = a; }" +
+ "x = new t2(1,3);x.b;",
+ 1,
+ eval("function t2(a,b) { this.a = b; this.b = a; };" +
+ "x = new t2(1,3);x.b;") );
test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // overriding a variable or function name with a function should succeed
- array[item++] =
- new TestCase(SECTION,
- "function t() { return \"first\" };" +
- "function t() { return \"second\" };t() ",
- "second",
- eval("function t() { return \"first\" };" +
- "function t() { return \"second\" };t()"));
-
- array[item++] =
- new TestCase(SECTION,
- "var t; function t(){}; typeof(t)",
- "function",
- eval("var t; function t(){}; typeof(t)"));
-
-
- // formal parameter tests
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return b; }; t1( 4 );",
- void 0,
- eval("function t1(a,b) { return b; }; t1( 4 );") );
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a; }; t1(4);",
- 4,
- eval("function t1(a,b) { return a; }; t1(4)"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a; }; t1();",
- void 0,
- eval("function t1(a,b) { return a; }; t1()"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a; }; t1(1,2,4);",
- 1,
- eval("function t1(a,b) { return a; }; t1(1,2,4)"));
-/*
- array[item++] =
- new TestCase(SECTION, "function t1(a,a) { return a; }; t1( 4 );",
- void 0,
- eval("function t1(a,a) { return a; }; t1( 4 )"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,a) { return a; }; t1( 1,2 );",
- 2,
- eval("function t1(a,a) { return a; }; t1( 1,2 )"));
-*/
- // variable declarations
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a; }; t1( false, true );",
- false,
- eval("function t1(a,b) { return a; }; t1( false, true );"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return b; }; t1( false, true );",
- true,
- eval("function t1(a,b) { return b; }; t1( false, true );"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a+b; }; t1( 4, 2 );",
- 6,
- eval("function t1(a,b) { return a+b; }; t1( 4, 2 );"));
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { return a+b; }; t1( 4 );",
- Number.NaN,
- eval("function t1(a,b) { return a+b; }; t1( 4 );"));
-
- // overriding a function name with a variable should fail
- array[item++] =
- new TestCase(SECTION,
- "function t() { return 'function' };" +
- "var t = 'variable'; typeof(t)",
- "string",
- eval("function t() { return 'function' };" +
- "var t = 'variable'; typeof(t)"));
-
- // function as a constructor
- array[item++] =
- new TestCase(SECTION,
- "function t1(a,b) { var a = b; return a; } t1(1,3);",
- 3,
- eval("function t1(a, b){ var a = b; return a;}; t1(1,3)"));
- array[item++] =
- new TestCase(SECTION,
- "function t2(a,b) { this.a = b; } x = new t2(1,3); x.a",
- 3,
- eval("function t2(a,b) { this.a = b; };" +
- "x = new t2(1,3); x.a"));
- array[item++] =
- new TestCase(SECTION,
- "function t2(a,b) { this.a = a; } x = new t2(1,3); x.a",
- 1,
- eval("function t2(a,b) { this.a = a; };" +
- "x = new t2(1,3); x.a"));
- array[item++] =
- new TestCase(SECTION,
- "function t2(a,b) { this.a = b; this.b = a; } " +
- "x = new t2(1,3);x.a;",
- 3,
- eval("function t2(a,b) { this.a = b; this.b = a; };" +
- "x = new t2(1,3);x.a;"));
- array[item++] =
- new TestCase(SECTION,
- "function t2(a,b) { this.a = b; this.b = a; }" +
- "x = new t2(1,3);x.b;",
- 1,
- eval("function t2(a,b) { this.a = b; this.b = a; };" +
- "x = new t2(1,3);x.b;") );
-
- return (array);
-}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-1.js
index 115af7b0491..1bed18b1044 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
+new TestCase( "SECTION", "with MyObject, eval should return square of " );
- test();
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += "( " + INPUT +" )" ;
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += "( " + INPUT +" )" ;
- with ( MYOBJECT ) {
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = Math.pow(INPUT,2);
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,2);
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-10.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-10.js
index 7ea81ad7802..077c913ea59 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-10.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,76 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-10.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-10.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-10";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-10";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
+new TestCase( "SECTION", "MYOBJECT.toString()" );
- test();
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- var VALUE = 12345;
- var MYOBJECT = new Number( VALUE );
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ var VALUE = 12345;
+ var MYOBJECT = new Number( VALUE );
- with ( MYOBJECT ) {
- testcases[tc].actual = toString();
- testcases[tc].expect = String(VALUE);
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ testcases[tc].actual = toString();
+ testcases[tc].expect = String(VALUE);
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "MYOBJECT.toString()" );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-2.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-2.js
index ec88085f627..4d498ee4574 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-2.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-2";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
+new TestCase( "SECTION", "with MyObject, eval should return square of " );
- test();
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += "( "+INPUT +" )" ;
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += "( "+INPUT +" )" ;
- with ( this ) {
- with ( MYOBJECT ) {
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = Math.pow(INPUT,2);
- }
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( this ) {
+ with ( MYOBJECT ) {
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,2);
+ }
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should return square of " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-3.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-3.js
index 12a55da51fb..53dce846397 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-3.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-3";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-3";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
- test();
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += ( INPUT +"" );
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
- with ( MYOBJECT ) {
- eval( INPUT );
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ eval( INPUT );
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-4.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-4.js
index 81482b73492..477e4b581c0 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-4.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
- test();
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += ( INPUT +"" );
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
- with ( MYOBJECT ) {
- eval( INPUT );
- }
-
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = INPUT;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ eval( INPUT );
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
- return ( array );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-5.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-5.js
index a8b76ecd058..6992e4695f1 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-5.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
- test();
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += ( INPUT +"" );
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
- with ( MYOBJECT ) {
- eval = null;
- }
-
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = INPUT;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ eval = null;
}
- stopTest();
- return ( testcases );
+
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
+
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
-
- return ( array );
-}
-
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-6.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-6.js
index 39307efe06a..3d0eaec7760 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-6.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-6";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- getTestCases();
- test();
-function getTestCases() {
- testcases[0] = new TestCase( "SECTION",
- "with MyObject, eval should be [object Global].eval " );
+var testcase = new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[0].description += ( INPUT +"" );
-
- with ( MYOBJECT ) {
- ;
- }
- testcases[0].actual = eval( INPUT );
- testcases[0].expect = INPUT;
+var MYOBJECT = new MyObject();
+var INPUT = 2;
+testcase.description += ( INPUT +"" );
+with ( MYOBJECT ) {
+ ;
}
+testcase.actual = eval( INPUT );
+testcase.expect = INPUT;
+
+test();
+
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-7.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-7.js
index 66731d2d7a6..db8bb307375 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-7.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,82 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-7.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-7";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-7";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
- test();
+new TestCase( "SECTION",
+ "with MyObject, eval should be [object Global].eval " );
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += ( INPUT +"" );
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
- with ( MYOBJECT ) {
- delete( eval );
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = INPUT;
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ delete( eval );
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = INPUT;
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should be [object Global].eval " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-8.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-8.js
index e094a83106c..58d633b5685 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-8.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,83 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-1.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-1.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "10.1.4-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- var testcases = getTestCases();
- test();
+new TestCase( "SECTION",
+ "with MyObject, eval should cube INPUT: " );
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var INPUT = 2;
- testcases[tc].description += ( INPUT +"" );
+ var MYOBJECT = new MyObject();
+ var INPUT = 2;
+ testcases[tc].description += ( INPUT +"" );
- with ( MYOBJECT ) {
- eval = new Function ( "x", "return(Math.pow(Number(x),3))" );
+ with ( MYOBJECT ) {
+ eval = new Function ( "x", "return(Math.pow(Number(x),3))" );
- testcases[tc].actual = eval( INPUT );
- testcases[tc].expect = Math.pow(INPUT,3);
- }
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ testcases[tc].actual = eval( INPUT );
+ testcases[tc].expect = Math.pow(INPUT,3);
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( "SECTION", "with MyObject, eval should cube INPUT: " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject() {
- this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
-}
\ No newline at end of file
+ this.eval = new Function( "x", "return(Math.pow(Number(x),2))" );
+}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-9.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-9.js
index 7e778ffd1fd..c162fb8c4b0 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-9.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.4-9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.4-9.js
- ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
- Description:
- Every execution context has associated with it a scope chain. This is
- logically a list of objects that are searched when binding an Identifier.
- When control enters an execution context, the scope chain is created and
- is populated with an initial set of objects, depending on the type of
- code. When control leaves the execution context, the scope chain is
- destroyed.
+ File Name: 10.1.4-9.js
+ ECMA Section: 10.1.4 Scope Chain and Identifier Resolution
+ Description:
+ Every execution context has associated with it a scope chain. This is
+ logically a list of objects that are searched when binding an Identifier.
+ When control enters an execution context, the scope chain is created and
+ is populated with an initial set of objects, depending on the type of
+ code. When control leaves the execution context, the scope chain is
+ destroyed.
- During execution, the scope chain of the execution context is affected
- only by WithStatement. When execution enters a with block, the object
- specified in the with statement is added to the front of the scope chain.
- When execution leaves a with block, whether normally or via a break or
- continue statement, the object is removed from the scope chain. The object
- being removed will always be the first object in the scope chain.
+ During execution, the scope chain of the execution context is affected
+ only by WithStatement. When execution enters a with block, the object
+ specified in the with statement is added to the front of the scope chain.
+ When execution leaves a with block, whether normally or via a break or
+ continue statement, the object is removed from the scope chain. The object
+ being removed will always be the first object in the scope chain.
- During execution, the syntactic production PrimaryExpression : Identifier
- is evaluated using the following algorithm:
+ During execution, the syntactic production PrimaryExpression : Identifier
+ is evaluated using the following algorithm:
- 1. Get the next object in the scope chain. If there isn't one, go to step 5.
- 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
- the property.
- 3. If Result(2) is true, return a value of type Reference whose base object
- is Result(l) and whose property name is the Identifier.
- 4. Go to step 1.
- 5. Return a value of type Reference whose base object is null and whose
- property name is the Identifier.
- The result of binding an identifier is always a value of type Reference with
- its member name component equal to the identifier string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Get the next object in the scope chain. If there isn't one, go to step 5.
+ 2. Call the [[HasProperty]] method of Result(l), passing the Identifier as
+ the property.
+ 3. If Result(2) is true, return a value of type Reference whose base object
+ is Result(l) and whose property name is the Identifier.
+ 4. Go to step 1.
+ 5. Return a value of type Reference whose base object is null and whose
+ property name is the Identifier.
+ The result of binding an identifier is always a value of type Reference with
+ its member name component equal to the identifier string.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.4-9";
- var VERSION = "ECMA_2";
- startTest();
+var SECTION = "10.1.4-9";
+var VERSION = "ECMA_2";
+startTest();
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- writeHeaderToLog( SECTION + " Scope Chain and Identifier Resolution");
- test();
+new TestCase( SECTION, "NEW_PROPERTY = " );
+
+test();
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+ for ( tc=0; tc < testcases.length; tc++ ) {
- var MYOBJECT = new MyObject();
- var RESULT = "hello";
+ var MYOBJECT = new MyObject();
+ var RESULT = "hello";
- with ( MYOBJECT ) {
- NEW_PROPERTY = RESULT;
- }
- testcases[tc].actual = NEW_PROPERTY;
- testcases[tc].expect = RESULT;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ with ( MYOBJECT ) {
+ NEW_PROPERTY = RESULT;
}
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+ testcases[tc].actual = NEW_PROPERTY;
+ testcases[tc].expect = RESULT;
- array[item++] = new TestCase( SECTION, "NEW_PROPERTY = " );
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
function MyObject( n ) {
- this.__proto__ = Number.prototype;
+ this.__proto__ = Number.prototype;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-1.js
index ebe490eab04..b1f602d16a6 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 10.1.5-1.js
ECMA Section: 10.1.5 Global Object
@@ -61,7 +63,8 @@
writeHeaderToLog( SECTION + " Global Ojbect");
- var testcases = getTestCases();
+
+ new TestCase( "SECTION", "Global Code check" );
if ( Object == null ) {
testcases[0].reason += " Object == null" ;
@@ -111,23 +114,3 @@
test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( "SECTION", "Global Code check" );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-2.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-2.js
index ea2374475d8..63c21d5abcd 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-2.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 10.1.5-2.js
ECMA Section: 10.1.5 Global Object
@@ -61,7 +63,7 @@
writeHeaderToLog( SECTION + " Global Ojbect");
- var testcases = getTestCases();
+ new TestCase( "SECTION", "Eval Code check" );
var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' +
'if ( Function == null ) { testcases[0].reason += " Function == null"; }' +
@@ -94,23 +96,3 @@
test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual + " "+
- testcases[tc].reason );
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( "SECTION", "Eval Code check" );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-3.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-3.js
index 211dd7372a8..6ff1f76b96e 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-3.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 10.1.5-3.js
ECMA Section: 10.1.5 Global Object
@@ -60,7 +62,7 @@
startTest();
writeHeaderToLog( SECTION + " Global Ojbect");
- var testcases = getTestCases();
+ new TestCase( "SECTION", "Function Code check" );
test();
@@ -124,11 +126,3 @@ function test() {
stopTest();
return ( testcases );
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( "SECTION", "Function Code check" );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-4.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-4.js
index d97d14dcee8..a655da88983 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-4.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.5-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 10.1.5-4.js
ECMA Section: 10.1.5 Global Object
@@ -61,7 +63,8 @@
writeHeaderToLog( SECTION + " Global Ojbect");
- var testcases = getTestCases();
+ new TestCase( "SECTION", "Anonymous Code check" );
+
var EVAL_STRING = 'if ( Object == null ) { testcases[0].reason += " Object == null" ; }' +
'if ( Function == null ) { testcases[0].reason += " Function == null"; }' +
@@ -84,26 +87,3 @@
testcases[0].expect = "pass";
test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual + " "+
- testcases[tc].reason );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( "SECTION", "Anonymous Code check" );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.6.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.6.js
index f6d102bbd9b..a15155b3691 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.6.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,91 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.6
- ECMA Section: Activation Object
- Description:
+ File Name: 10.1.6
+ ECMA Section: Activation Object
+ Description:
- If the function object being invoked has an arguments property, let x be
- the value of that property; the activation object is also given an internal
- property [[OldArguments]] whose initial value is x; otherwise, an arguments
- property is created for the function object but the activation object is
- not given an [[OldArguments]] property. Next, arguments object described
- below (the same one stored in the arguments property of the activation
- object) is used as the new value of the arguments property of the function
- object. This new value is installed even if the arguments property already
- exists and has the ReadOnly attribute (as it will for native Function
- objects). (These actions are taken to provide compatibility with a form of
- program syntax that is now discouraged: to access the arguments object for
- function f within the body of f by using the expression f.arguments.
- The recommended way to access the arguments object for function f within
- the body of f is simply to refer to the variable arguments.)
+ If the function object being invoked has an arguments property, let x be
+ the value of that property; the activation object is also given an internal
+ property [[OldArguments]] whose initial value is x; otherwise, an arguments
+ property is created for the function object but the activation object is
+ not given an [[OldArguments]] property. Next, arguments object described
+ below (the same one stored in the arguments property of the activation
+ object) is used as the new value of the arguments property of the function
+ object. This new value is installed even if the arguments property already
+ exists and has the ReadOnly attribute (as it will for native Function
+ objects). (These actions are taken to provide compatibility with a form of
+ program syntax that is now discouraged: to access the arguments object for
+ function f within the body of f by using the expression f.arguments.
+ The recommended way to access the arguments object for function f within
+ the body of f is simply to refer to the variable arguments.)
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Activation Object";
+var SECTION = "10.1.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Activation Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var arguments = "FAILED!";
- var arguments = "FAILED!";
+var ARG_STRING = "value of the argument property";
- var ARG_STRING = "value of the argument property";
+new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5)).length",
+ 6,
+ (new TestObject(0,1,2,3,4,5)).length );
- testcases[tc++] = new TestCase( SECTION,
- "(new TestObject(0,1,2,3,4,5)).length",
- 6,
- (new TestObject(0,1,2,3,4,5)).length );
+for ( i = 0; i < 6; i++ ) {
- for ( i = 0; i < 6; i++ ) {
-
- testcases[tc++] = new TestCase( SECTION,
- "(new TestObject(0,1,2,3,4,5))["+i+"]",
- i,
- (new TestObject(0,1,2,3,4,5))[i]);
- }
+ new TestCase( SECTION,
+ "(new TestObject(0,1,2,3,4,5))["+i+"]",
+ i,
+ (new TestObject(0,1,2,3,4,5))[i]);
+}
- // The current object already has an arguments property.
+// The current object already has an arguments property.
- testcases[tc++] = new TestCase( SECTION,
- "(new AnotherTestObject(1,2,3)).arguments",
- ARG_STRING,
- (new AnotherTestObject(1,2,3)).arguments );
+new TestCase( SECTION,
+ "(new AnotherTestObject(1,2,3)).arguments",
+ ARG_STRING,
+ (new AnotherTestObject(1,2,3)).arguments );
- // The function invoked with [[Call]]
+// The function invoked with [[Call]]
- testcases[tc++] = new TestCase( SECTION,
- "TestFunction(1,2,3)",
- ARG_STRING,
- TestFunction() + '' );
+new TestCase( SECTION,
+ "TestFunction(1,2,3)",
+ ARG_STRING,
+ TestFunction() + '' );
- test();
+test();
function Prototype() {
- this.arguments = ARG_STRING;
+ this.arguments = ARG_STRING;
}
function TestObject() {
- this.__proto__ = new Prototype();
- return arguments;
+ this.__proto__ = new Prototype();
+ return arguments;
}
function AnotherTestObject() {
- this.__proto__ = new Prototype();
- return this;
+ this.__proto__ = new Prototype();
+ return this;
}
function TestFunction() {
- arguments = ARG_STRING;
- return arguments;
+ arguments = ARG_STRING;
+ return arguments;
}
function AnotherTestFunction() {
- this.__proto__ = new Prototype();
- return this;
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.__proto__ = new Prototype();
+ return this;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-1.js
index 4521f98a86c..5403594057b 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,114 +35,99 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.8
- ECMA Section: Arguments Object
- Description:
+ File Name: 10.1.8
+ ECMA Section: Arguments Object
+ Description:
- When control enters an execution context for declared function code,
- anonymous code, or implementation-supplied code, an arguments object is
- created and initialized as follows:
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
- The [[Prototype]] of the arguments object is to the original Object
- prototype object, the one that is the initial value of Object.prototype
- (section 15.2.3.1).
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
- A property is created with name callee and property attributes {DontEnum}.
- The initial value of this property is the function object being executed.
- This allows anonymous functions to be recursive.
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
- A property is created with name length and property attributes {DontEnum}.
- The initial value of this property is the number of actual parameter values
- supplied by the caller.
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
- For each non-negative integer, iarg, less than the value of the length
- property, a property is created with name ToString(iarg) and property
- attributes { DontEnum }. The initial value of this property is the value
- of the corresponding actual parameter supplied by the caller. The first
- actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
- so on. In the case when iarg is less than the number of formal parameters
- for the function object, this property shares its value with the
- corresponding property of the activation object. This means that changing
- this property changes the corresponding property of the activation object
- and vice versa. The value sharing mechanism depends on the implementation.
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Arguments Object";
+var SECTION = "10.1.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Arguments Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var ARG_STRING = "value of the argument property";
- var ARG_STRING = "value of the argument property";
+new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
- testcases[tc++] = new TestCase( SECTION,
- "GetCallee()",
- GetCallee,
- GetCallee() );
+var LIMIT = 100;
- var LIMIT = 100;
+for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
- for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
- args += String(i) + ( i+1 < LIMIT ? "," : "" );
+}
- }
+var LENGTH = eval( "GetLength("+ args +")" );
- var LENGTH = eval( "GetLength("+ args +")" );
+new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
- testcases[tc++] = new TestCase( SECTION,
- "GetLength("+args+")",
- 100,
- LENGTH );
+var ARGUMENTS = eval( "GetArguments( " +args+")" );
- var ARGUMENTS = eval( "GetArguments( " +args+")" );
+for ( var i = 0; i < 100; i++ ) {
+ new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+}
- for ( var i = 0; i < 100; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- "GetArguments("+args+")["+i+"]",
- i,
- ARGUMENTS[i] );
- }
-
- test();
+test();
function TestFunction() {
- var arg_proto = arguments.__proto__;
+ var arg_proto = arguments.__proto__;
}
function GetCallee() {
- var c = arguments.callee;
- return c;
+ var c = arguments.callee;
+ return c;
}
function GetArguments() {
- var a = arguments;
- return a;
+ var a = arguments;
+ return a;
}
function GetLength() {
- var l = arguments.length;
- return l;
+ var l = arguments.length;
+ return l;
}
function AnotherTestFunction() {
- this.__proto__ = new Prototype();
- return this;
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ this.__proto__ = new Prototype();
+ return this;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-2.js b/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-2.js
index 0edba7327dd..db3f8978567 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-2.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.1.8-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,99 +35,84 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.1.8-2
- ECMA Section: Arguments Object
- Description:
+ File Name: 10.1.8-2
+ ECMA Section: Arguments Object
+ Description:
- When control enters an execution context for declared function code,
- anonymous code, or implementation-supplied code, an arguments object is
- created and initialized as follows:
+ When control enters an execution context for declared function code,
+ anonymous code, or implementation-supplied code, an arguments object is
+ created and initialized as follows:
- The [[Prototype]] of the arguments object is to the original Object
- prototype object, the one that is the initial value of Object.prototype
- (section 15.2.3.1).
+ The [[Prototype]] of the arguments object is to the original Object
+ prototype object, the one that is the initial value of Object.prototype
+ (section 15.2.3.1).
- A property is created with name callee and property attributes {DontEnum}.
- The initial value of this property is the function object being executed.
- This allows anonymous functions to be recursive.
+ A property is created with name callee and property attributes {DontEnum}.
+ The initial value of this property is the function object being executed.
+ This allows anonymous functions to be recursive.
- A property is created with name length and property attributes {DontEnum}.
- The initial value of this property is the number of actual parameter values
- supplied by the caller.
+ A property is created with name length and property attributes {DontEnum}.
+ The initial value of this property is the number of actual parameter values
+ supplied by the caller.
- For each non-negative integer, iarg, less than the value of the length
- property, a property is created with name ToString(iarg) and property
- attributes { DontEnum }. The initial value of this property is the value
- of the corresponding actual parameter supplied by the caller. The first
- actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
- so on. In the case when iarg is less than the number of formal parameters
- for the function object, this property shares its value with the
- corresponding property of the activation object. This means that changing
- this property changes the corresponding property of the activation object
- and vice versa. The value sharing mechanism depends on the implementation.
+ For each non-negative integer, iarg, less than the value of the length
+ property, a property is created with name ToString(iarg) and property
+ attributes { DontEnum }. The initial value of this property is the value
+ of the corresponding actual parameter supplied by the caller. The first
+ actual parameter value corresponds to iarg = 0, the second to iarg = 1 and
+ so on. In the case when iarg is less than the number of formal parameters
+ for the function object, this property shares its value with the
+ corresponding property of the activation object. This means that changing
+ this property changes the corresponding property of the activation object
+ and vice versa. The value sharing mechanism depends on the implementation.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.1.8-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Arguments Object";
+var SECTION = "10.1.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Arguments Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = new Array();
+writeHeaderToLog( SECTION + " "+ TITLE);
// Tests for anonymous functions
- var GetCallee = new Function( "var c = arguments.callee; return c" );
- var GetArguments = new Function( "var a = arguments; return a" );
- var GetLength = new Function( "var l = arguments.length; return l" );
+var GetCallee = new Function( "var c = arguments.callee; return c" );
+var GetArguments = new Function( "var a = arguments; return a" );
+var GetLength = new Function( "var l = arguments.length; return l" );
- var ARG_STRING = "value of the argument property";
+var ARG_STRING = "value of the argument property";
- testcases[tc++] = new TestCase( SECTION,
- "GetCallee()",
- GetCallee,
- GetCallee() );
+new TestCase( SECTION,
+ "GetCallee()",
+ GetCallee,
+ GetCallee() );
- var LIMIT = 100;
+var LIMIT = 100;
- for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
- args += String(i) + ( i+1 < LIMIT ? "," : "" );
+for ( var i = 0, args = "" ; i < LIMIT; i++ ) {
+ args += String(i) + ( i+1 < LIMIT ? "," : "" );
- }
-
- var LENGTH = eval( "GetLength("+ args +")" );
-
- testcases[tc++] = new TestCase( SECTION,
- "GetLength("+args+")",
- 100,
- LENGTH );
-
- var ARGUMENTS = eval( "GetArguments( " +args+")" );
-
- for ( var i = 0; i < 100; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- "GetArguments("+args+")["+i+"]",
- i,
- ARGUMENTS[i] );
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
}
+
+var LENGTH = eval( "GetLength("+ args +")" );
+
+new TestCase( SECTION,
+ "GetLength("+args+")",
+ 100,
+ LENGTH );
+
+var ARGUMENTS = eval( "GetArguments( " +args+")" );
+
+for ( var i = 0; i < 100; i++ ) {
+ new TestCase( SECTION,
+ "GetArguments("+args+")["+i+"]",
+ i,
+ ARGUMENTS[i] );
+}
+
+test();
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.2.1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.2.1.js
index 1bb4b97d503..009509d5c5a 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.2.1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.2.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,49 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.2.1.js
- ECMA Section: 10.2.1 Global Code
- Description:
+ File Name: 10.2.1.js
+ ECMA Section: 10.2.1 Global Code
+ Description:
- The scope chain is created and initialized to contain the global object and
- no others.
+ The scope chain is created and initialized to contain the global object and
+ no others.
- Variable instantiation is performed using the global object as the variable
- object and using empty property attributes.
+ Variable instantiation is performed using the global object as the variable
+ object and using empty property attributes.
- The this value is the global object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ The this value is the global object.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.2.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Global Code";
+var SECTION = "10.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Global Code";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var THIS = this;
- var THIS = this;
+new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
- testcases[tc++] = new TestCase( SECTION,
- "this +''",
- GLOBAL,
- THIS + "" );
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
- var GLOBAL_PROPERTIES = new Array();
- var i = 0;
-
- for ( p in this ) {
- GLOBAL_PROPERTIES[i++] = p;
- }
-
- for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- GLOBAL_PROPERTIES[i] +" == void 0",
- false,
- eval("GLOBAL_PROPERTIES["+i+"] == void 0"));
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
}
+
+for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == void 0",
+ false,
+ eval("GLOBAL_PROPERTIES["+i+"] == void 0"));
+}
+
+test();
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-1.js
index aa0a93fdf6a..29ec4a87a96 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,101 +35,86 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.2.2-1.js
- ECMA Section: 10.2.2 Eval Code
- Description:
+ File Name: 10.2.2-1.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
- When control enters an execution context for eval code, the previous
- active execution context, referred to as the calling context, is used to
- determine the scope chain, the variable object, and the this value. If
- there is no calling context, then initializing the scope chain, variable
- instantiation, and determination of the this value are performed just as
- for global code.
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
- The scope chain is initialized to contain the same objects, in the same
- order, as the calling context's scope chain. This includes objects added
- to the calling context's scope chain by WithStatement.
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
- Variable instantiation is performed using the calling context's variable
- object and using empty property attributes.
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
- The this value is the same as the this value of the calling context.
+ The this value is the same as the this value of the calling context.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.2.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Eval Code";
+var SECTION = "10.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var THIS = eval("this");
- var THIS = eval("this");
+new TestCase( SECTION,
+ "this +''",
+ GLOBAL,
+ THIS + "" );
- testcases[tc++] = new TestCase( SECTION,
- "this +''",
- GLOBAL,
- THIS + "" );
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
- var GLOBAL_PROPERTIES = new Array();
- var i = 0;
-
- for ( p in THIS ) {
- GLOBAL_PROPERTIES[i++] = p;
- }
-
- for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]",
- true,
- eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
- }
-
- // this in eval statements is the same as this value of the calling context
-
- var RESULT = THIS == this;
-
- testcases[tc++] = new TestCase( SECTION,
- "eval( 'this == THIS' )",
- true,
- RESULT );
-
- var RESULT = THIS +'';
-
- testcases[tc++] = new TestCase( SECTION,
- "eval( 'this + \"\"' )",
- GLOBAL,
- RESULT );
-
-
- testcases[tc++] = new TestCase( SECTION,
- "eval( 'this == THIS' )",
- true,
- eval( "this == THIS" ) );
-
- testcases[tc++] = new TestCase( SECTION,
- "eval( 'this + \"\"' )",
- GLOBAL,
- eval( "this +''") );
-
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( p in THIS ) {
+ GLOBAL_PROPERTIES[i++] = p;
}
+
+for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION,
+ GLOBAL_PROPERTIES[i] +" == THIS["+GLOBAL_PROPERTIES[i]+"]",
+ true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+}
+
+// this in eval statements is the same as this value of the calling context
+
+var RESULT = THIS == this;
+
+new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ RESULT );
+
+var RESULT = THIS +'';
+
+new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ RESULT );
+
+
+new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ eval( "this == THIS" ) );
+
+new TestCase( SECTION,
+ "eval( 'this + \"\"' )",
+ GLOBAL,
+ eval( "this +''") );
+
+
+test();
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-2.js b/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-2.js
index df6012a1dd7..beb6859b51a 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-2.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.2.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,97 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.2.2-2.js
- ECMA Section: 10.2.2 Eval Code
- Description:
+ File Name: 10.2.2-2.js
+ ECMA Section: 10.2.2 Eval Code
+ Description:
- When control enters an execution context for eval code, the previous
- active execution context, referred to as the calling context, is used to
- determine the scope chain, the variable object, and the this value. If
- there is no calling context, then initializing the scope chain, variable
- instantiation, and determination of the this value are performed just as
- for global code.
+ When control enters an execution context for eval code, the previous
+ active execution context, referred to as the calling context, is used to
+ determine the scope chain, the variable object, and the this value. If
+ there is no calling context, then initializing the scope chain, variable
+ instantiation, and determination of the this value are performed just as
+ for global code.
- The scope chain is initialized to contain the same objects, in the same
- order, as the calling context's scope chain. This includes objects added
- to the calling context's scope chain by WithStatement.
+ The scope chain is initialized to contain the same objects, in the same
+ order, as the calling context's scope chain. This includes objects added
+ to the calling context's scope chain by WithStatement.
- Variable instantiation is performed using the calling context's variable
- object and using empty property attributes.
+ Variable instantiation is performed using the calling context's variable
+ object and using empty property attributes.
- The this value is the same as the this value of the calling context.
+ The this value is the same as the this value of the calling context.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.2.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Eval Code";
+var SECTION = "10.2.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// Test Objects
- // Test Objects
+var OBJECT = new MyObject( "hello" );
+var GLOBAL_PROPERTIES = new Array();
+var i = 0;
- var OBJECT = new MyObject( "hello" );
- var GLOBAL_PROPERTIES = new Array();
- var i = 0;
-
- for ( p in this ) {
- GLOBAL_PROPERTIES[i++] = p;
- }
-
- with ( OBJECT ) {
- var THIS = this;
- testcases[tc++] = new TestCase( SECTION, "eval( 'this == THIS' )", true, eval("this == THIS") );
- testcases[tc++] = new TestCase( SECTION, "this in a with() block", GLOBAL, this+"" );
- testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').value", "hello", value );
- testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').value)", "hello", eval("value") );
- testcases[tc++] = new TestCase( SECTION, "new MyObject('hello').getClass()", "[object Object]", getClass() );
- testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').getClass())", "[object Object]", eval("getClass()") );
- testcases[tc++] = new TestCase( SECTION, "eval(new MyObject('hello').toString())", "hello", eval("toString()") );
- testcases[tc++] = new TestCase( SECTION, "eval('getClass') == Object.prototype.toString", true, eval("getClass") == Object.prototype.toString );
-
- for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION, GLOBAL_PROPERTIES[i] +
- " == THIS["+GLOBAL_PROPERTIES[i]+"]", true,
- eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
- }
-
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( p in this ) {
+ GLOBAL_PROPERTIES[i++] = p;
}
+
+with ( OBJECT ) {
+ var THIS = this;
+ new TestCase( SECTION,
+ "eval( 'this == THIS' )",
+ true,
+ eval("this == THIS") );
+ new TestCase( SECTION,
+ "this in a with() block",
+ GLOBAL,
+ this+"" );
+ new TestCase( SECTION,
+ "new MyObject('hello').value",
+ "hello",
+ value );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').value)",
+ "hello",
+ eval("value") );
+ new TestCase( SECTION,
+ "new MyObject('hello').getClass()",
+ "[object Object]",
+ getClass() );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').getClass())",
+ "[object Object]",
+ eval("getClass()") );
+ new TestCase( SECTION,
+ "eval(new MyObject('hello').toString())",
+ "hello",
+ eval("toString()") );
+ new TestCase( SECTION,
+ "eval('getClass') == Object.prototype.toString",
+ true,
+ eval("getClass") == Object.prototype.toString );
+
+ for ( i = 0; i < GLOBAL_PROPERTIES.length; i++ ) {
+ new TestCase( SECTION, GLOBAL_PROPERTIES[i] +
+ " == THIS["+GLOBAL_PROPERTIES[i]+"]", true,
+ eval(GLOBAL_PROPERTIES[i]) == eval( "THIS[GLOBAL_PROPERTIES[i]]") );
+ }
+
+}
+
+test();
+
function MyObject( value ) {
- this.value = value;
- this.getClass = Object.prototype.toString;
- this.toString = new Function( "return this.value+''" );
- return this;
+ this.value = value;
+ this.getClass = Object.prototype.toString;
+ this.toString = new Function( "return this.value+''" );
+ return this;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-1.js b/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-1.js
index e7bed3014bc..c20c1c62428 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-1.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,50 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.2.3-1.js
- ECMA Section: 10.2.3 Function and Anonymous Code
- Description:
+ File Name: 10.2.3-1.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
- The scope chain is initialized to contain the activation object followed
- by the global object. Variable instantiation is performed using the
- activation by the global object. Variable instantiation is performed using
- the activation object as the variable object and using property attributes
- { DontDelete }. The caller provides the this value. If the this value
- provided by the caller is not an object (including the case where it is
- null), then the this value is the global object.
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.2.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Eval Code";
+var SECTION = "10.2.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Eval Code";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var o = new MyObject("hello")
- var o = new MyObject("hello")
+ new TestCase( SECTION,
+ "var o = new MyObject('hello'); o.THIS == x",
+ true,
+ o.THIS == o );
- testcases[tc++] = new TestCase( SECTION,
- "var o = new MyObject('hello'); o.THIS == x",
- true,
- o.THIS == o );
+var o = MyFunction();
- var o = MyFunction();
+new TestCase( SECTION,
+ "var o = MyFunction(); o == this",
+ true,
+ o == this );
- testcases[tc++] = new TestCase( SECTION,
- "var o = MyFunction(); o == this",
- true,
- o == this );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
function MyFunction( value ) {
- return this;
+ return this;
}
function MyObject( value ) {
- this.THIS = this;
+ this.THIS = this;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-2.js b/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-2.js
index 3a5c350d5d6..6b0649284fe 100644
--- a/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-2.js
+++ b/mozilla/js/tests/ecma/ExecutionContexts/10.2.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,56 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 10.2.3-2.js
- ECMA Section: 10.2.3 Function and Anonymous Code
- Description:
+ File Name: 10.2.3-2.js
+ ECMA Section: 10.2.3 Function and Anonymous Code
+ Description:
- The scope chain is initialized to contain the activation object followed
- by the global object. Variable instantiation is performed using the
- activation by the global object. Variable instantiation is performed using
- the activation object as the variable object and using property attributes
- { DontDelete }. The caller provides the this value. If the this value
- provided by the caller is not an object (including the case where it is
- null), then the this value is the global object.
+ The scope chain is initialized to contain the activation object followed
+ by the global object. Variable instantiation is performed using the
+ activation by the global object. Variable instantiation is performed using
+ the activation object as the variable object and using property attributes
+ { DontDelete }. The caller provides the this value. If the this value
+ provided by the caller is not an object (including the case where it is
+ null), then the this value is the global object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "10.2.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function and Anonymous Code";
+var SECTION = "10.2.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function and Anonymous Code";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var o = new MyObject("hello");
- var o = new MyObject("hello")
+new TestCase( SECTION,
+ "MyFunction(\"PASSED!\")",
+ "PASSED!",
+ MyFunction("PASSED!") );
- testcases[tc++] = new TestCase( SECTION,
- "MyFunction(\"PASSED!\")",
- "PASSED!",
- MyFunction("PASSED!") );
+var o = MyFunction();
- var o = MyFunction();
+new TestCase( SECTION,
+ "MyOtherFunction(true);",
+ false,
+ MyOtherFunction(true) );
- testcases[tc++] = new TestCase( SECTION,
- "MyOtherFunction(true);",
- false,
- MyOtherFunction(true) );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
function MyFunction( value ) {
- var x = value;
- delete x;
- return x;
+ var x = value;
+ delete x;
+ return x;
}
function MyOtherFunction(value) {
- var x = value;
- return delete x;
+ var x = value;
+ return delete x;
}
function MyObject( value ) {
- this.THIS = this;
+ this.THIS = this;
}
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/browser.js b/mozilla/js/tests/ecma/ExecutionContexts/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/ExecutionContexts/shell.js b/mozilla/js/tests/ecma/ExecutionContexts/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Expressions/11.1.1.js b/mozilla/js/tests/ecma/Expressions/11.1.1.js
index b5410ad6dbe..4d2584e1311 100644
--- a/mozilla/js/tests/ecma/Expressions/11.1.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.1.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,117 +35,101 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.1.1.js
- ECMA Section: 11.1.1 The this keyword
- Description:
+ File Name: 11.1.1.js
+ ECMA Section: 11.1.1 The this keyword
+ Description:
- The this keyword evaluates to the this value of the execution context.
+ The this keyword evaluates to the this value of the execution context.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.1.1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.1.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The this keyword");
+writeHeaderToLog( SECTION + " The this keyword");
- var testcases = new Array();
- var item = 0;
+var GLOBAL_OBJECT = this.toString();
- var GLOBAL_OBJECT = this.toString();
+// this in global code and eval(this) in global code should return the global object.
- // this in global code and eval(this) in global code should return the global object.
+new TestCase( SECTION,
+ "Global Code: this.toString()",
+ GLOBAL_OBJECT,
+ this.toString() );
- testcases[item++] = new TestCase( SECTION,
- "Global Code: this.toString()",
- GLOBAL_OBJECT,
- this.toString() );
+new TestCase( SECTION,
+ "Global Code: eval('this.toString()')",
+ GLOBAL_OBJECT,
+ eval('this.toString()') );
- testcases[item++] = new TestCase( SECTION,
- "Global Code: eval('this.toString()')",
- GLOBAL_OBJECT,
- eval('this.toString()') );
+// this in anonymous code called as a function should return the global object.
- // this in anonymous code called as a function should return the global object.
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('return this.toString()'); MYFUNC()",
- GLOBAL_OBJECT,
- eval("var MYFUNC = new Function('return this.toString()'); MYFUNC()") );
+// eval( this ) in anonymous code called as a function should return that function's activation object
- // eval( this ) in anonymous code called as a function should return that function's activation object
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()",
+ GLOBAL_OBJECT,
+ eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('return (eval(\"this.toString()\")'); (MYFUNC()).toString()",
- GLOBAL_OBJECT,
- eval("var MYFUNC = new Function('return eval(\"this.toString()\")'); (MYFUNC()).toString()") );
+// this and eval( this ) in anonymous code called as a constructor should return the object
- // this and eval( this ) in anonymous code called as a constructor should return the object
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()",
- "[object Object]",
- eval("var MYFUNC = new Function('this.THIS = this'); ((new MYFUNC()).THIS).toString()") );
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
- true,
- eval("var MYFUNC = new Function('this.THIS = this'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()",
+ "[object Object]",
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC().THIS).toString()",
- "[object Object]",
- eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); ((new MYFUNC()).THIS).toString()") );
+new TestCase( SECTION,
+ "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
+ true,
+ eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
- testcases[item++] = new TestCase( SECTION,
- "Anonymous Code: var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1",
- true,
- eval("var MYFUNC = new Function('this.THIS = eval(\"this\")'); var FUN1 = new MYFUNC(); FUN1.THIS == FUN1") );
+// this and eval(this) in function code called as a function should return the global object.
+new TestCase( SECTION,
+ "Function Code: ReturnThis()",
+ GLOBAL_OBJECT,
+ ReturnThis() );
- // this and eval(this) in function code called as a function should return the global object.
- testcases[item++] = new TestCase( SECTION,
- "Function Code: ReturnThis()",
- GLOBAL_OBJECT,
- ReturnThis() );
+new TestCase( SECTION,
+ "Function Code: ReturnEvalThis()",
+ GLOBAL_OBJECT,
+ ReturnEvalThis() );
- testcases[item++] = new TestCase( SECTION,
- "Function Code: ReturnEvalThis()",
- GLOBAL_OBJECT,
- ReturnEvalThis() );
+// this and eval(this) in function code called as a contructor should return the object.
+new TestCase( SECTION,
+ "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") );
- // this and eval(this) in function code called as a contructor should return the object.
- testcases[item++] = new TestCase( SECTION,
- "var MYOBJECT = new ReturnThis(); MYOBJECT.toString()",
- "[object Object]",
- eval("var MYOBJECT = new ReturnThis(); MYOBJECT.toString()") );
+new TestCase( SECTION,
+ "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()",
+ "[object Object]",
+ eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") );
- testcases[item++] = new TestCase( SECTION,
- "var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()",
- "[object Object]",
- eval("var MYOBJECT = new ReturnEvalThis(); MYOBJECT.toString()") );
+test();
-
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function ReturnThis() {
- return this.toString();
+ return this.toString();
}
+
function ReturnEvalThis() {
- return( eval("this.toString()") );
-}
\ No newline at end of file
+ return( eval("this.toString()") );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.10-1.js b/mozilla/js/tests/ecma/Expressions/11.10-1.js
index 1d43b678dc0..cba5fefb90c 100644
--- a/mozilla/js/tests/ecma/Expressions/11.10-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.10-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,251 +36,232 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 11.10-1.js
- ECMA Section: 11.10-1 Binary Bitwise Operators: &
- Description:
- Semantics
+ File Name: 11.10-1.js
+ ECMA Section: 11.10-1 Binary Bitwise Operators: &
+ Description:
+ Semantics
- The production A : A @ B, where @ is one of the bitwise operators in the
- productions &, ^, | , is evaluated as follows:
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
- 1. Evaluate A.
- 2. Call GetValue(Result(1)).
- 3. Evaluate B.
- 4. Call GetValue(Result(3)).
- 5. Call ToInt32(Result(2)).
- 6. Call ToInt32(Result(4)).
- 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
- a signed 32 bit integer.
- 8. Return Result(7).
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.10-1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.10-1";
+var VERSION = "ECMA_1";
+startTest();
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: &");
- writeHeaderToLog( SECTION + " Binary Bitwise Operators: &");
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- var shiftexp = 0;
- var addexp = 0;
+var shiftexp = 0;
+var addexp = 0;
// for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
- for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) {
- shiftexp += Math.pow( 2, shiftpow );
+for ( shiftpow = 0; shiftpow < 1; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
- for ( addpow = 0; addpow < 33; addpow++ ) {
- addexp += Math.pow(2, addpow);
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
- array[item++] = new TestCase( SECTION,
- shiftexp + " & " + addexp,
- And( shiftexp, addexp ),
- shiftexp & addexp );
- }
- }
-
- return ( array );
+ new TestCase( SECTION,
+ shiftexp + " & " + addexp,
+ And( shiftexp, addexp ),
+ shiftexp & addexp );
+ }
}
-function ToInteger( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
- if ( n != n ) {
- return 0;
- }
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
- return n;
- }
- return ( sign * Math.floor(Math.abs(n)) );
+test();
+
+function ToInteger( n ) {
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
+
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- return ( n );
+ return ( n );
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
function ToUint16( n ) {
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
- if (n <0) {
- n += Math.pow(2,16);
- }
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
- return ( n );
+ return ( n );
}
function Mask( b, n ) {
- b = ToUint32BitString( b );
- b = b.substring( b.length - n );
- b = ToUint32Decimal( b );
- return ( b );
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
}
function ToUint32BitString( n ) {
- var b = "";
- for ( p = 31; p >=0; p-- ) {
- if ( n >= Math.pow(2,p) ) {
- b += "1";
- n -= Math.pow(2,p);
- } else {
- b += "0";
- }
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
}
- return b;
+ }
+ return b;
}
function ToInt32BitString( n ) {
- var b = "";
- var sign = ( n < 0 ) ? -1 : 1;
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
- b += ( sign == 1 ) ? "0" : "1";
+ b += ( sign == 1 ) ? "0" : "1";
- for ( p = 30; p >=0; p-- ) {
- if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
- b += ( sign == 1 ) ? "1" : "0";
- n -= sign * Math.pow( 2, p );
- } else {
- b += ( sign == 1 ) ? "0" : "1";
- }
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
}
+ }
- return b;
+ return b;
}
function ToInt32Decimal( bin ) {
- var r = 0;
- var sign;
+ var r = 0;
+ var sign;
- if ( Number(bin.charAt(0)) == 0 ) {
- sign = 1;
- r = 0;
- } else {
- sign = -1;
- r = -(Math.pow(2,31));
- }
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
- for ( var j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function ToUint32Decimal( bin ) {
- var r = 0;
+ var r = 0;
- for ( l = bin.length; l < 32; l++ ) {
- bin = "0" + bin;
- }
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
- for ( j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ }
- return r;
+ return r;
}
function And( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
- return ToInt32Decimal(result);
+ }
+ return ToInt32Decimal(result);
}
function Xor( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
- (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
- ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
function Or( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.10-2.js b/mozilla/js/tests/ecma/Expressions/11.10-2.js
index 4637ca1a99d..557fcfed54f 100644
--- a/mozilla/js/tests/ecma/Expressions/11.10-2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.10-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,250 +36,231 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 11.10-2.js
- ECMA Section: 11.10-2 Binary Bitwise Operators: |
- Description:
- Semantics
+ File Name: 11.10-2.js
+ ECMA Section: 11.10-2 Binary Bitwise Operators: |
+ Description:
+ Semantics
- The production A : A @ B, where @ is one of the bitwise operators in the
- productions &, ^, | , is evaluated as follows:
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
- 1. Evaluate A.
- 2. Call GetValue(Result(1)).
- 3. Evaluate B.
- 4. Call GetValue(Result(3)).
- 5. Call ToInt32(Result(2)).
- 6. Call ToInt32(Result(4)).
- 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
- a signed 32 bit integer.
- 8. Return Result(7).
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.10-2";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.10-2";
+var VERSION = "ECMA_1";
+startTest();
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: |");
- writeHeaderToLog( SECTION + " Binary Bitwise Operators: |");
- test();
+var shiftexp = 0;
+var addexp = 0;
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ new TestCase( SECTION,
+ shiftexp + " | " + addexp,
+ Or( shiftexp, addexp ),
+ shiftexp | addexp );
+ }
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- var shiftexp = 0;
- var addexp = 0;
- for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
- shiftexp += Math.pow( 2, shiftpow );
+test();
- for ( addpow = 0; addpow < 33; addpow++ ) {
- addexp += Math.pow(2, addpow);
-
- array[item++] = new TestCase( SECTION,
- shiftexp + " | " + addexp,
- Or( shiftexp, addexp ),
- shiftexp | addexp );
- }
- }
-
- return ( array );
-}
function ToInteger( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( n != n ) {
- return 0;
- }
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
- return n;
- }
- return ( sign * Math.floor(Math.abs(n)) );
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- return ( n );
+ return ( n );
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
function ToUint16( n ) {
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
- if (n <0) {
- n += Math.pow(2,16);
- }
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
- return ( n );
+ return ( n );
}
function Mask( b, n ) {
- b = ToUint32BitString( b );
- b = b.substring( b.length - n );
- b = ToUint32Decimal( b );
- return ( b );
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
}
function ToUint32BitString( n ) {
- var b = "";
- for ( p = 31; p >=0; p-- ) {
- if ( n >= Math.pow(2,p) ) {
- b += "1";
- n -= Math.pow(2,p);
- } else {
- b += "0";
- }
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
}
- return b;
+ }
+ return b;
}
function ToInt32BitString( n ) {
- var b = "";
- var sign = ( n < 0 ) ? -1 : 1;
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
- b += ( sign == 1 ) ? "0" : "1";
+ b += ( sign == 1 ) ? "0" : "1";
- for ( p = 30; p >=0; p-- ) {
- if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
- b += ( sign == 1 ) ? "1" : "0";
- n -= sign * Math.pow( 2, p );
- } else {
- b += ( sign == 1 ) ? "0" : "1";
- }
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
}
+ }
- return b;
+ return b;
}
function ToInt32Decimal( bin ) {
- var r = 0;
- var sign;
+ var r = 0;
+ var sign;
- if ( Number(bin.charAt(0)) == 0 ) {
- sign = 1;
- r = 0;
- } else {
- sign = -1;
- r = -(Math.pow(2,31));
- }
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
- for ( var j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function ToUint32Decimal( bin ) {
- var r = 0;
+ var r = 0;
- for ( l = bin.length; l < 32; l++ ) {
- bin = "0" + bin;
- }
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
- for ( j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ }
- return r;
+ return r;
}
function And( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
- return ToInt32Decimal(result);
+ }
+ return ToInt32Decimal(result);
}
function Xor( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
- (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
- ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
function Or( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.10-3.js b/mozilla/js/tests/ecma/Expressions/11.10-3.js
index d224aba0410..7a476599cf3 100644
--- a/mozilla/js/tests/ecma/Expressions/11.10-3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.10-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,249 +36,230 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 11.10-3.js
- ECMA Section: 11.10-3 Binary Bitwise Operators: ^
- Description:
- Semantics
+ File Name: 11.10-3.js
+ ECMA Section: 11.10-3 Binary Bitwise Operators: ^
+ Description:
+ Semantics
- The production A : A @ B, where @ is one of the bitwise operators in the
- productions &, ^, | , is evaluated as follows:
+ The production A : A @ B, where @ is one of the bitwise operators in the
+ productions &, ^, | , is evaluated as follows:
- 1. Evaluate A.
- 2. Call GetValue(Result(1)).
- 3. Evaluate B.
- 4. Call GetValue(Result(3)).
- 5. Call ToInt32(Result(2)).
- 6. Call ToInt32(Result(4)).
- 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
- a signed 32 bit integer.
- 8. Return Result(7).
+ 1. Evaluate A.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate B.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToInt32(Result(2)).
+ 6. Call ToInt32(Result(4)).
+ 7. Apply the bitwise operator @ to Result(5) and Result(6). The result is
+ a signed 32 bit integer.
+ 8. Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.10-3";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.10-3";
+var VERSION = "ECMA_1";
+startTest();
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^");
- writeHeaderToLog( SECTION + " Binary Bitwise Operators: ^");
- test();
+var shiftexp = 0;
+var addexp = 0;
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
+ shiftexp += Math.pow( 2, shiftpow );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ for ( addpow = 0; addpow < 33; addpow++ ) {
+ addexp += Math.pow(2, addpow);
+
+ new TestCase( SECTION,
+ shiftexp + " ^ " + addexp,
+ Xor( shiftexp, addexp ),
+ shiftexp ^ addexp );
+ }
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- var shiftexp = 0;
- var addexp = 0;
- for ( shiftpow = 0; shiftpow < 33; shiftpow++ ) {
- shiftexp += Math.pow( 2, shiftpow );
+test();
- for ( addpow = 0; addpow < 33; addpow++ ) {
- addexp += Math.pow(2, addpow);
-
- array[item++] = new TestCase( SECTION,
- shiftexp + " ^ " + addexp,
- Xor( shiftexp, addexp ),
- shiftexp ^ addexp );
- }
- }
-
- return ( array );
-}
function ToInteger( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( n != n ) {
- return 0;
- }
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
- return n;
- }
- return ( sign * Math.floor(Math.abs(n)) );
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- return ( n );
+ return ( n );
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
function ToUint16( n ) {
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
- if (n <0) {
- n += Math.pow(2,16);
- }
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
- return ( n );
+ return ( n );
}
function Mask( b, n ) {
- b = ToUint32BitString( b );
- b = b.substring( b.length - n );
- b = ToUint32Decimal( b );
- return ( b );
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
}
function ToUint32BitString( n ) {
- var b = "";
- for ( p = 31; p >=0; p-- ) {
- if ( n >= Math.pow(2,p) ) {
- b += "1";
- n -= Math.pow(2,p);
- } else {
- b += "0";
- }
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
}
- return b;
+ }
+ return b;
}
function ToInt32BitString( n ) {
- var b = "";
- var sign = ( n < 0 ) ? -1 : 1;
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
- b += ( sign == 1 ) ? "0" : "1";
+ b += ( sign == 1 ) ? "0" : "1";
- for ( p = 30; p >=0; p-- ) {
- if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
- b += ( sign == 1 ) ? "1" : "0";
- n -= sign * Math.pow( 2, p );
- } else {
- b += ( sign == 1 ) ? "0" : "1";
- }
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
}
+ }
- return b;
+ return b;
}
function ToInt32Decimal( bin ) {
- var r = 0;
- var sign;
+ var r = 0;
+ var sign;
- if ( Number(bin.charAt(0)) == 0 ) {
- sign = 1;
- r = 0;
- } else {
- sign = -1;
- r = -(Math.pow(2,31));
- }
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
- for ( var j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function ToUint32Decimal( bin ) {
- var r = 0;
+ var r = 0;
- for ( l = bin.length; l < 32; l++ ) {
- bin = "0" + bin;
- }
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
- for ( j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ for ( j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ }
- return r;
+ return r;
}
function And( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" && ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
- return ToInt32Decimal(result);
+ }
+ return ToInt32Decimal(result);
}
function Xor( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
- (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
- ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( (bs.charAt(bit) == "1" && ba.charAt(bit) == "0") ||
+ (bs.charAt(bit) == "0" && ba.charAt(bit) == "1")
+ ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
function Or( s, a ) {
- s = ToInt32( s );
- a = ToInt32( a );
+ s = ToInt32( s );
+ a = ToInt32( a );
- var bs = ToInt32BitString( s );
- var ba = ToInt32BitString( a );
+ var bs = ToInt32BitString( s );
+ var ba = ToInt32BitString( a );
- var result = "";
+ var result = "";
- for ( var bit = 0; bit < bs.length; bit++ ) {
- if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
- result += "1";
- } else {
- result += "0";
- }
+ for ( var bit = 0; bit < bs.length; bit++ ) {
+ if ( bs.charAt(bit) == "1" || ba.charAt(bit) == "1" ) {
+ result += "1";
+ } else {
+ result += "0";
}
+ }
- return ToInt32Decimal(result);
+ return ToInt32Decimal(result);
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.12-1.js b/mozilla/js/tests/ecma/Expressions/11.12-1.js
index adecedb4de9..7111a0aaa9b 100644
--- a/mozilla/js/tests/ecma/Expressions/11.12-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.12-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.12.js
- ECMA Section: 11.12 Conditional Operator
- Description:
- Logi
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
- calORExpression ? AssignmentExpression : AssignmentExpression
+ calORExpression ? AssignmentExpression : AssignmentExpression
- Semantics
+ Semantics
- The production ConditionalExpression :
- LogicalORExpression ? AssignmentExpression : AssignmentExpression
- is evaluated as follows:
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
- 1. Evaluate LogicalORExpression.
- 2. Call GetValue(Result(1)).
- 3. Call ToBoolean(Result(2)).
- 4. If Result(3) is false, go to step 8.
- 5. Evaluate the first AssignmentExpression.
- 6. Call GetValue(Result(5)).
- 7. Return Result(6).
- 8. Evaluate the second AssignmentExpression.
- 9. Call GetValue(Result(8)).
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
10. Return Result(9).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.12";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.12";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Conditional operator( ? : )");
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+writeHeaderToLog( SECTION + " Conditional operator( ? : )");
- array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+new TestCase( SECTION,
+ "true ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
- array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION,
+ "false ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (false?"FAILED":"PASSED"));
- array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
+new TestCase( SECTION,
+ "1 ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
+new TestCase( SECTION,
+ "0 ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (false?"FAILED":"PASSED"));
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "-1 ? 'PASSED' : 'FAILED'",
+ "PASSED",
+ (true?"PASSED":"FAILED"));
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "NaN ? 'FAILED' : 'PASSED'",
+ "PASSED",
+ (Number.NaN?"FAILED":"PASSED"));
+
+new TestCase( SECTION,
+ "var VAR = true ? , : 'FAILED'",
+ "PASSED",
+ (VAR = true ? "PASSED" : "FAILED") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.12-2-n.js b/mozilla/js/tests/ecma/Expressions/11.12-2-n.js
index 83dad6ede50..99379ca42e2 100644
--- a/mozilla/js/tests/ecma/Expressions/11.12-2-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.12-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.12-2-n.js
- ECMA Section: 11.12
- Description:
+ File Name: 11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
- The grammar for a ConditionalExpression in ECMAScript is a little bit
- different from that in C and Java, which each allow the second
- subexpression to be an Expression but restrict the third expression to
- be a ConditionalExpression. The motivation for this difference in
- ECMAScript is to allow an assignment expression to be governed by either
- arm of a conditional and to eliminate the confusing and fairly useless
- case of a comma expression as the center expression.
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.12-2-n";
- var VERSION = "ECMA_1";
- startTest();
- writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+var SECTION = "11.12-2-n";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
- var testcases = new Array();
+// the following expression should be an error in JS.
- // the following expression should be an error in JS.
+DESCRIPTION = "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR";
+EXPECTED = "error";
- testcases[tc] = new TestCase( SECTION,
- "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR",
- "error",
- "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR" );
+new TestCase( SECTION,
+ "var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR",
+ "error",
+ eval("var MYVAR = true ? 'EXPR1', 'EXPR2' : 'EXPR3'; MYVAR") );
- // get around parse time error by putting expression in an eval statement
+test();
- testcases[tc].actual = eval ( testcases[tc].actual );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.12-3.js b/mozilla/js/tests/ecma/Expressions/11.12-3.js
index 6dcd3f718f8..0f2cb9b0272 100644
--- a/mozilla/js/tests/ecma/Expressions/11.12-3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.12-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.12-3.js
- ECMA Section: 11.12
- Description:
+ File Name: 11.12-3.js
+ ECMA Section: 11.12
+ Description:
- The grammar for a ConditionalExpression in ECMAScript is a little bit
- different from that in C and Java, which each allow the second
- subexpression to be an Expression but restrict the third expression to
- be a ConditionalExpression. The motivation for this difference in
- ECMAScript is to allow an assignment expression to be governed by either
- arm of a conditional and to eliminate the confusing and fairly useless
- case of a comma expression as the center expression.
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.12-3";
- var VERSION = "ECMA_1";
- startTest();
- writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+var SECTION = "11.12-3";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
- var testcases = new Array();
+// the following expression should NOT be an error in JS.
- // the following expression should NOT be an error in JS.
+new TestCase( SECTION,
+ "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR",
+ "PASSED",
+ eval("var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR"));
- testcases[tc] = new TestCase( SECTION,
- "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR",
- "PASSED",
- "var MYVAR = true ? ('FAIL1', 'PASSED') : 'FAIL2'; MYVAR" );
+test();
- // get around potential parse time error by putting expression in an eval statement
-
- testcases[tc].actual = eval ( testcases[tc].actual );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.12-4.js b/mozilla/js/tests/ecma/Expressions/11.12-4.js
index 25116164d54..eb5e32093ae 100644
--- a/mozilla/js/tests/ecma/Expressions/11.12-4.js
+++ b/mozilla/js/tests/ecma/Expressions/11.12-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.12-4.js
- ECMA Section: 11.12
- Description:
+ File Name: 11.12-4.js
+ ECMA Section: 11.12
+ Description:
- The grammar for a ConditionalExpression in ECMAScript is a little bit
- different from that in C and Java, which each allow the second
- subexpression to be an Expression but restrict the third expression to
- be a ConditionalExpression. The motivation for this difference in
- ECMAScript is to allow an assignment expression to be governed by either
- arm of a conditional and to eliminate the confusing and fairly useless
- case of a comma expression as the center expression.
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.12-4";
- var VERSION = "ECMA_1";
- startTest();
- writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
+var SECTION = "11.12-4";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Conditional operator ( ? : )");
- var testcases = new Array();
+// the following expression should NOT be an error in JS.
- // the following expression should NOT be an error in JS.
+new TestCase( SECTION,
+ "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1",
+ "PASSED",
+ eval("true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1") );
- testcases[tc] = new TestCase( SECTION,
- "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1",
- "PASSED",
- "true ? MYVAR1 = 'PASSED' : MYVAR1 = 'FAILED'; MYVAR1" );
+test();
- // get around potential parse time error by putting expression in an eval statement
-
- testcases[tc].actual = eval ( testcases[tc].actual );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.1.js b/mozilla/js/tests/ecma/Expressions/11.13.1.js
index 0ec0b238713..2385f483141 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.1.js
- ECMA Section: 11.13.1 Simple assignment
- Description:
+/**
+ File Name: 11.13.1.js
+ ECMA Section: 11.13.1 Simple assignment
+ Description:
- 11.13.1 Simple Assignment ( = )
+ 11.13.1 Simple Assignment ( = )
- The production AssignmentExpression :
- LeftHandSideExpression = AssignmentExpression is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression = AssignmentExpression is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Evaluate AssignmentExpression.
- 3. Call GetValue(Result(2)).
- 4. Call PutValue(Result(1), Result(3)).
- 5. Return Result(3).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Evaluate AssignmentExpression.
+ 3. Call GetValue(Result(2)).
+ 4. Call PutValue(Result(1), Result(3)).
+ 5. Return Result(3).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Simple Assignment ( = )");
- test();
+writeHeaderToLog( SECTION + " Simple Assignment ( = )");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "SOMEVAR = true",
+ true,
+ SOMEVAR = true );
- array[item++] = new TestCase( SECTION, "SOMEVAR = true", true, SOMEVAR = true );
+test();
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.2-1.js b/mozilla/js/tests/ecma/Expressions/11.13.2-1.js
index ae1f31ac73c..157dd0e2f3c 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.2-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,104 +35,194 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.2-1.js
- ECMA Section: 11.13.2 Compound Assignment: *=
- Description:
+/**
+ File Name: 11.13.2-1.js
+ ECMA Section: 11.13.2 Compound Assignment: *=
+ Description:
- *= /= %= += -= <<= >>= >>>= &= ^= |=
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
- 11.13.2 Compound assignment ( op= )
+ 11.13.2 Compound assignment ( op= )
- The production AssignmentExpression :
- LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
- the operators indicated above, is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Apply operator @ to Result(2) and Result(4).
- 6. Call PutValue(Result(1), Result(5)).
- 7. Return Result(5).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.2-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Compound Assignment: *=");
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // NaN cases
-
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") );
-
- // number cases
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") );
-
- array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") );
-
- // special multiplication cases
-
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
-
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
-
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
-
- // string cases
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2", 2550, eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") );
-
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
-
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
-
- // boolean cases
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 *= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 *= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") );
-
- // object cases
- array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2", 225, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") );
+writeHeaderToLog( SECTION + " Compound Assignment: *=");
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// NaN cases
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 *= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 *= VAR2; VAR1") );
+
+// number cases
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 *= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 *= VAR2;VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0xFF; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 *= VAR2") );
+
+// special multiplication cases
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 *= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 *= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 *= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 *= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 *= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 *= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 *= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 10; VAR2 = '255', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 10; VAR2 = '255', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '255'; VAR2 = 10, VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = 10; VAR2 = '0XFF', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '10'; VAR2 = '255', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 *= VAR2",
+ 2550,
+ eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 *= VAR2") );
+
+// boolean cases
+new TestCase( SECTION,
+ "VAR1 = true; VAR2 = false; VAR1 *= VAR2",
+ 0,
+ eval("VAR1 = true; VAR2 = false; VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = true; VAR2 = true; VAR1 *= VAR2",
+ 1,
+ eval("VAR1 = true; VAR2 = true; VAR1 *= VAR2") );
+
+// object cases
+new TestCase( SECTION,
+ "VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2;VAR1",
+ 10,
+ eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1",
+ 110,
+ eval("VAR1 = new Number(11); VAR2 = 10; VAR1 *= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2",
+ 110,
+ eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 *= VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2",
+ 225,
+ eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 *= VAR2") );
+
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.2-2.js b/mozilla/js/tests/ecma/Expressions/11.13.2-2.js
index 1ebfe8faee7..1d66e2c7cfd 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.2-2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,118 +35,216 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.2-2js
- ECMA Section: 11.13.2 Compound Assignment: /=
- Description:
+/**
+ File Name: 11.13.2-2js
+ ECMA Section: 11.13.2 Compound Assignment: /=
+ Description:
- *= /= %= += -= <<= >>= >>>= &= ^= |=
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
- 11.13.2 Compound assignment ( op= )
+ 11.13.2 Compound assignment ( op= )
- The production AssignmentExpression :
- LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
- the operators indicated above, is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Apply operator @ to Result(2) and Result(4).
- 6. Call PutValue(Result(1), Result(5)).
- 7. Return Result(5).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.2-2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Compound Assignment: /=");
- test();
+writeHeaderToLog( SECTION + " Compound Assignment: /=");
-function getTestCases() {
- var array = new Array();
- var item = 0;
- // NaN cases
+// NaN cases
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2") );
- // number cases
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") );
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2", 25.5, eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") );
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2") );
- // special division cases
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 /= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+// number cases
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 /= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2=1; VAR1 /= VAR2;VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 /= VAR2", Number.NEGATIVE_INFINITY, eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 /= VAR2", Number.POSITIVE_INFINITY, eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = 0xFF; VAR2 = 0xA, VAR1 /= VAR2",
+ 25.5,
+ eval("VAR1 = 0XFF; VAR2 = 0XA, VAR1 /= VAR2") );
- // string cases
- array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1", 100, eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1", 100, eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") );
+// special division cases
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 /= VAR2",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 /= VAR1",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 /= VAR1",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 /= VAR1",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 /= VAR1",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 /= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -0; VAR1 /= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= 0; VAR1 /= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = 1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -0; VAR1 /= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = 1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= 0; VAR1 /= VAR2",
+ Number.NEGATIVE_INFINITY,
+ eval("VAR1 = -1; VAR2 = 0; VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -0; VAR1 /= VAR2",
+ Number.POSITIVE_INFINITY,
+ eval("VAR1 = -1; VAR2 = -0; VAR1 /= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1",
+ 100,
+ eval("VAR1 = 1000; VAR2 = '10', VAR1 /= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1",
+ 100,
+ eval("VAR1 = '1000'; VAR2 = 10, VAR1 /= VAR2; VAR1") );
/*
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 /= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 /= VAR2") );
- // boolean cases
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") );
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 /= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 /= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 /= VAR2") );
- // object cases
- array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") );
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 /= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 /= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 /= VAR2") );
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.2-3.js b/mozilla/js/tests/ecma/Expressions/11.13.2-3.js
index 903c2f63b0e..c49af4af6c2 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.2-3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,131 +35,263 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.2-4.js
- ECMA Section: 11.13.2 Compound Assignment: %=
- Description:
+/**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment: %=
+ Description:
- *= /= %= += -= <<= >>= >>>= &= ^= |=
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
- 11.13.2 Compound assignment ( op= )
+ 11.13.2 Compound assignment ( op= )
- The production AssignmentExpression :
- LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
- the operators indicated above, is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Apply operator @ to Result(2) and Result(4).
- 6. Call PutValue(Result(1), Result(5)).
- 7. Return Result(5).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.2-3";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Compound Assignment: +=");
- test();
+writeHeaderToLog( SECTION + " Compound Assignment: +=");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// If either operand is NaN, result is NaN
- // If either operand is NaN, result is NaN
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=1; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=1; VAR1 %= VAR2; VAR1") );
- // if the dividend is infinity or the divisor is zero or both, the result is NaN
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = NaN; VAR2=0; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NaN; VAR2=0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1", Number.NaN, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2=NaN; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2=Number.NaN; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+// if the dividend is infinity or the divisor is zero or both, the result is NaN
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= 0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -0; VAR1 %= VAR2", Number.NaN, eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- // if the dividend is finite and the divisor is an infinity, the result equals the dividend.
+new TestCase( SECTION,
+ "VAR1 = Infinity; VAR2= -Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -0, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 0, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2= Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", -1, eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1", 1, eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 =-Infinity; VAR2=-Infinity; VAR1 %= VAR2; VAR1",
+ Number.NaN,
+ eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
- // if the dividend is a zero and the divisor is finite, the result is the same as the dividend
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1", -0, eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
- // string cases
- array[item++] = new TestCase( SECTION, "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1", 0, eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1", 0, eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") );
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -Infinity; VAR2 %= VAR1",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR2 %= VAR1; VAR2") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -0; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = 1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= 0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = 0; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -0; VAR1 %= VAR2",
+ Number.NaN,
+ eval("VAR1 = -1; VAR2 = -0; VAR1 %= VAR2; VAR1") );
+
+// if the dividend is finite and the divisor is an infinity, the result equals the dividend.
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ 1,
+ eval("VAR1 = 1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= Infinity; VAR1 %= VAR2;VAR1",
+ -1,
+ eval("VAR1 = -1; VAR2 = Number.POSITIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -1; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ -1,
+ eval("VAR1 = -1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 1; VAR2= -Infinity; VAR1 %= VAR2;VAR1",
+ 1,
+ eval("VAR1 = 1; VAR2 = Number.NEGATIVE_INFINITY; VAR1 %= VAR2; VAR1") );
+
+// if the dividend is a zero and the divisor is finite, the result is the same as the dividend
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= 1; VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= 1; VAR1 %= VAR2; VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = 1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = -0; VAR2= -1; VAR1 %= VAR2; VAR1",
+ -0,
+ eval("VAR1 = -0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = 0; VAR2= -1; VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 0; VAR2 = -1; VAR1 %= VAR2; VAR1") );
+
+// string cases
+new TestCase( SECTION,
+ "VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = 1000; VAR2 = '10', VAR1 %= VAR2; VAR1") );
+
+new TestCase( SECTION,
+ "VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1",
+ 0,
+ eval("VAR1 = '1000'; VAR2 = 10, VAR1 %= VAR2; VAR1") );
/*
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 %= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 %= VAR2") );
- // boolean cases
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") );
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 %= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 %= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 %= VAR2") );
- // object cases
- array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") );
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 %= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 %= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 %= VAR2") );
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason %= ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.2-4.js b/mozilla/js/tests/ecma/Expressions/11.13.2-4.js
index 01b6f9de341..5d9f4911dac 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.2-4.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,119 +35,100 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.2-4.js
- ECMA Section: 11.13.2 Compound Assignment:+=
- Description:
+/**
+ File Name: 11.13.2-4.js
+ ECMA Section: 11.13.2 Compound Assignment:+=
+ Description:
- *= /= %= += -= <<= >>= >>>= &= ^= |=
+ *= /= %= += -= <<= >>= >>>= &= ^= |=
- 11.13.2 Compound assignment ( op= )
+ 11.13.2 Compound assignment ( op= )
- The production AssignmentExpression :
- LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
- the operators indicated above, is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Apply operator @ to Result(2) and Result(4).
- 6. Call PutValue(Result(1), Result(5)).
- 7. Return Result(5).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.2-4";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.2-4";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Compound Assignment: +=");
- test();
+writeHeaderToLog( SECTION + " Compound Assignment: +=");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// If either operand is NaN, result is NaN
- // If either operand is NaN, result is NaN
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 += VAR2; VAR1") );
+// the sum of two Infinities the same sign is the infinity of that sign
+// the sum of two Infinities of opposite sign is NaN
- // the sum of two Infinities the same sign is the infinity of that sign
- // the sum of two Infinities of opposite sign is NaN
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 += VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 += VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+// the sum of an infinity and a finite value is equal to the infinite operand
- // the sum of an infinity and a finite value is equal to the infinite operand
+new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 += VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 += VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 += VAR2; VAR1") );
+// the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
- // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 += VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 += VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 += VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 += VAR2; VAR1") );
+// the sum of a zero and a nonzero finite value is eqal to the nonzero operand
- // the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = 0; VAR2 = 1; VAR2 += VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR2 += VAR1; VAR2", 1, eval("VAR1 = -0; VAR2 = 1; VAR2 += VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = -0; VAR2 = -1; VAR2 += VAR1; VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR2 += VAR1; VAR2", -1, eval("VAR1 = 0; VAR2 = -1; VAR2 += VAR1; VAR2") );
+// the sum of a zero and a nozero finite value is equal to the nonzero operand.
+new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") );
- // the sum of a zero and a nozero finite value is equal to the nonzero operand.
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=1; VAR1 += VAR2;VAR1") );
-
- // the sum of two nonzero finite values of the same magnitude and opposite sign is +0
- array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") );
+// the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= -Number.MAX_VALUE; VAR1 += VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= -Number.MIN_VALUE; VAR1 += VAR2; VAR1") );
/*
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 += VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 += VAR2") );
- // boolean cases
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") );
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 += VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 += VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 += VAR2") );
- // object cases
- array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") );
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 += VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 += VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 += VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 += VAR2") );
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.2-5.js b/mozilla/js/tests/ecma/Expressions/11.13.2-5.js
index 11b62da7015..5d9fcb16053 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.2-5.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.2-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,119 +35,100 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.13.2-5.js
- ECMA Section: 11.13.2 Compound Assignment: -=
- Description:
+/**
+ File Name: 11.13.2-5.js
+ ECMA Section: 11.13.2 Compound Assignment: -=
+ Description:
- *= /= %= -= -= <<= >>= >>>= &= ^= |=
+ *= /= %= -= -= <<= >>= >>>= &= ^= |=
- 11.13.2 Compound assignment ( op= )
+ 11.13.2 Compound assignment ( op= )
- The production AssignmentExpression :
- LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
- the operators indicated above, is evaluated as follows:
+ The production AssignmentExpression :
+ LeftHandSideExpression @ = AssignmentExpression, where @ represents one of
+ the operators indicated above, is evaluated as follows:
- 1. Evaluate LeftHandSideExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Apply operator @ to Result(2) and Result(4).
- 6. Call PutValue(Result(1), Result(5)).
- 7. Return Result(5).
+ 1. Evaluate LeftHandSideExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Apply operator @ to Result(2) and Result(4).
+ 6. Call PutValue(Result(1), Result(5)).
+ 7. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.13.2-5";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.13.2-5";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Compound Assignment: -=");
- test();
+writeHeaderToLog( SECTION + " Compound Assignment: -=");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// If either operand is NaN, result is NaN
- // If either operand is NaN, result is NaN
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=1; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=1; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = NaN; VAR2=0; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NaN; VAR2=0; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=NaN; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = 0; VAR2=Number.NaN; VAR1 -= VAR2; VAR1") );
+// the sum of two Infinities the same sign is the infinity of that sign
+// the sum of two Infinities of opposite sign is NaN
- // the sum of two Infinities the same sign is the infinity of that sign
- // the sum of two Infinities of opposite sign is NaN
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Infinity; VAR2= -Infinity; VAR1 -= VAR2; VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = Number.POSITIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2= Infinity; VAR1 -= VAR2; VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 =-Infinity; VAR2=-Infinity; VAR1 -= VAR2; VAR1", Number.NaN, eval("VAR1 = Number.NEGATIVE_INFINITY; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+// the sum of an infinity and a finite value is equal to the infinite operand
- // the sum of an infinity and a finite value is equal to the infinite operand
+new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= Infinity; VAR1 -= VAR2;VAR1", Number.NEGATIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.POSITIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = 0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -Infinity; VAR1 -= VAR2;VAR1", Number.POSITIVE_INFINITY, eval("VAR1 = -0; VAR2 = Number.NEGATIVE_INFINITY; VAR1 -= VAR2; VAR1") );
+// the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
- // the sum of two negative zeros is -0. the sum of two positive zeros, or of two zeros of opposite sign, is +0
+new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 0; VAR1 -= VAR2", 0, eval("VAR1 = 0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -0; VAR1 -= VAR2", 0, eval("VAR1 = -0; VAR2 = 0; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 0; VAR1 -= VAR2", -0, eval("VAR1 = -0; VAR2 = -0; VAR1 -= VAR2; VAR1") );
+// the sum of a zero and a nonzero finite value is eqal to the nonzero operand
- // the sum of a zero and a nonzero finite value is eqal to the nonzero operand
+new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = 0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= -1; VAR1 -= VAR2; VAR1", 1, eval("VAR1 = -0; VAR2 = -1; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = -0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = -0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2= 1; VAR1 -= VAR2; VAR1", -1, eval("VAR1 = 0; VAR2 = 1; VAR1 -= VAR2; VAR1") );
+// the sum of a zero and a nozero finite value is equal to the nonzero operand.
+new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
+new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
- // the sum of a zero and a nozero finite value is equal to the nonzero operand.
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1", 1, eval("VAR1 = 0; VAR2=-1; VAR1 -= VAR2;VAR1") );
-
- // the sum of two nonzero finite values of the same magnitude and opposite sign is +0
- array[item++] = new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") );
+// the sum of two nonzero finite values of the same magnitude and opposite sign is +0
+new TestCase( SECTION, "VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MAX_VALUE; VAR2= Number.MAX_VALUE; VAR1 -= VAR2; VAR1") );
+new TestCase( SECTION, "VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1", 0, eval("VAR1 = Number.MIN_VALUE; VAR2= Number.MIN_VALUE; VAR1 -= VAR2; VAR1") );
/*
- array[item++] = new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = 10; VAR2 = '0XFF', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '255', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2", 2550, eval("VAR1 = '10'; VAR2 = '0XFF', VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = '0xFF'; VAR2 = 0xA, VAR1 -= VAR2", 2550, eval("VAR1 = '0XFF'; VAR2 = 0XA, VAR1 -= VAR2") );
- // boolean cases
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") );
+ // boolean cases
+ new TestCase( SECTION, "VAR1 = true; VAR2 = false; VAR1 -= VAR2", 0, eval("VAR1 = true; VAR2 = false; VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = true; VAR2 = true; VAR1 -= VAR2", 1, eval("VAR1 = true; VAR2 = true; VAR1 -= VAR2") );
- // object cases
- array[item++] = new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") );
- array[item++] = new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") );
- array[item++] = new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") );
+ // object cases
+ new TestCase( SECTION, "VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2;VAR1", 10, eval("VAR1 = new Boolean(true); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1", 110, eval("VAR1 = new Number(11); VAR2 = 10; VAR1 -= VAR2; VAR1") );
+ new TestCase( SECTION, "VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2", 110, eval("VAR1 = new Number(11); VAR2 = new Number(10); VAR1 -= VAR2") );
+ new TestCase( SECTION, "VAR1 = new String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2", 255, eval("VAR1 = String('15'); VAR2 = new String('0xF'); VAR1 -= VAR2") );
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason -= ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.13.js b/mozilla/js/tests/ecma/Expressions/11.13.js
index 283402033ba..685b7673ea0 100644
--- a/mozilla/js/tests/ecma/Expressions/11.13.js
+++ b/mozilla/js/tests/ecma/Expressions/11.13.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,49 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.12.js
- ECMA Section: 11.12 Conditional Operator
- Description:
- Logi
+/**
+ File Name: 11.12.js
+ ECMA Section: 11.12 Conditional Operator
+ Description:
+ Logi
- calORExpression ? AssignmentExpression : AssignmentExpression
+ calORExpression ? AssignmentExpression : AssignmentExpression
- Semantics
+ Semantics
- The production ConditionalExpression :
- LogicalORExpression ? AssignmentExpression : AssignmentExpression
- is evaluated as follows:
+ The production ConditionalExpression :
+ LogicalORExpression ? AssignmentExpression : AssignmentExpression
+ is evaluated as follows:
- 1. Evaluate LogicalORExpression.
- 2. Call GetValue(Result(1)).
- 3. Call ToBoolean(Result(2)).
- 4. If Result(3) is false, go to step 8.
- 5. Evaluate the first AssignmentExpression.
- 6. Call GetValue(Result(5)).
- 7. Return Result(6).
- 8. Evaluate the second AssignmentExpression.
- 9. Call GetValue(Result(8)).
+ 1. Evaluate LogicalORExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToBoolean(Result(2)).
+ 4. If Result(3) is false, go to step 8.
+ 5. Evaluate the first AssignmentExpression.
+ 6. Call GetValue(Result(5)).
+ 7. Return Result(6).
+ 8. Evaluate the second AssignmentExpression.
+ 9. Call GetValue(Result(8)).
10. Return Result(9).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.12";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.12";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Conditional operator( ? : )");
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+writeHeaderToLog( SECTION + " Conditional operator( ? : )");
- array[item++] = new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+new TestCase( SECTION, "true ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION, "false ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
- array[item++] = new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
- array[item++] = new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION, "1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
+new TestCase( SECTION, "0 ? 'FAILED' : 'PASSED'", "PASSED", (false?"FAILED":"PASSED"));
+new TestCase( SECTION, "-1 ? 'PASSED' : 'FAILED'", "PASSED", (true?"PASSED":"FAILED"));
- array[item++] = new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
+new TestCase( SECTION, "NaN ? 'FAILED' : 'PASSED'", "PASSED", (Number.NaN?"FAILED":"PASSED"));
- array[item++] = new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
+new TestCase( SECTION, "var VAR = true ? , : 'FAILED'", "PASSED", (VAR = true ? "PASSED" : "FAILED") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.14-1.js b/mozilla/js/tests/ecma/Expressions/11.14-1.js
index 228e9f5cb62..0e3d736669f 100644
--- a/mozilla/js/tests/ecma/Expressions/11.14-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.14-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,55 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.14-1.js
- ECMA Section: 11.14 Comma operator (,)
- Description:
- Expression :
+ File Name: 11.14-1.js
+ ECMA Section: 11.14 Comma operator (,)
+ Description:
+ Expression :
- AssignmentExpression
- Expression , AssignmentExpression
+ AssignmentExpression
+ Expression , AssignmentExpression
- Semantics
+ Semantics
- The production Expression : Expression , AssignmentExpression is evaluated as follows:
+ The production Expression : Expression , AssignmentExpression is evaluated as follows:
- 1. Evaluate Expression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AssignmentExpression.
- 4. Call GetValue(Result(3)).
- 5. Return Result(4).
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AssignmentExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Return Result(4).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.14-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.14-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Comma operator (,)");
- test();
+writeHeaderToLog( SECTION + " Comma operator (,)");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "true, false", false, eval("true, false") );
+new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") );
+new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "true, false", false, eval("true, false") );
- array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false", false, eval("VAR1=true, VAR2=false") );
- array[item++] = new TestCase( SECTION, "VAR1=true, VAR2=false;VAR1", true, eval("VAR1=true, VAR2=false; VAR1") );
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.1-1.js b/mozilla/js/tests/ecma/Expressions/11.2.1-1.js
index 9385680a5f3..dcef273f26a 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.1-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,249 +36,234 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 11.2.1-1.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: 11.2.1-1.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Properties are accessed by name, using either the dot notation:
- MemberExpression . Identifier
- CallExpression . Identifier
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
- or the bracket notation: MemberExpression [ Expression ]
- CallExpression [ Expression ]
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
- The dot notation is explained by the following syntactic conversion:
- MemberExpression . Identifier
- is identical in its behavior to
- MemberExpression [ ]
- and similarly
- CallExpression . Identifier
- is identical in its behavior to
- CallExpression [ ]
- where is a string literal containing the same sequence
- of characters as the Identifier.
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ ]
+ where is a string literal containing the same sequence
+ of characters as the Identifier.
- The production MemberExpression : MemberExpression [ Expression ] is
- evaluated as follows:
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate Expression.
- 4. Call GetValue(Result(3)).
- 5. Call ToObject(Result(2)).
- 6. Call ToString(Result(4)).
- 7. Return a value of type Reference whose base object is Result(5) and
- whose property name is Result(6).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
- The production CallExpression : CallExpression [ Expression ] is evaluated
- in exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "11.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// properties and functions of the global object
- // properties and functions of the global object
+PROPERTY[p++] = new Property( "this", "NaN", "number" );
+PROPERTY[p++] = new Property( "this", "Infinity", "number" );
+PROPERTY[p++] = new Property( "this", "eval", "function" );
+PROPERTY[p++] = new Property( "this", "parseInt", "function" );
+PROPERTY[p++] = new Property( "this", "parseFloat", "function" );
+PROPERTY[p++] = new Property( "this", "escape", "function" );
+PROPERTY[p++] = new Property( "this", "unescape", "function" );
+PROPERTY[p++] = new Property( "this", "isNaN", "function" );
+PROPERTY[p++] = new Property( "this", "isFinite", "function" );
+PROPERTY[p++] = new Property( "this", "Object", "function" );
+PROPERTY[p++] = new Property( "this", "Number", "function" );
+PROPERTY[p++] = new Property( "this", "Function", "function" );
+PROPERTY[p++] = new Property( "this", "Array", "function" );
+PROPERTY[p++] = new Property( "this", "String", "function" );
+PROPERTY[p++] = new Property( "this", "Boolean", "function" );
+PROPERTY[p++] = new Property( "this", "Date", "function" );
+PROPERTY[p++] = new Property( "this", "Math", "object" );
- PROPERTY[p++] = new Property( "this", "NaN", "number" );
- PROPERTY[p++] = new Property( "this", "Infinity", "number" );
- PROPERTY[p++] = new Property( "this", "eval", "function" );
- PROPERTY[p++] = new Property( "this", "parseInt", "function" );
- PROPERTY[p++] = new Property( "this", "parseFloat", "function" );
- PROPERTY[p++] = new Property( "this", "escape", "function" );
- PROPERTY[p++] = new Property( "this", "unescape", "function" );
- PROPERTY[p++] = new Property( "this", "isNaN", "function" );
- PROPERTY[p++] = new Property( "this", "isFinite", "function" );
- PROPERTY[p++] = new Property( "this", "Object", "function" );
- PROPERTY[p++] = new Property( "this", "Number", "function" );
- PROPERTY[p++] = new Property( "this", "Function", "function" );
- PROPERTY[p++] = new Property( "this", "Array", "function" );
- PROPERTY[p++] = new Property( "this", "String", "function" );
- PROPERTY[p++] = new Property( "this", "Boolean", "function" );
- PROPERTY[p++] = new Property( "this", "Date", "function" );
- PROPERTY[p++] = new Property( "this", "Math", "object" );
+// properties and methods of Object objects
- // properties and methods of Object objects
+PROPERTY[p++] = new Property( "Object", "prototype", "object" );
+PROPERTY[p++] = new Property( "Object", "toString", "function" );
+PROPERTY[p++] = new Property( "Object", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Object", "constructor", "function" );
- PROPERTY[p++] = new Property( "Object", "prototype", "object" );
- PROPERTY[p++] = new Property( "Object", "toString", "function" );
- PROPERTY[p++] = new Property( "Object", "valueOf", "function" );
- PROPERTY[p++] = new Property( "Object", "constructor", "function" );
+// properties of the Function object
- // properties of the Function object
+PROPERTY[p++] = new Property( "Function", "prototype", "function" );
+PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Function.prototype", "length", "number" );
+PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" );
- PROPERTY[p++] = new Property( "Function", "prototype", "function" );
- PROPERTY[p++] = new Property( "Function.prototype", "toString", "function" );
- PROPERTY[p++] = new Property( "Function.prototype", "length", "number" );
- PROPERTY[p++] = new Property( "Function.prototype", "valueOf", "function" );
+Function.prototype.myProperty = "hi";
- Function.prototype.myProperty = "hi";
+PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" );
- PROPERTY[p++] = new Property( "Function.prototype", "myProperty", "string" );
+// properties of the Array object
+PROPERTY[p++] = new Property( "Array", "prototype", "object" );
+PROPERTY[p++] = new Property( "Array", "length", "number" );
+PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "join", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" );
+PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" );
- // properties of the Array object
- PROPERTY[p++] = new Property( "Array", "prototype", "object" );
- PROPERTY[p++] = new Property( "Array", "length", "number" );
- PROPERTY[p++] = new Property( "Array.prototype", "constructor", "function" );
- PROPERTY[p++] = new Property( "Array.prototype", "toString", "function" );
- PROPERTY[p++] = new Property( "Array.prototype", "join", "function" );
- PROPERTY[p++] = new Property( "Array.prototype", "reverse", "function" );
- PROPERTY[p++] = new Property( "Array.prototype", "sort", "function" );
+// properties of the String object
+PROPERTY[p++] = new Property( "String", "prototype", "object" );
+PROPERTY[p++] = new Property( "String", "fromCharCode", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "split", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "substring", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" );
+PROPERTY[p++] = new Property( "String.prototype", "length", "number" );
- // properties of the String object
- PROPERTY[p++] = new Property( "String", "prototype", "object" );
- PROPERTY[p++] = new Property( "String", "fromCharCode", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "toString", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "constructor", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "valueOf", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "charAt", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "charCodeAt", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "indexOf", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "lastIndexOf", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "split", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "substring", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "toLowerCase", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "toUpperCase", "function" );
- PROPERTY[p++] = new Property( "String.prototype", "length", "number" );
+// properties of the Boolean object
+PROPERTY[p++] = new Property( "Boolean", "prototype", "object" );
+PROPERTY[p++] = new Property( "Boolean", "constructor", "function" );
+PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" );
- // properties of the Boolean object
- PROPERTY[p++] = new Property( "Boolean", "prototype", "object" );
- PROPERTY[p++] = new Property( "Boolean", "constructor", "function" );
- PROPERTY[p++] = new Property( "Boolean.prototype", "valueOf", "function" );
- PROPERTY[p++] = new Property( "Boolean.prototype", "toString", "function" );
+// properties of the Number object
- // properties of the Number object
+PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" );
+PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" );
+PROPERTY[p++] = new Property( "Number", "NaN", "number" );
+PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" );
+PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" );
+PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" );
- PROPERTY[p++] = new Property( "Number", "MAX_VALUE", "number" );
- PROPERTY[p++] = new Property( "Number", "MIN_VALUE", "number" );
- PROPERTY[p++] = new Property( "Number", "NaN", "number" );
- PROPERTY[p++] = new Property( "Number", "NEGATIVE_INFINITY", "number" );
- PROPERTY[p++] = new Property( "Number", "POSITIVE_INFINITY", "number" );
- PROPERTY[p++] = new Property( "Number.prototype", "toString", "function" );
- PROPERTY[p++] = new Property( "Number.prototype", "constructor", "function" );
- PROPERTY[p++] = new Property( "Number.prototype", "valueOf", "function" );
+// properties of the Math Object.
+PROPERTY[p++] = new Property( "Math", "E", "number" );
+PROPERTY[p++] = new Property( "Math", "LN10", "number" );
+PROPERTY[p++] = new Property( "Math", "LN2", "number" );
+PROPERTY[p++] = new Property( "Math", "LOG2E", "number" );
+PROPERTY[p++] = new Property( "Math", "LOG10E", "number" );
+PROPERTY[p++] = new Property( "Math", "PI", "number" );
+PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" );
+PROPERTY[p++] = new Property( "Math", "SQRT2", "number" );
+PROPERTY[p++] = new Property( "Math", "abs", "function" );
+PROPERTY[p++] = new Property( "Math", "acos", "function" );
+PROPERTY[p++] = new Property( "Math", "asin", "function" );
+PROPERTY[p++] = new Property( "Math", "atan", "function" );
+PROPERTY[p++] = new Property( "Math", "atan2", "function" );
+PROPERTY[p++] = new Property( "Math", "ceil", "function" );
+PROPERTY[p++] = new Property( "Math", "cos", "function" );
+PROPERTY[p++] = new Property( "Math", "exp", "function" );
+PROPERTY[p++] = new Property( "Math", "floor", "function" );
+PROPERTY[p++] = new Property( "Math", "log", "function" );
+PROPERTY[p++] = new Property( "Math", "max", "function" );
+PROPERTY[p++] = new Property( "Math", "min", "function" );
+PROPERTY[p++] = new Property( "Math", "pow", "function" );
+PROPERTY[p++] = new Property( "Math", "random", "function" );
+PROPERTY[p++] = new Property( "Math", "round", "function" );
+PROPERTY[p++] = new Property( "Math", "sin", "function" );
+PROPERTY[p++] = new Property( "Math", "sqrt", "function" );
+PROPERTY[p++] = new Property( "Math", "tan", "function" );
- // properties of the Math Object.
- PROPERTY[p++] = new Property( "Math", "E", "number" );
- PROPERTY[p++] = new Property( "Math", "LN10", "number" );
- PROPERTY[p++] = new Property( "Math", "LN2", "number" );
- PROPERTY[p++] = new Property( "Math", "LOG2E", "number" );
- PROPERTY[p++] = new Property( "Math", "LOG10E", "number" );
- PROPERTY[p++] = new Property( "Math", "PI", "number" );
- PROPERTY[p++] = new Property( "Math", "SQRT1_2", "number" );
- PROPERTY[p++] = new Property( "Math", "SQRT2", "number" );
- PROPERTY[p++] = new Property( "Math", "abs", "function" );
- PROPERTY[p++] = new Property( "Math", "acos", "function" );
- PROPERTY[p++] = new Property( "Math", "asin", "function" );
- PROPERTY[p++] = new Property( "Math", "atan", "function" );
- PROPERTY[p++] = new Property( "Math", "atan2", "function" );
- PROPERTY[p++] = new Property( "Math", "ceil", "function" );
- PROPERTY[p++] = new Property( "Math", "cos", "function" );
- PROPERTY[p++] = new Property( "Math", "exp", "function" );
- PROPERTY[p++] = new Property( "Math", "floor", "function" );
- PROPERTY[p++] = new Property( "Math", "log", "function" );
- PROPERTY[p++] = new Property( "Math", "max", "function" );
- PROPERTY[p++] = new Property( "Math", "min", "function" );
- PROPERTY[p++] = new Property( "Math", "pow", "function" );
- PROPERTY[p++] = new Property( "Math", "random", "function" );
- PROPERTY[p++] = new Property( "Math", "round", "function" );
- PROPERTY[p++] = new Property( "Math", "sin", "function" );
- PROPERTY[p++] = new Property( "Math", "sqrt", "function" );
- PROPERTY[p++] = new Property( "Math", "tan", "function" );
+// properties of the Date object
+PROPERTY[p++] = new Property( "Date", "parse", "function" );
+PROPERTY[p++] = new Property( "Date", "prototype", "object" );
+PROPERTY[p++] = new Property( "Date", "UTC", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" );
+PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" );
+PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" );
- // properties of the Date object
- PROPERTY[p++] = new Property( "Date", "parse", "function" );
- PROPERTY[p++] = new Property( "Date", "prototype", "object" );
- PROPERTY[p++] = new Property( "Date", "UTC", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "constructor", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "toString", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "valueOf", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getTime", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getFullYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCFullYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getMonth", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCMonth", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getDate", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCDate", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getDay", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCDay", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getHours", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCHours", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getMinutes", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCMinutes", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getSeconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCSeconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getMilliseconds","function" );
- PROPERTY[p++] = new Property( "Date.prototype", "getUTCMilliseconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setTime", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setMilliseconds","function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCMilliseconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setSeconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCSeconds", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setMinutes", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCMinutes", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setHours", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCHours", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setDate", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCDate", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setMonth", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCMonth", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setFullYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setUTCFullYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "setYear", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "toLocaleString", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "toUTCString", "function" );
- PROPERTY[p++] = new Property( "Date.prototype", "toGMTString", "function" );
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );
- for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- RESULT = eval("typeof " + PROPERTY[i].object + "." + PROPERTY[i].name );
+ new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,
+ PROPERTY[i].type,
+ RESULT );
- testcases[tc++] = new TestCase( SECTION,
- "typeof " + PROPERTY[i].object + "." + PROPERTY[i].name,
- PROPERTY[i].type,
- RESULT );
+ RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");
- RESULT = eval("typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']");
-
- testcases[tc++] = new TestCase( SECTION,
- "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",
- PROPERTY[i].type,
- RESULT );
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ "typeof " + PROPERTY[i].object + "['" + PROPERTY[i].name +"']",
+ PROPERTY[i].type,
+ RESULT );
}
+
+test();
+
function MyObject( arg0, arg1, arg2, arg3, arg4 ) {
- this.name = arg0;
+ this.name = arg0;
}
function Property( object, name, type ) {
- this.object = object;
- this.name = name;
- this.type = type;
+ this.object = object;
+ this.name = name;
+ this.type = type;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.1-2.js b/mozilla/js/tests/ecma/Expressions/11.2.1-2.js
index 95bb2e5c7b9..009a6acc1af 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.1-2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,92 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.1-2.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Properties are accessed by name, using either the dot notation:
- MemberExpression . Identifier
- CallExpression . Identifier
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
- or the bracket notation: MemberExpression [ Expression ]
- CallExpression [ Expression ]
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
- The dot notation is explained by the following syntactic conversion:
- MemberExpression . Identifier
- is identical in its behavior to
- MemberExpression [ ]
- and similarly
- CallExpression . Identifier
- is identical in its behavior to
- CallExpression [ ]
- where is a string literal containing the same sequence
- of characters as the Identifier.
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ ]
+ where is a string literal containing the same sequence
+ of characters as the Identifier.
- The production MemberExpression : MemberExpression [ Expression ] is
- evaluated as follows:
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate Expression.
- 4. Call GetValue(Result(3)).
- 5. Call ToObject(Result(2)).
- 6. Call ToString(Result(4)).
- 7. Return a value of type Reference whose base object is Result(5) and
- whose property name is Result(6).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
- The production CallExpression : CallExpression [ Expression ] is evaluated
- in exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "11.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// try to access properties of primitive types
- // try to access properties of primitive types
-
- PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN );
- PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN );
+PROPERTY[p++] = new Property( "\"hi\"", "hi", "hi", NaN );
+PROPERTY[p++] = new Property( NaN, NaN, "NaN", NaN );
// PROPERTY[p++] = new Property( 3, 3, "3", 3 );
- PROPERTY[p++] = new Property( true, true, "true", 1 );
- PROPERTY[p++] = new Property( false, false, "false", 0 );
+PROPERTY[p++] = new Property( true, true, "true", 1 );
+PROPERTY[p++] = new Property( false, false, "false", 0 );
- for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".valueOf()",
- PROPERTY[i].value,
- eval( PROPERTY[i].object+ ".valueOf()" ) );
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".toString()",
- PROPERTY[i].string,
- eval( PROPERTY[i].object+ ".toString()" ) );
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( PROPERTY[i].object+ ".toString()" ) );
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
}
+
+test();
+
function MyObject( value ) {
- this.value = value;
- this.stringValue = value +"";
- this.numberValue = Number(value);
- return this;
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
}
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.value = value;
-}
\ No newline at end of file
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.1-3-n.js b/mozilla/js/tests/ecma/Expressions/11.2.1-3-n.js
index 6efdfecdaf6..91d44910027 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.1-3-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.1-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,102 +35,92 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.1-2.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: 11.2.1-2.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Properties are accessed by name, using either the dot notation:
- MemberExpression . Identifier
- CallExpression . Identifier
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
- or the bracket notation: MemberExpression [ Expression ]
- CallExpression [ Expression ]
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
- The dot notation is explained by the following syntactic conversion:
- MemberExpression . Identifier
- is identical in its behavior to
- MemberExpression [ ]
- and similarly
- CallExpression . Identifier
- is identical in its behavior to
- CallExpression [ ]
- where is a string literal containing the same sequence
- of characters as the Identifier.
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ ]
+ where is a string literal containing the same sequence
+ of characters as the Identifier.
- The production MemberExpression : MemberExpression [ Expression ] is
- evaluated as follows:
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate Expression.
- 4. Call GetValue(Result(3)).
- 5. Call ToObject(Result(2)).
- 6. Call ToString(Result(4)).
- 7. Return a value of type Reference whose base object is Result(5) and
- whose property name is Result(6).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
- The production CallExpression : CallExpression [ Expression ] is evaluated
- in exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "11.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// try to access properties of primitive types
- // try to access properties of primitive types
+PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN );
- PROPERTY[p++] = new Property( "undefined", void 0, "undefined", NaN );
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".valueOf()",
- PROPERTY[i].value,
- eval( PROPERTY[i].object+ ".valueOf()" ) );
+ DESCRIPTION = PROPERTY[i].object + ".valueOf()";
+ EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".toString()",
- PROPERTY[i].string,
- eval( PROPERTY[i].object+ ".toString()" ) );
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval(PROPERTY[i].object+ ".toString()") );
}
+test();
+
+
function MyObject( value ) {
- this.value = value;
- this.stringValue = value +"";
- this.numberValue = Number(value);
- return this;
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
}
+
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.value = value;
-}
\ No newline at end of file
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.1-4-n.js b/mozilla/js/tests/ecma/Expressions/11.2.1-4-n.js
index dcb16d4a76f..1c70cadcb30 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.1-4-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.1-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,83 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.1-4-n.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Properties are accessed by name, using either the dot notation:
- MemberExpression . Identifier
- CallExpression . Identifier
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
- or the bracket notation: MemberExpression [ Expression ]
- CallExpression [ Expression ]
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
- The dot notation is explained by the following syntactic conversion:
- MemberExpression . Identifier
- is identical in its behavior to
- MemberExpression [ ]
- and similarly
- CallExpression . Identifier
- is identical in its behavior to
- CallExpression [ ]
- where is a string literal containing the same sequence
- of characters as the Identifier.
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ ]
+ where is a string literal containing the same sequence
+ of characters as the Identifier.
- The production MemberExpression : MemberExpression [ Expression ] is
- evaluated as follows:
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate Expression.
- 4. Call GetValue(Result(3)).
- 5. Call ToObject(Result(2)).
- 6. Call ToString(Result(4)).
- 7. Return a value of type Reference whose base object is Result(5) and
- whose property name is Result(6).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
- The production CallExpression : CallExpression [ Expression ] is evaluated
- in exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.1-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "11.2.1-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// try to access properties of primitive types
- // try to access properties of primitive types
+PROPERTY[p++] = new Property( "null", null, "null", 0 );
- PROPERTY[p++] = new Property( "null", null, "null", 0 );
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".valueOf()",
- PROPERTY[i].value,
- eval( PROPERTY[i].object+ ".valueOf()" ) );
+ DESCRIPTION = PROPERTY[i].object + ".valueOf()";
+ EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".toString()",
- PROPERTY[i].string,
- eval( PROPERTY[i].object+ ".toString()" ) );
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( PROPERTY[i].object+ ".valueOf()" ) );
- }
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval(PROPERTY[i].object+ ".toString()") );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
}
+
+test();
+
function MyObject( value ) {
this.value = value;
this.stringValue = value +"";
@@ -132,4 +123,4 @@ function Property( object, value, string, number ) {
this.string = String(value);
this.number = Number(value);
this.value = value;
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.1-5.js b/mozilla/js/tests/ecma/Expressions/11.2.1-5.js
index 1aee7a7844c..88eecf7133a 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.1-5.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.1-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,92 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.1-5.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: 11.2.1-5.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Properties are accessed by name, using either the dot notation:
- MemberExpression . Identifier
- CallExpression . Identifier
+ Properties are accessed by name, using either the dot notation:
+ MemberExpression . Identifier
+ CallExpression . Identifier
- or the bracket notation: MemberExpression [ Expression ]
- CallExpression [ Expression ]
+ or the bracket notation: MemberExpression [ Expression ]
+ CallExpression [ Expression ]
- The dot notation is explained by the following syntactic conversion:
- MemberExpression . Identifier
- is identical in its behavior to
- MemberExpression [ ]
- and similarly
- CallExpression . Identifier
- is identical in its behavior to
- CallExpression [ ]
- where is a string literal containing the same sequence
- of characters as the Identifier.
+ The dot notation is explained by the following syntactic conversion:
+ MemberExpression . Identifier
+ is identical in its behavior to
+ MemberExpression [ ]
+ and similarly
+ CallExpression . Identifier
+ is identical in its behavior to
+ CallExpression [ ]
+ where is a string literal containing the same sequence
+ of characters as the Identifier.
- The production MemberExpression : MemberExpression [ Expression ] is
- evaluated as follows:
+ The production MemberExpression : MemberExpression [ Expression ] is
+ evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate Expression.
- 4. Call GetValue(Result(3)).
- 5. Call ToObject(Result(2)).
- 6. Call ToString(Result(4)).
- 7. Return a value of type Reference whose base object is Result(5) and
- whose property name is Result(6).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate Expression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToObject(Result(2)).
+ 6. Call ToString(Result(4)).
+ 7. Return a value of type Reference whose base object is Result(5) and
+ whose property name is Result(6).
- The production CallExpression : CallExpression [ Expression ] is evaluated
- in exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression [ Expression ] is evaluated
+ in exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.1-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "11.2.1-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// try to access properties of primitive types
- // try to access properties of primitive types
+PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN );
+PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN );
+PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 );
+PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 );
+PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 );
- PROPERTY[p++] = new Property( new String("hi"), "hi", "hi", NaN );
- PROPERTY[p++] = new Property( new Number(NaN), NaN, "NaN", NaN );
- PROPERTY[p++] = new Property( new Number(3), 3, "3", 3 );
- PROPERTY[p++] = new Property( new Boolean(true), true, "true", 1 );
- PROPERTY[p++] = new Property( new Boolean(false), false, "false", 0 );
+for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".valueOf()",
+ PROPERTY[i].value,
+ eval( "PROPERTY[i].object.valueOf()" ) );
- for ( var i = 0, RESULT; i < PROPERTY.length; i++ ) {
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".valueOf()",
- PROPERTY[i].value,
- eval( "PROPERTY[i].object.valueOf()" ) );
+ new TestCase( SECTION,
+ PROPERTY[i].object + ".toString()",
+ PROPERTY[i].string,
+ eval( "PROPERTY[i].object.toString()" ) );
- testcases[tc++] = new TestCase( SECTION,
- PROPERTY[i].object + ".toString()",
- PROPERTY[i].string,
- eval( "PROPERTY[i].object.toString()" ) );
-
- }
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
}
+
+test();
+
function MyObject( value ) {
- this.value = value;
- this.stringValue = value +"";
- this.numberValue = Number(value);
- return this;
+ this.value = value;
+ this.stringValue = value +"";
+ this.numberValue = Number(value);
+ return this;
}
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.value = value;
-}
\ No newline at end of file
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-1-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-1-n.js
index 932d03ef06a..8faa63c9bdd 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-1-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-1.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-1-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-1-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var OBJECT = new Object();
+DESCRIPTION = "OBJECT = new Object; var o = new OBJECT()";
+EXPECTED = "error";
- var OBJECT = new Object();
-
- testcases[tc++] = new TestCase( SECTION,
- "OBJECT = new Object; var o = new OBJECT()",
- "error",
- o = new OBJECT() );
- test();
+new TestCase( SECTION,
+ "OBJECT = new Object; var o = new OBJECT()",
+ "error",
+ eval("o = new OBJECT()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-1.js b/mozilla/js/tests/ecma/Expressions/11.2.2-1.js
index e523c5b4ce1..9901717e359 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-1.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-1.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "(new TestFunction(0,1,2,3,4,5)).length",
+ 6,
+ (new TestFunction(0,1,2,3,4,5)).length );
-
- testcases[tc++] = new TestCase( SECTION,
- "(new TestFunction(0,1,2,3,4,5)).length",
- 6,
- (new TestFunction(0,1,2,3,4,5)).length );
-
-
-
- test();
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-10-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-10-n.js
index 0abb2451365..03fc2c18d2f 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-10-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-10-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,66 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-9-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-9-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+DESCRIPTION = "var m = new Math()";
+EXPECTED = "error";
-
- testcases[tc++] = new TestCase( SECTION,
- "var m = new Math()",
- "error",
- m = new Math() );
- test();
+new TestCase( SECTION,
+ "var m = new Math()",
+ "error",
+ eval("m = new Math()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-11.js b/mozilla/js/tests/ecma/Expressions/11.2.2-11.js
index bb2146dd88c..640d64cdbf0 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-11.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-9-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-9-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var FUNCTION = new Function();
- var FUNCTION = new Function();
+new TestCase( SECTION,
+ "var FUNCTION = new Function(); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") );
- testcases[tc++] = new TestCase( SECTION,
- "var FUNCTION = new Function(); f = new FUNCTION(); typeof f",
- "object",
- eval("var FUNCTION = new Function(); f = new FUNCTION(); typeof f") );
+new TestCase( SECTION,
+ "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f",
+ "object",
+ eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") );
- testcases[tc++] = new TestCase( SECTION,
- "var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f",
- "object",
- eval("var FUNCTION = new Function('return this'); f = new FUNCTION(); typeof f") );
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-2-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-2-n.js
index bc5c7a50c16..904e2d19f3c 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-2-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-2.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-2.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-2-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-2-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var UNDEFINED = void 0;
+DESCRIPTION = "UNDEFINED = void 0; var o = new UNDEFINED()";
+EXPECTED = "error";
- var UNDEFINED = void 0;
-
- testcases[tc++] = new TestCase( SECTION,
- "UNDEFINED = void 0; var o = new UNDEFINED()",
- "error",
- o = new UNDEFINED() );
- test();
+new TestCase( SECTION,
+ "UNDEFINED = void 0; var o = new UNDEFINED()",
+ "error",
+ eval("o = new UNDEFINED()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-3-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-3-n.js
index 9b22a7b0496..583dfc2739d 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-3-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,64 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-3-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-3-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-3-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var DESCRIPTION = "NULL = null; var o = new NULL()";
+var EXPECTED = "error";
+var NULL = null;
+new TestCase( SECTION,
+ "NULL = null; var o = new NULL()",
+ "error",
+ eval("o = new NULL()") );
+test();
- var NULL = null;
-
- testcases[tc++] = new TestCase( SECTION,
- "NULL = null; var o = new NULL()",
- "error",
- o = new NULL() );
- test();
-
-function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-4-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-4-n.js
index 2d71c091d15..4d678d0694d 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-4-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-4-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-4-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-4-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var STRING = "";
+DESCRIPTION = "STRING = '', var s = new STRING()";
+EXPECTED = "error";
- var STRING = "";
-
- testcases[tc++] = new TestCase( SECTION,
- "STRING = '', var s = new STRING()",
- "error",
- s = new STRING() );
- test();
+new TestCase( SECTION,
+ "STRING = '', var s = new STRING()",
+ "error",
+ eval("s = new STRING()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-5-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-5-n.js
index 20dd1539223..e347aaca7e0 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-5-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-5-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-5-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-5-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var NUMBER = 0;
+DESCRIPTION = "NUMBER=0, var n = new NUMBER()";
+EXPECTED = "error";
- var NUMBER = 0;
-
- testcases[tc++] = new TestCase( SECTION,
- "NUMBER=0, var n = new NUMBER()",
- "error",
- n = new NUMBER() );
- test();
+new TestCase( SECTION,
+ "NUMBER=0, var n = new NUMBER()",
+ "error",
+ eval("n = new NUMBER()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-6-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-6-n.js
index 2b5fea2648e..eafb728709f 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-6-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-6-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,67 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-6-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-6-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-6-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var BOOLEAN = true;
+var BOOLEAN = true;
+DESCRIPTION = "BOOLEAN = true; var b = new BOOLEAN()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION,
- "BOOLEAN = true; var b = new BOOLEAN()",
- "error",
- b = new BOOLEAN() );
- test();
+new TestCase( SECTION,
+ "BOOLEAN = true; var b = new BOOLEAN()",
+ "error",
+ eval("b = new BOOLEAN()") );
+test();
function TestFunction() {
- return arguments;
+ return arguments;
}
+
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-7-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-7-n.js
index 19ba7bdbba6..93708a76ba4 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-7-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-7-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-6-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-6-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-6-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var STRING = new String("hi");
+DESCRIPTION = "var STRING = new String('hi'); var s = new STRING()";
+EXPECTED = "error";
- var STRING = new String("hi");
-
- testcases[tc++] = new TestCase( SECTION,
- "var STRING = new String('hi'); var s = new STRING()",
- "error",
- s = new STRING() );
- test();
+new TestCase( SECTION,
+ "var STRING = new String('hi'); var s = new STRING()",
+ "error",
+ eval("s = new STRING()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-8-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-8-n.js
index 64507e7fb6b..d3d042ba2ff 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-8-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-8-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-8-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-8-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-8-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var NUMBER = new Number(1);
+DESCRIPTION = "var NUMBER = new Number(1); var n = new NUMBER()";
+EXPECTED = "error";
- var NUMBER = new Number(1);
-
- testcases[tc++] = new TestCase( SECTION,
- "var NUMBER = new Number(1); var n = new NUMBER()",
- "error",
- n = new NUMBER() );
- test();
+new TestCase( SECTION,
+ "var NUMBER = new Number(1); var n = new NUMBER()",
+ "error",
+ eval("n = new NUMBER()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.2-9-n.js b/mozilla/js/tests/ecma/Expressions/11.2.2-9-n.js
index d2370873035..ce8fc31e4f3 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.2-9-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.2-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,68 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.2-9-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: 11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- MemberExpression:
- PrimaryExpression
- MemberExpression[Expression]
- MemberExpression.Identifier
- new MemberExpression Arguments
+ MemberExpression:
+ PrimaryExpression
+ MemberExpression[Expression]
+ MemberExpression.Identifier
+ new MemberExpression Arguments
- new NewExpression
+ new NewExpression
- The production NewExpression : new NewExpression is evaluated as follows:
+ The production NewExpression : new NewExpression is evaluated as follows:
1. Evaluate NewExpression.
2. Call GetValue(Result(1)).
3. If Type(Result(2)) is not Object, generate a runtime error.
4. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
5. Call the [[Construct]] method on Result(2), providing no arguments
- (that is, an empty list of arguments).
+ (that is, an empty list of arguments).
6. If Type(Result(5)) is not Object, generate a runtime error.
7. Return Result(5).
- The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
+ The production MemberExpression : new MemberExpression Arguments is evaluated as follows:
1. Evaluate MemberExpression.
2. Call GetValue(Result(1)).
3. Evaluate Arguments, producing an internal list of argument values
- (section 0).
+ (section 0).
4. If Type(Result(2)) is not Object, generate a runtime error.
5. If Result(2) does not implement the internal [[Construct]] method,
- generate a runtime error.
+ generate a runtime error.
6. Call the [[Construct]] method on Result(2), providing the list
- Result(3) as the argument values.
+ Result(3) as the argument values.
7. If Type(Result(6)) is not Object, generate a runtime error.
8 .Return Result(6).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.2-9-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The new operator";
+var SECTION = "11.2.2-9-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The new operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var BOOLEAN = new Boolean();
+DESCRIPTION = "var BOOLEAN = new Boolean(); var b = new BOOLEAN()";
+EXPECTED = "error";
- var BOOLEAN = new Boolean();
-
- testcases[tc++] = new TestCase( SECTION,
- "var BOOLEAN = new Boolean(); var b = new BOOLEAN()",
- "error",
- b = new BOOLEAN() );
- test();
+new TestCase( SECTION,
+ "var BOOLEAN = new Boolean(); var b = new BOOLEAN()",
+ "error",
+ eval("b = new BOOLEAN()") );
+test();
function TestFunction() {
- return arguments;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ return arguments;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.3-1.js b/mozilla/js/tests/ecma/Expressions/11.2.3-1.js
index 371f3db0745..c13e87e2e93 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.3-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,103 +35,89 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.3-1.js
- ECMA Section: 11.2.3. Function Calls
- Description:
+ File Name: 11.2.3-1.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
- The production CallExpression : MemberExpression Arguments is evaluated as
- follows:
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
- 1.Evaluate MemberExpression.
- 2.Evaluate Arguments, producing an internal list of argument values
- (section 0).
- 3.Call GetValue(Result(1)).
- 4.If Type(Result(3)) is not Object, generate a runtime error.
- 5.If Result(3) does not implement the internal [[Call]] method, generate a
- runtime error.
- 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
- Result(6) is null.
- 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
- the same as Result(6).
- 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
- and providing the list Result(2) as the argument values.
- 9.Return Result(8).
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
- The production CallExpression : CallExpression Arguments is evaluated in
- exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Note: Result(8) will never be of type Reference if Result(3) is a native
- ECMAScript object. Whether calling a host object can return a value of
- type Reference is implementation-dependent.
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function Calls";
+var SECTION = "11.2.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = new Array();
+writeHeaderToLog( SECTION + " "+ TITLE);
/* this.eval() is no longer legal syntax.
- // MemberExpression : this
+// MemberExpression : this
- testcases[tc++] = new TestCase( SECTION,
- "this.eval()",
- void 0,
- this.eval() );
+new TestCase( SECTION,
+"this.eval()",
+void 0,
+this.eval() );
- testcases[tc++] = new TestCase( SECTION,
- "this.eval('NaN')",
- NaN,
- this.eval("NaN") );
+new TestCase( SECTION,
+"this.eval('NaN')",
+NaN,
+this.eval("NaN") );
*/
- // MemberExpression: Identifier
+// MemberExpression: Identifier
- var OBJECT = true;
+var OBJECT = true;
- testcases[tc++] = new TestCase( SECTION,
- "OBJECT.toString()",
- "true",
- OBJECT.toString() );
+new TestCase( SECTION,
+ "OBJECT.toString()",
+ "true",
+ OBJECT.toString() );
- // MemberExpression[ Expression]
+// MemberExpression[ Expression]
- testcases[tc++] = new TestCase( SECTION,
- "(new Array())['length'].valueOf()",
- 0,
- (new Array())["length"].valueOf() );
+new TestCase( SECTION,
+ "(new Array())['length'].valueOf()",
+ 0,
+ (new Array())["length"].valueOf() );
- // MemberExpression . Identifier
- testcases[tc++] = new TestCase( SECTION,
- "(new Array()).length.valueOf()",
- 0,
- (new Array()).length.valueOf() );
- // new MemberExpression Arguments
+// MemberExpression . Identifier
+new TestCase( SECTION,
+ "(new Array()).length.valueOf()",
+ 0,
+ (new Array()).length.valueOf() );
+// new MemberExpression Arguments
- testcases[tc++] = new TestCase( SECTION,
- "(new Array(20))['length'].valueOf()",
- 20,
- (new Array(20))["length"].valueOf() );
+new TestCase( SECTION,
+ "(new Array(20))['length'].valueOf()",
+ 20,
+ (new Array(20))["length"].valueOf() );
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.3-2-n.js b/mozilla/js/tests/ecma/Expressions/11.2.3-2-n.js
index 208a9ae92e3..0b0e54d55e1 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.3-2-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.3-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,58 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.3-2-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
+ File Name: 11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
- The production CallExpression : MemberExpression Arguments is evaluated as
- follows:
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
- 1.Evaluate MemberExpression.
- 2.Evaluate Arguments, producing an internal list of argument values
- (section 0).
- 3.Call GetValue(Result(1)).
- 4.If Type(Result(3)) is not Object, generate a runtime error.
- 5.If Result(3) does not implement the internal [[Call]] method, generate a
- runtime error.
- 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
- Result(6) is null.
- 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
- the same as Result(6).
- 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
- and providing the list Result(2) as the argument values.
- 9.Return Result(8).
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
- The production CallExpression : CallExpression Arguments is evaluated in
- exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Note: Result(8) will never be of type Reference if Result(3) is a native
- ECMAScript object. Whether calling a host object can return a value of
- type Reference is implementation-dependent.
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.3-2-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function Calls";
+var SECTION = "11.2.3-2-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "3.valueOf()",
+ 3,
+ eval("3.valueOf()") );
- testcases[tc++] = new TestCase( SECTION,
- "3.valueOf()",
- 3,
- 3.valueOf() );
+new TestCase( SECTION,
+ "(3).valueOf()",
+ 3,
+ eval("(3).valueOf()") );
- testcases[tc++] = new TestCase( SECTION,
- "(3).valueOf()",
- 3,
- (3).valueOf() );
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.3-3-n.js b/mozilla/js/tests/ecma/Expressions/11.2.3-3-n.js
index 81d39477125..4fbc52684d1 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.3-3-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.3-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,55 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.3-3-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
+ File Name: 11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
- The production CallExpression : MemberExpression Arguments is evaluated as
- follows:
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
- 1.Evaluate MemberExpression.
- 2.Evaluate Arguments, producing an internal list of argument values
- (section 0).
- 3.Call GetValue(Result(1)).
- 4.If Type(Result(3)) is not Object, generate a runtime error.
- 5.If Result(3) does not implement the internal [[Call]] method, generate a
- runtime error.
- 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
- Result(6) is null.
- 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
- the same as Result(6).
- 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
- and providing the list Result(2) as the argument values.
- 9.Return Result(8).
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
- The production CallExpression : CallExpression Arguments is evaluated in
- exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Note: Result(8) will never be of type Reference if Result(3) is a native
- ECMAScript object. Whether calling a host object can return a value of
- type Reference is implementation-dependent.
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.3-3-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function Calls";
+var SECTION = "11.2.3-3-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+DESCRIPTION = "(void 0).valueOf()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION, "(void 0).valueOf()", "error", (void 0).valueOf() );
- test();
+new TestCase( SECTION,
+ "(void 0).valueOf()",
+ "error",
+ eval("(void 0).valueOf()") );
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.3-4-n.js b/mozilla/js/tests/ecma/Expressions/11.2.3-4-n.js
index 3fef8194440..63517bbbf82 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.3-4-n.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.3-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,55 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.3-4-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
+ File Name: 11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
- The production CallExpression : MemberExpression Arguments is evaluated as
- follows:
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
- 1.Evaluate MemberExpression.
- 2.Evaluate Arguments, producing an internal list of argument values
- (section 0).
- 3.Call GetValue(Result(1)).
- 4.If Type(Result(3)) is not Object, generate a runtime error.
- 5.If Result(3) does not implement the internal [[Call]] method, generate a
- runtime error.
- 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
- Result(6) is null.
- 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
- the same as Result(6).
- 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
- and providing the list Result(2) as the argument values.
- 9.Return Result(8).
+ 1.Evaluate MemberExpression.
+ 2.Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3.Call GetValue(Result(1)).
+ 4.If Type(Result(3)) is not Object, generate a runtime error.
+ 5.If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6.If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7.If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8.Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9.Return Result(8).
- The production CallExpression : CallExpression Arguments is evaluated in
- exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Note: Result(8) will never be of type Reference if Result(3) is a native
- ECMAScript object. Whether calling a host object can return a value of
- type Reference is implementation-dependent.
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.3-4-n.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function Calls";
+var SECTION = "11.2.3-4-n.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+DESCRIPTION = "null.valueOf()";
+EXPECTED = "error";
- testcases[tc++] = new TestCase( SECTION, "null.valueOf()", "error", null.valueOf() );
- test();
+new TestCase( SECTION,
+ "null.valueOf()",
+ "error",
+ eval("null.valueOf()") );
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.2.3-5.js b/mozilla/js/tests/ecma/Expressions/11.2.3-5.js
index 8f28d4d262b..37cd797d1ab 100644
--- a/mozilla/js/tests/ecma/Expressions/11.2.3-5.js
+++ b/mozilla/js/tests/ecma/Expressions/11.2.3-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,49 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.2.3-5-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
+ File Name: 11.2.3-5-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
- The production CallExpression : MemberExpression Arguments is evaluated as
- follows:
+ The production CallExpression : MemberExpression Arguments is evaluated as
+ follows:
- 1. Evaluate MemberExpression.
- 2. Evaluate Arguments, producing an internal list of argument values
- (section 0).
- 3. Call GetValue(Result(1)).
- 4. If Type(Result(3)) is not Object, generate a runtime error.
- 5. If Result(3) does not implement the internal [[Call]] method, generate a
- runtime error.
- 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
- Result(6) is null.
- 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
- the same as Result(6).
- 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value
- and providing the list Result(2) as the argument values.
- 9. Return Result(8).
+ 1. Evaluate MemberExpression.
+ 2. Evaluate Arguments, producing an internal list of argument values
+ (section 0).
+ 3. Call GetValue(Result(1)).
+ 4. If Type(Result(3)) is not Object, generate a runtime error.
+ 5. If Result(3) does not implement the internal [[Call]] method, generate a
+ runtime error.
+ 6. If Type(Result(1)) is Reference, Result(6) is GetBase(Result(1)). Otherwise,
+ Result(6) is null.
+ 7. If Result(6) is an activation object, Result(7) is null. Otherwise, Result(7) is
+ the same as Result(6).
+ 8. Call the [[Call]] method on Result(3), providing Result(7) as the this value
+ and providing the list Result(2) as the argument values.
+ 9. Return Result(8).
- The production CallExpression : CallExpression Arguments is evaluated in
- exactly the same manner, except that the contained CallExpression is
- evaluated in step 1.
+ The production CallExpression : CallExpression Arguments is evaluated in
+ exactly the same manner, except that the contained CallExpression is
+ evaluated in step 1.
- Note: Result(8) will never be of type Reference if Result(3) is a native
- ECMAScript object. Whether calling a host object can return a value of
- type Reference is implementation-dependent.
+ Note: Result(8) will never be of type Reference if Result(3) is a native
+ ECMAScript object. Whether calling a host object can return a value of
+ type Reference is implementation-dependent.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.2.3-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function Calls";
+var SECTION = "11.2.3-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function Calls";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION, "true.valueOf()", true, true.valueOf() );
+test();
- testcases[tc++] = new TestCase( SECTION, "true.valueOf()", true, true.valueOf() );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.3.1.js b/mozilla/js/tests/ecma/Expressions/11.3.1.js
index 4d1c125e42f..a191b59ccd8 100644
--- a/mozilla/js/tests/ecma/Expressions/11.3.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.3.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,136 +35,117 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.3.1.js
- ECMA Section: 11.3.1 Postfix increment operator
- Description:
- The production MemberExpression : MemberExpression ++ is evaluated as
- follows:
+ File Name: 11.3.1.js
+ ECMA Section: 11.3.1 Postfix increment operator
+ Description:
+ The production MemberExpression : MemberExpression ++ is evaluated as
+ follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Call ToNumber(Result(2)).
- 4. Add the value 1 to Result(3), using the same rules as for the +
- operator (section 0).
- 5. Call PutValue(Result(1), Result(4)).
- 6. Return Result(3).
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.3.1";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.3.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Postfix increment operator");
+writeHeaderToLog( SECTION + " Postfix increment operator");
- testcases = getTestCases();
- test();
+// special numbers
+new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") );
+new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") );
+new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// verify return value
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") );
- // special numbers
- array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR++", NaN, eval("var MYVAR; MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR++", NaN, eval("var MYVAR=void 0; MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR++", 0, eval("var MYVAR=null; MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR++", 1, eval("var MYVAR=true; MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR++", 0, eval("var MYVAR=false; MYVAR++") );
+// verify value of variable
- // verify return value
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++") );
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
- // number primitives
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++", 0, eval("var MYVAR=0;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++", 0.2345, eval("var MYVAR=0.2345;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++", -0.2345, eval("var MYVAR=-0.2345;MYVAR++") );
+// boolean values
+// verify return value
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR++;MYVAR", 1.2345, eval("var MYVAR=0.2345;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR++;MYVAR", 0.7655, eval("var MYVAR=-0.2345;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR++;MYVAR", 1, eval("var MYVAR=0;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") );
- // boolean values
- // verify return value
+// boolean objects
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR++;MYVAR", 2, eval("var MYVAR=true;MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR++;MYVAR", 1, eval("var MYVAR=false;MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") );
- // boolean objects
- // verify return value
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") );
+new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++", 1, eval("var MYVAR=true;MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++", 0, eval("var MYVAR=false;MYVAR++") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR++;MYVAR", 2, eval("var MYVAR=new Boolean(true);MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR++;MYVAR", 1, eval("var MYVAR=new Boolean(false);MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") );
- // string primitives
- array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++", Number.NaN, eval("var MYVAR='string';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++", 12345, eval("var MYVAR='12345';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++", -12345, eval("var MYVAR='-12345';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR++", 15, eval("var MYVAR='0Xf';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++", 77, eval("var MYVAR='077';MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR++", 0, eval("var MYVAR='';MYVAR++") );
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") );
+new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR++;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR++;MYVAR", 12346, eval("var MYVAR='12345';MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR++;MYVAR", -12344, eval("var MYVAR='-12345';MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR++;MYVAR", 16, eval("var MYVAR='0xf';MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR++;MYVAR", 78, eval("var MYVAR='077';MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR++;MYVAR", 1, eval("var MYVAR='';MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") );
- // string objects
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++", Number.NaN, eval("var MYVAR=new String('string');MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++", 12345, eval("var MYVAR=new String('12345');MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++", -12345, eval("var MYVAR=new String('-12345');MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR++", 15, eval("var MYVAR=new String('0Xf');MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++", 77, eval("var MYVAR=new String('077');MYVAR++") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR++", 0, eval("var MYVAR=new String('');MYVAR++") );
+test();
- // verify value of variable
-
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR++;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR++;MYVAR", 12346, eval("var MYVAR=new String('12345');MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR++;MYVAR", -12344, eval("var MYVAR=new String('-12345');MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR++;MYVAR", 16, eval("var MYVAR=new String('0xf');MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR++;MYVAR", 78, eval("var MYVAR=new String('077');MYVAR++;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR++;MYVAR", 1, eval("var MYVAR=new String('');MYVAR++;MYVAR") );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.3.2.js b/mozilla/js/tests/ecma/Expressions/11.3.2.js
index 955a1cd0170..afc0c8b8491 100644
--- a/mozilla/js/tests/ecma/Expressions/11.3.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.3.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,136 +35,117 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.3.2.js
- ECMA Section: 11.3.2 Postfix decrement operator
- Description:
+ File Name: 11.3.2.js
+ ECMA Section: 11.3.2 Postfix decrement operator
+ Description:
- 11.3.2 Postfix decrement operator
+ 11.3.2 Postfix decrement operator
- The production MemberExpression : MemberExpression -- is evaluated as follows:
- 1. Evaluate MemberExpression.
- 2. Call GetValue(Result(1)).
- 3. Call ToNumber(Result(2)).
- 4. Subtract the value 1 from Result(3), using the same rules as for the -
- operator (section 0).
- 5. Call PutValue(Result(1), Result(4)).
- 6. Return Result(3).
+ The production MemberExpression : MemberExpression -- is evaluated as follows:
+ 1. Evaluate MemberExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Subtract the value 1 from Result(3), using the same rules as for the -
+ operator (section 0).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(3).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.3.2";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.3.2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Postfix decrement operator");
- test();
+writeHeaderToLog( SECTION + " Postfix decrement operator");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// special numbers
+new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") );
+new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// verify return value
- // special numbers
- array[item++] = new TestCase( SECTION, "var MYVAR; MYVAR--", NaN, eval("var MYVAR; MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR= void 0; MYVAR--", NaN, eval("var MYVAR=void 0; MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=null; MYVAR--", 0, eval("var MYVAR=null; MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=true; MYVAR--", 1, eval("var MYVAR=true; MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false; MYVAR--", 0, eval("var MYVAR=false; MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") );
- // verify return value
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") );
- // verify value of variable
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;MYVAR--;MYVAR") );
+// verify value of variable
- // number primitives
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--", 0, eval("var MYVAR=0;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--", 0.2345, eval("var MYVAR=0.2345;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--", -0.2345, eval("var MYVAR=-0.2345;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
- // verify value of variable
+// boolean values
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;MYVAR--;MYVAR", -0.7655, eval("var MYVAR=0.2345;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;MYVAR--;MYVAR", -1.2345, eval("var MYVAR=-0.2345;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;MYVAR--;MYVAR", -1, eval("var MYVAR=0;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+// verify value of variable
- // boolean values
- // verify return value
+new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
- // verify value of variable
+// boolean objects
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=true;MYVAR--;MYVAR", 0, eval("var MYVAR=true;MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;MYVAR--;MYVAR", -1, eval("var MYVAR=false;MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
+// verify value of variable
- // boolean objects
- // verify return value
+new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--", 1, eval("var MYVAR=true;MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--", 0, eval("var MYVAR=false;MYVAR--") );
- // verify value of variable
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") );
+new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);MYVAR--;MYVAR", 0, eval("var MYVAR=new Boolean(true);MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);MYVAR--;MYVAR", -1, eval("var MYVAR=new Boolean(false);MYVAR--;MYVAR") );
+// verify value of variable
- // string primitives
- array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--", Number.NaN, eval("var MYVAR='string';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--", 12345, eval("var MYVAR='12345';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--", -12345, eval("var MYVAR='-12345';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';MYVAR--", 15, eval("var MYVAR='0Xf';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--", 77, eval("var MYVAR='077';MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=''; MYVAR--", 0, eval("var MYVAR='';MYVAR--") );
+new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") );
- // verify value of variable
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR='string';MYVAR--;MYVAR", Number.NaN, eval("var MYVAR='string';MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';MYVAR--;MYVAR", 12344, eval("var MYVAR='12345';MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';MYVAR--;MYVAR", -12346, eval("var MYVAR='-12345';MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0xf';MYVAR--;MYVAR", 14, eval("var MYVAR='0xf';MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';MYVAR--;MYVAR", 76, eval("var MYVAR='077';MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='';MYVAR--;MYVAR", -1, eval("var MYVAR='';MYVAR--;MYVAR") );
+// verify value of variable
- // string objects
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--", Number.NaN, eval("var MYVAR=new String('string');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--", 12345, eval("var MYVAR=new String('12345');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--", -12345, eval("var MYVAR=new String('-12345');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');MYVAR--", 15, eval("var MYVAR=new String('0Xf');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--", 77, eval("var MYVAR=new String('077');MYVAR--") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); MYVAR--", 0, eval("var MYVAR=new String('');MYVAR--") );
+new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") );
- // verify value of variable
-
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');MYVAR--;MYVAR", Number.NaN, eval("var MYVAR=new String('string');MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');MYVAR--;MYVAR", 12344, eval("var MYVAR=new String('12345');MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');MYVAR--;MYVAR", -12346, eval("var MYVAR=new String('-12345');MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');MYVAR--;MYVAR", 14, eval("var MYVAR=new String('0xf');MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');MYVAR--;MYVAR", 76, eval("var MYVAR=new String('077');MYVAR--;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('');MYVAR--;MYVAR", -1, eval("var MYVAR=new String('');MYVAR--;MYVAR") );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.1.js b/mozilla/js/tests/ecma/Expressions/11.4.1.js
index e0b9440672c..c5cbfe469f2 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,77 +35,56 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.4.1.js
- ECMA Section: 11.4.1 the Delete Operator
- Description: returns true if the property could be deleted
- returns false if it could not be deleted
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 11.4.1.js
+ ECMA Section: 11.4.1 the Delete Operator
+ Description: returns true if the property could be deleted
+ returns false if it could not be deleted
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "11.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The delete operator";
+var SECTION = "11.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The delete operator";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
-
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
-// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") );
-// array[item++] = new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") );
- array[item++] = new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") );
+// new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.length", 2, eval("x=[9,8,7];delete(x[2]);x.length") );
+// new TestCase( SECTION, "x=[9,8,7];delete(x[2]);x.toString()", "9,8", eval("x=[9,8,7];delete(x[2]);x.toString()") );
+new TestCase( SECTION, "x=new Date();delete x;typeof(x)", "undefined", eval("x=new Date();delete x;typeof(x)") );
// array[item++] = new TestCase( SECTION, "delete(x=new Date())", true, delete(x=new Date()) );
// array[item++] = new TestCase( SECTION, "delete('string primitive')", true, delete("string primitive") );
// array[item++] = new TestCase( SECTION, "delete(new String( 'string object' ) )", true, delete(new String("string object")) );
// array[item++] = new TestCase( SECTION, "delete(new Number(12345) )", true, delete(new Number(12345)) );
- array[item++] = new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) );
+new TestCase( SECTION, "delete(Math.PI)", false, delete(Math.PI) );
// array[item++] = new TestCase( SECTION, "delete(null)", true, delete(null) );
// array[item++] = new TestCase( SECTION, "delete(void(0))", true, delete(void(0)) );
- // variables declared with the var statement are not deletable.
+// variables declared with the var statement are not deletable.
- var abc;
- array[item++] = new TestCase( SECTION, "var abc; delete(abc)", false, delete abc );
+var abc;
+new TestCase( SECTION, "var abc; delete(abc)", false, delete abc );
- array[item++] = new TestCase( SECTION,
- "var OB = new MyObject(); for ( p in OB ) { delete p }",
- true,
- eval("var OB = new MyObject(); for ( p in OB ) { delete p }") );
- return ( array );
-}
+new TestCase( SECTION,
+ "var OB = new MyObject(); for ( p in OB ) { delete p }",
+ true,
+ eval("var OB = new MyObject(); for ( p in OB ) { delete p }") );
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
-
- }
- stopTest();
- return ( testcases );
-}
+test();
function MyObject() {
- this.prop1 = true;
- this.prop2 = false;
- this.prop3 = null
- this.prop4 = void 0;
- this.prop5 = "hi";
- this.prop6 = 42;
- this.prop7 = new Date();
- this.prop8 = Math.PI;
-}
\ No newline at end of file
+ this.prop1 = true;
+ this.prop2 = false;
+ this.prop3 = null;
+ this.prop4 = void 0;
+ this.prop5 = "hi";
+ this.prop6 = 42;
+ this.prop7 = new Date();
+ this.prop8 = Math.PI;
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.2.js b/mozilla/js/tests/ecma/Expressions/11.4.2.js
index 9ed2d480e0e..872c482af81 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.4.2.js
ECMA Section: 11.4.2 the Void Operator
@@ -49,52 +51,31 @@
writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
-
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) );
- array[item++] = new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") );
- array[item++] = new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) );
- array[item++] = new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "void(1)", void 0, void(1) );
- array[item++] = new TestCase( SECTION, "void(0)", void 0, void(0) );
- array[item++] = new TestCase( SECTION, "void(-1)", void 0, void(-1) );
- array[item++] = new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) );
- array[item++] = new TestCase( SECTION, "void(true)", void 0, void(true) );
- array[item++] = new TestCase( SECTION, "void(false)", void 0, void(false) );
- array[item++] = new TestCase( SECTION, "void(null)", void 0, void(null) );
- array[item++] = new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) );
- array[item++] = new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" );
- array[item++] = new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN );
- array[item++] = new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "void 1", void 0, void 1 );
- array[item++] = new TestCase( SECTION, "void 0", void 0, void 0 );
- array[item++] = new TestCase( SECTION, "void -1", void 0, void -1 );
- array[item++] = new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "void Math.PI", void 0, void Math.PI );
- array[item++] = new TestCase( SECTION, "void true", void 0, void true );
- array[item++] = new TestCase( SECTION, "void false", void 0, void false );
- array[item++] = new TestCase( SECTION, "void null", void 0, void null );
+new TestCase( SECTION, "void(new String('string object'))", void 0, void(new String( 'string object' )) );
+new TestCase( SECTION, "void('string primitive')", void 0, void("string primitive") );
+new TestCase( SECTION, "void(Number.NaN)", void 0, void(Number.NaN) );
+new TestCase( SECTION, "void(Number.POSITIVE_INFINITY)", void 0, void(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "void(1)", void 0, void(1) );
+new TestCase( SECTION, "void(0)", void 0, void(0) );
+new TestCase( SECTION, "void(-1)", void 0, void(-1) );
+new TestCase( SECTION, "void(Number.NEGATIVE_INFINITY)", void 0, void(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "void(Math.PI)", void 0, void(Math.PI) );
+new TestCase( SECTION, "void(true)", void 0, void(true) );
+new TestCase( SECTION, "void(false)", void 0, void(false) );
+new TestCase( SECTION, "void(null)", void 0, void(null) );
+new TestCase( SECTION, "void new String('string object')", void 0, void new String( 'string object' ) );
+new TestCase( SECTION, "void 'string primitive'", void 0, void "string primitive" );
+new TestCase( SECTION, "void Number.NaN", void 0, void Number.NaN );
+new TestCase( SECTION, "void Number.POSITIVE_INFINITY", void 0, void Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "void 1", void 0, void 1 );
+new TestCase( SECTION, "void 0", void 0, void 0 );
+new TestCase( SECTION, "void -1", void 0, void -1 );
+new TestCase( SECTION, "void Number.NEGATIVE_INFINITY", void 0, void Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "void Math.PI", void 0, void Math.PI );
+new TestCase( SECTION, "void true", void 0, void true );
+new TestCase( SECTION, "void false", void 0, void false );
+new TestCase( SECTION, "void null", void 0, void null );
// array[item++] = new TestCase( SECTION, "void()", void 0, void() );
- return ( array );
-}
-
-function test() {
- for ( i = 0; i < testcases.length; i++ ) {
- testcases[i].passed = writeTestCaseResult(
- testcases[i].expect,
- testcases[i].actual,
- testcases[i].description +" = "+ testcases[i].actual );
- testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.3.js b/mozilla/js/tests/ecma/Expressions/11.4.3.js
index c84f9d86449..0d5bbb161f2 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,91 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: typeof_1.js
- ECMA Section: 11.4.3 typeof operator
- Description: typeof evaluates unary expressions:
- undefined "undefined"
- null "object"
- Boolean "boolean"
- Number "number"
- String "string"
- Object "object" [native, doesn't implement Call]
- Object "function" [native, implements [Call]]
- Object implementation dependent
- [not sure how to test this]
- Author: christine@netscape.com
- Date: june 30, 1997
+ File Name: typeof_1.js
+ ECMA Section: 11.4.3 typeof operator
+ Description: typeof evaluates unary expressions:
+ undefined "undefined"
+ null "object"
+ Boolean "boolean"
+ Number "number"
+ String "string"
+ Object "object" [native, doesn't implement Call]
+ Object "function" [native, implements [Call]]
+ Object implementation dependent
+ [not sure how to test this]
+ Author: christine@netscape.com
+ Date: june 30, 1997
*/
- var SECTION = "11.4.3";
+var SECTION = "11.4.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = " The typeof operator";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = " The typeof operator";
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) );
+new TestCase( SECTION, "typeof(null)", "object", typeof(null) );
+new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) );
+new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) );
+new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) );
+new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) );
+new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) );
+new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) );
+new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) );
+new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) );
+new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) );
+new TestCase( SECTION, "typeof(0)", "number", typeof(0) );
+new TestCase( SECTION, "typeof(1)", "number", typeof(1) );
+new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) );
+new TestCase( SECTION, "typeof('0')", "string", typeof("0") );
+new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) );
+new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) );
+new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) );
+new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) );
+new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) );
+new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) );
+new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) );
+
+// Math does not implement [[Construct]] or [[Call]] so its type is object.
+
+new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) );
+
+new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) );
+
+new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") );
+new TestCase( SECTION, "typeof('')", "string", typeof("") );
+new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) );
+new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) );
+new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) );
+new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) );
+new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) );
+new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) );
+new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) );
+new TestCase( SECTION, "typeof(test)", "function", typeof( test ) );
+new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(void(0))", "undefined", typeof(void(0)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(null)", "object", typeof(null) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(true)", "boolean", typeof(true) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(false)", "boolean", typeof(false) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean())", "object", typeof(new Boolean()) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Boolean(true))", "object", typeof(new Boolean(true)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean())", "boolean", typeof(Boolean()) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(false))", "boolean", typeof(Boolean(false)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Boolean(true))", "boolean", typeof(Boolean(true)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(NaN)", "number", typeof(Number.NaN) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Infinity)", "number", typeof(Number.POSITIVE_INFINITY) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(-Infinity)", "number", typeof(Number.NEGATIVE_INFINITY) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Math.PI)", "number", typeof(Math.PI) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(0)", "number", typeof(0) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(1)", "number", typeof(1) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(-1)", "number", typeof(-1) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof('0')", "string", typeof("0") );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Number())", "number", typeof(Number()) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(0))", "number", typeof(Number(0)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Number(1))", "number", typeof(Number(1)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Nubmer(-1))", "number", typeof(Number(-1)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number())", "object", typeof(new Number()) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(0))", "object", typeof(new Number(0)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Number(1))", "object", typeof(new Number(1)) );
+test();
- // Math does not implement [[Construct]] or [[Call]] so its type is object.
-
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Math)", "object", typeof(Math) );
-
- testcases[testcases.length] = new TestCase( SECTION, "typeof(Number.prototype.toString)", "function", typeof(Number.prototype.toString) );
-
- testcases[testcases.length] = new TestCase( SECTION, "typeof('a string')", "string", typeof("a string") );
- testcases[testcases.length] = new TestCase( SECTION, "typeof('')", "string", typeof("") );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Date())", "object", typeof(new Date()) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Array(1,2,3))", "object", typeof(new Array(1,2,3)) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new String('string object'))", "object", typeof(new String("string object")) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(String('string primitive'))", "string", typeof(String("string primitive")) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(['array', 'of', 'strings'])", "object", typeof(["array", "of", "strings"]) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(new Function())", "function", typeof( new Function() ) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(parseInt)", "function", typeof( parseInt ) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(test)", "function", typeof( test ) );
- testcases[testcases.length] = new TestCase( SECTION, "typeof(String.fromCharCode)", "function", typeof( String.fromCharCode ) );
-
-
- writeHeaderToLog( SECTION + " "+ TITLE);
- test();
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.4.js b/mozilla/js/tests/ecma/Expressions/11.4.4.js
index a0d727a31a9..a6d27343a42 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.4.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,138 +35,120 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.4.4.js
- ECMA Section: 11.4.4 Prefix increment operator
- Description:
- The production UnaryExpression : ++ UnaryExpression is evaluated as
- follows:
+ File Name: 11.4.4.js
+ ECMA Section: 11.4.4 Prefix increment operator
+ Description:
+ The production UnaryExpression : ++ UnaryExpression is evaluated as
+ follows:
- 1. Evaluate UnaryExpression.
- 2. Call GetValue(Result(1)).
- 3. Call ToNumber(Result(2)).
- 4. Add the value 1 to Result(3), using the same rules as for the +
- operator (section 11.6.3).
- 5. Call PutValue(Result(1), Result(4)).
- 6. Return Result(4).
+ 1. Evaluate UnaryExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToNumber(Result(2)).
+ 4. Add the value 1 to Result(3), using the same rules as for the +
+ operator (section 11.6.3).
+ 5. Call PutValue(Result(1), Result(4)).
+ 6. Return Result(4).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.4.4";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.4.4";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Prefix increment operator");
- test();
+writeHeaderToLog( SECTION + " Prefix increment operator");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// special case: var is not defined
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") );
- // special case: var is not defined
+// special numbers
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR; ++MYVAR", NaN, eval("var MYVAR; ++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR= void 0; ++MYVAR", NaN, eval("var MYVAR=void 0; ++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=null; ++MYVAR", 1, eval("var MYVAR=null; ++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=true; ++MYVAR", 2, eval("var MYVAR=true; ++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false; ++MYVAR", 1, eval("var MYVAR=false; ++MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") );
- // special numbers
- // verify return value
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR") );
-
- // verify value of variable
-
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;++MYVAR;MYVAR") );
- // number primitives
- array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") );
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;++MYVAR", 1, eval("var MYVAR=0;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;++MYVAR;MYVAR", 1.2345, eval("var MYVAR=0.2345;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;++MYVAR;MYVAR", 0.7655, eval("var MYVAR=-0.2345;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;++MYVAR;MYVAR", 1, eval("var MYVAR=0;++MYVAR;MYVAR") );
- // boolean values
- // verify return value
+// boolean values
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=true;++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=true;++MYVAR;MYVAR", 2, eval("var MYVAR=true;++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;++MYVAR;MYVAR", 1, eval("var MYVAR=false;++MYVAR;MYVAR") );
- // boolean objects
- // verify return value
+// boolean objects
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR", 2, eval("var MYVAR=true;++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR", 1, eval("var MYVAR=false;++MYVAR") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(true);++MYVAR;MYVAR", 2, eval("var MYVAR=new Boolean(true);++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);++MYVAR;MYVAR", 1, eval("var MYVAR=new Boolean(false);++MYVAR;MYVAR") );
- // string primitives
- array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") );
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';++MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';++MYVAR", 12346, eval("var MYVAR='12345';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';++MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='0Xf';++MYVAR", 16, eval("var MYVAR='0Xf';++MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';++MYVAR", 78, eval("var MYVAR='077';++MYVAR") );
+new TestCase( SECTION, "var MYVAR=''; ++MYVAR", 1, eval("var MYVAR='';++MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='string';++MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';++MYVAR;MYVAR", 12346, eval("var MYVAR='12345';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';++MYVAR;MYVAR", -12344, eval("var MYVAR='-12345';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';++MYVAR;MYVAR", 16, eval("var MYVAR='0xf';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';++MYVAR;MYVAR", 78, eval("var MYVAR='077';++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';++MYVAR;MYVAR", 1, eval("var MYVAR='';++MYVAR;MYVAR") );
- // string objects
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") );
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');++MYVAR", 16, eval("var MYVAR=new String('0Xf');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String(''); ++MYVAR", 1, eval("var MYVAR=new String('');++MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('string');++MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');++MYVAR;MYVAR", 12346, eval("var MYVAR=new String('12345');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');++MYVAR;MYVAR", -12344, eval("var MYVAR=new String('-12345');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');++MYVAR;MYVAR", 16, eval("var MYVAR=new String('0xf');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');++MYVAR;MYVAR", 78, eval("var MYVAR=new String('077');++MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');++MYVAR;MYVAR", 1, eval("var MYVAR=new String('');++MYVAR;MYVAR") );
+
+test();
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.5.js b/mozilla/js/tests/ecma/Expressions/11.4.5.js
index c7ca3e20e37..415fb3e3390 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.5.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,136 +35,118 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.4.5.js
- ECMA Section: 11.4.5 Prefix decrement operator
- Description:
+ File Name: 11.4.5.js
+ ECMA Section: 11.4.5 Prefix decrement operator
+ Description:
- The production UnaryExpression : -- UnaryExpression is evaluated as follows:
+ The production UnaryExpression : -- UnaryExpression is evaluated as follows:
- 1.Evaluate UnaryExpression.
- 2.Call GetValue(Result(1)).
- 3.Call ToNumber(Result(2)).
- 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3).
- 5.Call PutValue(Result(1), Result(4)).
+ 1.Evaluate UnaryExpression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToNumber(Result(2)).
+ 4.Subtract the value 1 from Result(3), using the same rules as for the - operator (section 11.6.3).
+ 5.Call PutValue(Result(1), Result(4)).
- 1.Return Result(4).
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1.Return Result(4).
+ Author: christine@netscape.com
+ Date: \ 12 november 1997
*/
- var SECTION = "11.4.5";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.4.5";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Prefix decrement operator");
- test();
+writeHeaderToLog( SECTION + " Prefix decrement operator");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+//
+new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") );
+new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// special numbers
+// verify return value
- //
- array[item++] = new TestCase( SECTION, "var MYVAR; --MYVAR", NaN, eval("var MYVAR; --MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR= void 0; --MYVAR", NaN, eval("var MYVAR=void 0; --MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=null; --MYVAR", -1, eval("var MYVAR=null; --MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=true; --MYVAR", 0, eval("var MYVAR=true; --MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false; --MYVAR", -1, eval("var MYVAR=false; --MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") );
- // special numbers
- // verify return value
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR") );
-
- // verify value of variable
-
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR", Number.POSITIVE_INFINITY, eval("var MYVAR=Number.POSITIVE_INFINITY;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR", Number.NEGATIVE_INFINITY, eval("var MYVAR=Number.NEGATIVE_INFINITY;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=Number.NaN;--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=Number.NaN;--MYVAR;MYVAR") );
- // number primitives
- array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") );
+// number primitives
+new TestCase( SECTION, "var MYVAR=0;--MYVAR", -1, eval("var MYVAR=0;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0.2345;--MYVAR;MYVAR", -0.7655, eval("var MYVAR=0.2345;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=-0.2345;--MYVAR;MYVAR", -1.2345, eval("var MYVAR=-0.2345;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=0;--MYVAR;MYVAR", -1, eval("var MYVAR=0;--MYVAR;MYVAR") );
- // boolean values
- // verify return value
+// boolean values
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=true;--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=true;--MYVAR;MYVAR", 0, eval("var MYVAR=true;--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=false;--MYVAR;MYVAR", -1, eval("var MYVAR=false;--MYVAR;MYVAR") );
- // boolean objects
- // verify return value
+// boolean objects
+// verify return value
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
- // verify value of variable
+new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR", 0, eval("var MYVAR=true;--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR", -1, eval("var MYVAR=false;--MYVAR") );
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(true);--MYVAR;MYVAR", 0, eval("var MYVAR=new Boolean(true);--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new Boolean(false);--MYVAR;MYVAR", -1, eval("var MYVAR=new Boolean(false);--MYVAR;MYVAR") );
- // string primitives
- array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") );
+// string primitives
+new TestCase( SECTION, "var MYVAR='string';--MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';--MYVAR", 12344, eval("var MYVAR='12345';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';--MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='0Xf';--MYVAR", 14, eval("var MYVAR='0Xf';--MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';--MYVAR", 76, eval("var MYVAR='077';--MYVAR") );
+new TestCase( SECTION, "var MYVAR=''; --MYVAR", -1, eval("var MYVAR='';--MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='string';--MYVAR;MYVAR", Number.NaN, eval("var MYVAR='string';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='12345';--MYVAR;MYVAR", 12344, eval("var MYVAR='12345';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='-12345';--MYVAR;MYVAR", -12346, eval("var MYVAR='-12345';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='0xf';--MYVAR;MYVAR", 14, eval("var MYVAR='0xf';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='077';--MYVAR;MYVAR", 76, eval("var MYVAR='077';--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR='';--MYVAR;MYVAR", -1, eval("var MYVAR='';--MYVAR;MYVAR") );
- // string objects
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") );
+// string objects
+new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0Xf');--MYVAR", 14, eval("var MYVAR=new String('0Xf');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String(''); --MYVAR", -1, eval("var MYVAR=new String('');--MYVAR") );
- // verify value of variable
+// verify value of variable
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") );
- array[item++] = new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('string');--MYVAR;MYVAR", Number.NaN, eval("var MYVAR=new String('string');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('12345');--MYVAR;MYVAR", 12344, eval("var MYVAR=new String('12345');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('-12345');--MYVAR;MYVAR", -12346, eval("var MYVAR=new String('-12345');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('0xf');--MYVAR;MYVAR", 14, eval("var MYVAR=new String('0xf');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('077');--MYVAR;MYVAR", 76, eval("var MYVAR=new String('077');--MYVAR;MYVAR") );
+new TestCase( SECTION, "var MYVAR=new String('');--MYVAR;MYVAR", -1, eval("var MYVAR=new String('');--MYVAR;MYVAR") );
+
+test();
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.6.js b/mozilla/js/tests/ecma/Expressions/11.4.6.js
index 366c699f31b..9db559a51cb 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.6.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,280 +36,261 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 11.4.6.js
- ECMA Section: 11.4.6 Unary + Operator
- Description: convert operand to Number type
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 11.4.6.js
+ ECMA Section: 11.4.6 Unary + Operator
+ Description: convert operand to Number type
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "11.4.6";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
- var BUGNUMBER="77391";
+var SECTION = "11.4.6";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Unary + operator");
- test();
+var BUGNUMBER="77391";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+writeHeaderToLog( SECTION + " Unary + operator");
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "+('')", 0, +("") );
- array[item++] = new TestCase( SECTION, "+(' ')", 0, +(" ") );
- array[item++] = new TestCase( SECTION, "+(\\t)", 0, +("\t") );
- array[item++] = new TestCase( SECTION, "+(\\n)", 0, +("\n") );
- array[item++] = new TestCase( SECTION, "+(\\r)", 0, +("\r") );
- array[item++] = new TestCase( SECTION, "+(\\f)", 0, +("\f") );
+new TestCase( SECTION, "+('')", 0, +("") );
+new TestCase( SECTION, "+(' ')", 0, +(" ") );
+new TestCase( SECTION, "+(\\t)", 0, +("\t") );
+new TestCase( SECTION, "+(\\n)", 0, +("\n") );
+new TestCase( SECTION, "+(\\r)", 0, +("\r") );
+new TestCase( SECTION, "+(\\f)", 0, +("\f") );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x0009)", 0, +(String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x0020)", 0, +(String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000C)", 0, +(String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000B)", 0, +(String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000D)", 0, +(String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+(String.fromCharCode(0x000A)", 0, +(String.fromCharCode(0x000A)) );
- // a StringNumericLiteral may be preceeded or followed by whitespace and/or
- // line terminators
+// a StringNumericLiteral may be preceeded or followed by whitespace and/or
+// line terminators
- array[item++] = new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) );
- array[item++] = new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) );
- array[item++] = new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) );
- array[item++] = new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) );
- array[item++] = new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) );
+new TestCase( SECTION, "+( ' ' + 999 )", 999, +( ' '+999) );
+new TestCase( SECTION, "+( '\\n' + 999 )", 999, +( '\n' +999) );
+new TestCase( SECTION, "+( '\\r' + 999 )", 999, +( '\r' +999) );
+new TestCase( SECTION, "+( '\\t' + 999 )", 999, +( '\t' +999) );
+new TestCase( SECTION, "+( '\\f' + 999 )", 999, +( '\f' +999) );
- array[item++] = new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') );
- array[item++] = new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) );
- array[item++] = new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) );
- array[item++] = new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) );
- array[item++] = new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) );
+new TestCase( SECTION, "+( 999 + ' ' )", 999, +( 999+' ') );
+new TestCase( SECTION, "+( 999 + '\\n' )", 999, +( 999+'\n' ) );
+new TestCase( SECTION, "+( 999 + '\\r' )", 999, +( 999+'\r' ) );
+new TestCase( SECTION, "+( 999 + '\\t' )", 999, +( 999+'\t' ) );
+new TestCase( SECTION, "+( 999 + '\\f' )", 999, +( 999+'\f' ) );
- array[item++] = new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) );
- array[item++] = new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) );
- array[item++] = new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) );
- array[item++] = new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) );
+new TestCase( SECTION, "+( '\\n' + 999 + '\\n' )", 999, +( '\n' +999+'\n' ) );
+new TestCase( SECTION, "+( '\\r' + 999 + '\\r' )", 999, +( '\r' +999+'\r' ) );
+new TestCase( SECTION, "+( '\\t' + 999 + '\\t' )", 999, +( '\t' +999+'\t' ) );
+new TestCase( SECTION, "+( '\\f' + 999 + '\\f' )", 999, +( '\f' +999+'\f' ) );
- array[item++] = new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') );
- array[item++] = new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') );
- array[item++] = new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') );
- array[item++] = new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') );
- array[item++] = new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') );
+new TestCase( SECTION, "+( ' ' + '999' )", 999, +( ' '+'999') );
+new TestCase( SECTION, "+( '\\n' + '999' )", 999, +( '\n' +'999') );
+new TestCase( SECTION, "+( '\\r' + '999' )", 999, +( '\r' +'999') );
+new TestCase( SECTION, "+( '\\t' + '999' )", 999, +( '\t' +'999') );
+new TestCase( SECTION, "+( '\\f' + '999' )", 999, +( '\f' +'999') );
- array[item++] = new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') );
- array[item++] = new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) );
- array[item++] = new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) );
- array[item++] = new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) );
- array[item++] = new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) );
+new TestCase( SECTION, "+( '999' + ' ' )", 999, +( '999'+' ') );
+new TestCase( SECTION, "+( '999' + '\\n' )", 999, +( '999'+'\n' ) );
+new TestCase( SECTION, "+( '999' + '\\r' )", 999, +( '999'+'\r' ) );
+new TestCase( SECTION, "+( '999' + '\\t' )", 999, +( '999'+'\t' ) );
+new TestCase( SECTION, "+( '999' + '\\f' )", 999, +( '999'+'\f' ) );
- array[item++] = new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) );
- array[item++] = new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) );
- array[item++] = new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) );
- array[item++] = new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) );
+new TestCase( SECTION, "+( '\\n' + '999' + '\\n' )", 999, +( '\n' +'999'+'\n' ) );
+new TestCase( SECTION, "+( '\\r' + '999' + '\\r' )", 999, +( '\r' +'999'+'\r' ) );
+new TestCase( SECTION, "+( '\\t' + '999' + '\\t' )", 999, +( '\t' +'999'+'\t' ) );
+new TestCase( SECTION, "+( '\\f' + '999' + '\\f' )", 999, +( '\f' +'999'+'\f' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' )", 99, +( String.fromCharCode(0x0009) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' )", 99, +( String.fromCharCode(0x0020) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' )", 99, +( String.fromCharCode(0x000C) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' )", 99, +( String.fromCharCode(0x000B) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' )", 99, +( String.fromCharCode(0x000D) + '99' ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' )", 99, +( String.fromCharCode(0x000A) + '99' ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0009)", 99, +( '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x0020)", 99, +( '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000C)", 99, +( '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000D)", 99, +( '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000B)", 99, +( '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( '99' + String.fromCharCode(0x000A)", 99, +( '99' + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 )", 99, +( String.fromCharCode(0x0009) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 )", 99, +( String.fromCharCode(0x0020) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 )", 99, +( String.fromCharCode(0x000C) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 )", 99, +( String.fromCharCode(0x000B) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 )", 99, +( String.fromCharCode(0x000D) + 99 ) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 )", 99, +( String.fromCharCode(0x000A) + 99 ) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, +( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0009)", 99, +( 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x0020)", 99, +( 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000C)", 99, +( 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000D)", 99, +( 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000B)", 99, +( 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "+( 99 + String.fromCharCode(0x000A)", 99, +( 99 + String.fromCharCode(0x000A)) );
- // StrNumericLiteral:::StrDecimalLiteral:::Infinity
+// StrNumericLiteral:::StrDecimalLiteral:::Infinity
- array[item++] = new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") );
- array[item++] = new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") );
- array[item++] = new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") );
+new TestCase( SECTION, "+('Infinity')", Math.pow(10,10000), +("Infinity") );
+new TestCase( SECTION, "+('-Infinity')", -Math.pow(10,10000), +("-Infinity") );
+new TestCase( SECTION, "+('+Infinity')", Math.pow(10,10000), +("+Infinity") );
- // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+// StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
- array[item++] = new TestCase( SECTION, "+('0')", 0, +("0") );
- array[item++] = new TestCase( SECTION, "+('-0')", -0, +("-0") );
- array[item++] = new TestCase( SECTION, "+('+0')", 0, +("+0") );
+new TestCase( SECTION, "+('0')", 0, +("0") );
+new TestCase( SECTION, "+('-0')", -0, +("-0") );
+new TestCase( SECTION, "+('+0')", 0, +("+0") );
- array[item++] = new TestCase( SECTION, "+('1')", 1, +("1") );
- array[item++] = new TestCase( SECTION, "+('-1')", -1, +("-1") );
- array[item++] = new TestCase( SECTION, "+('+1')", 1, +("+1") );
+new TestCase( SECTION, "+('1')", 1, +("1") );
+new TestCase( SECTION, "+('-1')", -1, +("-1") );
+new TestCase( SECTION, "+('+1')", 1, +("+1") );
- array[item++] = new TestCase( SECTION, "+('2')", 2, +("2") );
- array[item++] = new TestCase( SECTION, "+('-2')", -2, +("-2") );
- array[item++] = new TestCase( SECTION, "+('+2')", 2, +("+2") );
+new TestCase( SECTION, "+('2')", 2, +("2") );
+new TestCase( SECTION, "+('-2')", -2, +("-2") );
+new TestCase( SECTION, "+('+2')", 2, +("+2") );
- array[item++] = new TestCase( SECTION, "+('3')", 3, +("3") );
- array[item++] = new TestCase( SECTION, "+('-3')", -3, +("-3") );
- array[item++] = new TestCase( SECTION, "+('+3')", 3, +("+3") );
+new TestCase( SECTION, "+('3')", 3, +("3") );
+new TestCase( SECTION, "+('-3')", -3, +("-3") );
+new TestCase( SECTION, "+('+3')", 3, +("+3") );
- array[item++] = new TestCase( SECTION, "+('4')", 4, +("4") );
- array[item++] = new TestCase( SECTION, "+('-4')", -4, +("-4") );
- array[item++] = new TestCase( SECTION, "+('+4')", 4, +("+4") );
+new TestCase( SECTION, "+('4')", 4, +("4") );
+new TestCase( SECTION, "+('-4')", -4, +("-4") );
+new TestCase( SECTION, "+('+4')", 4, +("+4") );
- array[item++] = new TestCase( SECTION, "+('5')", 5, +("5") );
- array[item++] = new TestCase( SECTION, "+('-5')", -5, +("-5") );
- array[item++] = new TestCase( SECTION, "+('+5')", 5, +("+5") );
+new TestCase( SECTION, "+('5')", 5, +("5") );
+new TestCase( SECTION, "+('-5')", -5, +("-5") );
+new TestCase( SECTION, "+('+5')", 5, +("+5") );
- array[item++] = new TestCase( SECTION, "+('6')", 6, +("6") );
- array[item++] = new TestCase( SECTION, "+('-6')", -6, +("-6") );
- array[item++] = new TestCase( SECTION, "+('+6')", 6, +("+6") );
+new TestCase( SECTION, "+('6')", 6, +("6") );
+new TestCase( SECTION, "+('-6')", -6, +("-6") );
+new TestCase( SECTION, "+('+6')", 6, +("+6") );
- array[item++] = new TestCase( SECTION, "+('7')", 7, +("7") );
- array[item++] = new TestCase( SECTION, "+('-7')", -7, +("-7") );
- array[item++] = new TestCase( SECTION, "+('+7')", 7, +("+7") );
+new TestCase( SECTION, "+('7')", 7, +("7") );
+new TestCase( SECTION, "+('-7')", -7, +("-7") );
+new TestCase( SECTION, "+('+7')", 7, +("+7") );
- array[item++] = new TestCase( SECTION, "+('8')", 8, +("8") );
- array[item++] = new TestCase( SECTION, "+('-8')", -8, +("-8") );
- array[item++] = new TestCase( SECTION, "+('+8')", 8, +("+8") );
+new TestCase( SECTION, "+('8')", 8, +("8") );
+new TestCase( SECTION, "+('-8')", -8, +("-8") );
+new TestCase( SECTION, "+('+8')", 8, +("+8") );
- array[item++] = new TestCase( SECTION, "+('9')", 9, +("9") );
- array[item++] = new TestCase( SECTION, "+('-9')", -9, +("-9") );
- array[item++] = new TestCase( SECTION, "+('+9')", 9, +("+9") );
+new TestCase( SECTION, "+('9')", 9, +("9") );
+new TestCase( SECTION, "+('-9')", -9, +("-9") );
+new TestCase( SECTION, "+('+9')", 9, +("+9") );
- array[item++] = new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") );
- array[item++] = new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") );
- array[item++] = new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") );
+new TestCase( SECTION, "+('3.14159')", 3.14159, +("3.14159") );
+new TestCase( SECTION, "+('-3.14159')", -3.14159, +("-3.14159") );
+new TestCase( SECTION, "+('+3.14159')", 3.14159, +("+3.14159") );
- array[item++] = new TestCase( SECTION, "+('3.')", 3, +("3.") );
- array[item++] = new TestCase( SECTION, "+('-3.')", -3, +("-3.") );
- array[item++] = new TestCase( SECTION, "+('+3.')", 3, +("+3.") );
+new TestCase( SECTION, "+('3.')", 3, +("3.") );
+new TestCase( SECTION, "+('-3.')", -3, +("-3.") );
+new TestCase( SECTION, "+('+3.')", 3, +("+3.") );
- array[item++] = new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") );
- array[item++] = new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") );
- array[item++] = new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") );
+new TestCase( SECTION, "+('3.e1')", 30, +("3.e1") );
+new TestCase( SECTION, "+('-3.e1')", -30, +("-3.e1") );
+new TestCase( SECTION, "+('+3.e1')", 30, +("+3.e1") );
- array[item++] = new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") );
- array[item++] = new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") );
- array[item++] = new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") );
+new TestCase( SECTION, "+('3.e+1')", 30, +("3.e+1") );
+new TestCase( SECTION, "+('-3.e+1')", -30, +("-3.e+1") );
+new TestCase( SECTION, "+('+3.e+1')", 30, +("+3.e+1") );
- array[item++] = new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") );
- array[item++] = new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") );
- array[item++] = new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") );
+new TestCase( SECTION, "+('3.e-1')", .30, +("3.e-1") );
+new TestCase( SECTION, "+('-3.e-1')", -.30, +("-3.e-1") );
+new TestCase( SECTION, "+('+3.e-1')", .30, +("+3.e-1") );
- // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") );
- array[item++] = new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") );
- array[item++] = new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") );
+new TestCase( SECTION, "+('.00001')", 0.00001, +(".00001") );
+new TestCase( SECTION, "+('+.00001')", 0.00001, +("+.00001") );
+new TestCase( SECTION, "+('-0.0001')", -0.00001, +("-.00001") );
- array[item++] = new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") );
- array[item++] = new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") );
- array[item++] = new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") );
+new TestCase( SECTION, "+('.01e2')", 1, +(".01e2") );
+new TestCase( SECTION, "+('+.01e2')", 1, +("+.01e2") );
+new TestCase( SECTION, "+('-.01e2')", -1, +("-.01e2") );
- array[item++] = new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") );
- array[item++] = new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") );
- array[item++] = new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") );
+new TestCase( SECTION, "+('.01e+2')", 1, +(".01e+2") );
+new TestCase( SECTION, "+('+.01e+2')", 1, +("+.01e+2") );
+new TestCase( SECTION, "+('-.01e+2')", -1, +("-.01e+2") );
- array[item++] = new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") );
- array[item++] = new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") );
- array[item++] = new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") );
+new TestCase( SECTION, "+('.01e-2')", 0.0001, +(".01e-2") );
+new TestCase( SECTION, "+('+.01e-2')", 0.0001, +("+.01e-2") );
+new TestCase( SECTION, "+('-.01e-2')", -0.0001, +("-.01e-2") );
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") );
- array[item++] = new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") );
- array[item++] = new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") );
+new TestCase( SECTION, "+('1234e5')", 123400000, +("1234e5") );
+new TestCase( SECTION, "+('+1234e5')", 123400000, +("+1234e5") );
+new TestCase( SECTION, "+('-1234e5')", -123400000, +("-1234e5") );
- array[item++] = new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") );
- array[item++] = new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") );
- array[item++] = new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") );
+new TestCase( SECTION, "+('1234e+5')", 123400000, +("1234e+5") );
+new TestCase( SECTION, "+('+1234e+5')", 123400000, +("+1234e+5") );
+new TestCase( SECTION, "+('-1234e+5')", -123400000, +("-1234e+5") );
- array[item++] = new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") );
- array[item++] = new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") );
- array[item++] = new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") );
+new TestCase( SECTION, "+('1234e-5')", 0.01234, +("1234e-5") );
+new TestCase( SECTION, "+('+1234e-5')", 0.01234, +("+1234e-5") );
+new TestCase( SECTION, "+('-1234e-5')", -0.01234, +("-1234e-5") );
- // StrNumericLiteral::: HexIntegerLiteral
+// StrNumericLiteral::: HexIntegerLiteral
- array[item++] = new TestCase( SECTION, "+('0x0')", 0, +("0x0"));
- array[item++] = new TestCase( SECTION, "+('0x1')", 1, +("0x1"));
- array[item++] = new TestCase( SECTION, "+('0x2')", 2, +("0x2"));
- array[item++] = new TestCase( SECTION, "+('0x3')", 3, +("0x3"));
- array[item++] = new TestCase( SECTION, "+('0x4')", 4, +("0x4"));
- array[item++] = new TestCase( SECTION, "+('0x5')", 5, +("0x5"));
- array[item++] = new TestCase( SECTION, "+('0x6')", 6, +("0x6"));
- array[item++] = new TestCase( SECTION, "+('0x7')", 7, +("0x7"));
- array[item++] = new TestCase( SECTION, "+('0x8')", 8, +("0x8"));
- array[item++] = new TestCase( SECTION, "+('0x9')", 9, +("0x9"));
- array[item++] = new TestCase( SECTION, "+('0xa')", 10, +("0xa"));
- array[item++] = new TestCase( SECTION, "+('0xb')", 11, +("0xb"));
- array[item++] = new TestCase( SECTION, "+('0xc')", 12, +("0xc"));
- array[item++] = new TestCase( SECTION, "+('0xd')", 13, +("0xd"));
- array[item++] = new TestCase( SECTION, "+('0xe')", 14, +("0xe"));
- array[item++] = new TestCase( SECTION, "+('0xf')", 15, +("0xf"));
- array[item++] = new TestCase( SECTION, "+('0xA')", 10, +("0xA"));
- array[item++] = new TestCase( SECTION, "+('0xB')", 11, +("0xB"));
- array[item++] = new TestCase( SECTION, "+('0xC')", 12, +("0xC"));
- array[item++] = new TestCase( SECTION, "+('0xD')", 13, +("0xD"));
- array[item++] = new TestCase( SECTION, "+('0xE')", 14, +("0xE"));
- array[item++] = new TestCase( SECTION, "+('0xF')", 15, +("0xF"));
+new TestCase( SECTION, "+('0x0')", 0, +("0x0"));
+new TestCase( SECTION, "+('0x1')", 1, +("0x1"));
+new TestCase( SECTION, "+('0x2')", 2, +("0x2"));
+new TestCase( SECTION, "+('0x3')", 3, +("0x3"));
+new TestCase( SECTION, "+('0x4')", 4, +("0x4"));
+new TestCase( SECTION, "+('0x5')", 5, +("0x5"));
+new TestCase( SECTION, "+('0x6')", 6, +("0x6"));
+new TestCase( SECTION, "+('0x7')", 7, +("0x7"));
+new TestCase( SECTION, "+('0x8')", 8, +("0x8"));
+new TestCase( SECTION, "+('0x9')", 9, +("0x9"));
+new TestCase( SECTION, "+('0xa')", 10, +("0xa"));
+new TestCase( SECTION, "+('0xb')", 11, +("0xb"));
+new TestCase( SECTION, "+('0xc')", 12, +("0xc"));
+new TestCase( SECTION, "+('0xd')", 13, +("0xd"));
+new TestCase( SECTION, "+('0xe')", 14, +("0xe"));
+new TestCase( SECTION, "+('0xf')", 15, +("0xf"));
+new TestCase( SECTION, "+('0xA')", 10, +("0xA"));
+new TestCase( SECTION, "+('0xB')", 11, +("0xB"));
+new TestCase( SECTION, "+('0xC')", 12, +("0xC"));
+new TestCase( SECTION, "+('0xD')", 13, +("0xD"));
+new TestCase( SECTION, "+('0xE')", 14, +("0xE"));
+new TestCase( SECTION, "+('0xF')", 15, +("0xF"));
- array[item++] = new TestCase( SECTION, "+('0X0')", 0, +("0X0"));
- array[item++] = new TestCase( SECTION, "+('0X1')", 1, +("0X1"));
- array[item++] = new TestCase( SECTION, "+('0X2')", 2, +("0X2"));
- array[item++] = new TestCase( SECTION, "+('0X3')", 3, +("0X3"));
- array[item++] = new TestCase( SECTION, "+('0X4')", 4, +("0X4"));
- array[item++] = new TestCase( SECTION, "+('0X5')", 5, +("0X5"));
- array[item++] = new TestCase( SECTION, "+('0X6')", 6, +("0X6"));
- array[item++] = new TestCase( SECTION, "+('0X7')", 7, +("0X7"));
- array[item++] = new TestCase( SECTION, "+('0X8')", 8, +("0X8"));
- array[item++] = new TestCase( SECTION, "+('0X9')", 9, +("0X9"));
- array[item++] = new TestCase( SECTION, "+('0Xa')", 10, +("0Xa"));
- array[item++] = new TestCase( SECTION, "+('0Xb')", 11, +("0Xb"));
- array[item++] = new TestCase( SECTION, "+('0Xc')", 12, +("0Xc"));
- array[item++] = new TestCase( SECTION, "+('0Xd')", 13, +("0Xd"));
- array[item++] = new TestCase( SECTION, "+('0Xe')", 14, +("0Xe"));
- array[item++] = new TestCase( SECTION, "+('0Xf')", 15, +("0Xf"));
- array[item++] = new TestCase( SECTION, "+('0XA')", 10, +("0XA"));
- array[item++] = new TestCase( SECTION, "+('0XB')", 11, +("0XB"));
- array[item++] = new TestCase( SECTION, "+('0XC')", 12, +("0XC"));
- array[item++] = new TestCase( SECTION, "+('0XD')", 13, +("0XD"));
- array[item++] = new TestCase( SECTION, "+('0XE')", 14, +("0XE"));
- array[item++] = new TestCase( SECTION, "+('0XF')", 15, +("0XF"));
+new TestCase( SECTION, "+('0X0')", 0, +("0X0"));
+new TestCase( SECTION, "+('0X1')", 1, +("0X1"));
+new TestCase( SECTION, "+('0X2')", 2, +("0X2"));
+new TestCase( SECTION, "+('0X3')", 3, +("0X3"));
+new TestCase( SECTION, "+('0X4')", 4, +("0X4"));
+new TestCase( SECTION, "+('0X5')", 5, +("0X5"));
+new TestCase( SECTION, "+('0X6')", 6, +("0X6"));
+new TestCase( SECTION, "+('0X7')", 7, +("0X7"));
+new TestCase( SECTION, "+('0X8')", 8, +("0X8"));
+new TestCase( SECTION, "+('0X9')", 9, +("0X9"));
+new TestCase( SECTION, "+('0Xa')", 10, +("0Xa"));
+new TestCase( SECTION, "+('0Xb')", 11, +("0Xb"));
+new TestCase( SECTION, "+('0Xc')", 12, +("0Xc"));
+new TestCase( SECTION, "+('0Xd')", 13, +("0Xd"));
+new TestCase( SECTION, "+('0Xe')", 14, +("0Xe"));
+new TestCase( SECTION, "+('0Xf')", 15, +("0Xf"));
+new TestCase( SECTION, "+('0XA')", 10, +("0XA"));
+new TestCase( SECTION, "+('0XB')", 11, +("0XB"));
+new TestCase( SECTION, "+('0XC')", 12, +("0XC"));
+new TestCase( SECTION, "+('0XD')", 13, +("0XD"));
+new TestCase( SECTION, "+('0XE')", 14, +("0XE"));
+new TestCase( SECTION, "+('0XF')", 15, +("0XF"));
- return array;
-
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.8.js b/mozilla/js/tests/ecma/Expressions/11.4.8.js
index 75fdcb86439..3aed5d45eb0 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.8.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,197 +35,178 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
- /**
- File Name: 11.4.8.js
- ECMA Section: 11.4.8 Bitwise NOT Operator
- Description: flip bits up to 32 bits
- no special cases
- Author: christine@netscape.com
- Date: 7 july 1997
+/**
+ File Name: 11.4.8.js
+ ECMA Section: 11.4.8 Bitwise NOT Operator
+ Description: flip bits up to 32 bits
+ no special cases
+ Author: christine@netscape.com
+ Date: 7 july 1997
- Data File Fields:
- VALUE value passed as an argument to the ~ operator
- E_RESULT expected return value of ~ VALUE;
+ Data File Fields:
+ VALUE value passed as an argument to the ~ operator
+ E_RESULT expected return value of ~ VALUE;
- Static variables:
- none
+ Static variables:
+ none
*/
- var SECTION = "11.4.8";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.4.8";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Bitwise Not operator");
- test();
+writeHeaderToLog( SECTION + " Bitwise Not operator");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+for ( var i = 0; i < 35; i++ ) {
+ var p = Math.pow(2,i);
+
+ new TestCase( SECTION, "~"+p, Not(p), ~p );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+for ( i = 0; i < 35; i++ ) {
+ var p = -Math.pow(2,i);
- for ( var i = 0; i < 35; i++ ) {
- var p = Math.pow(2,i);
+ new TestCase( SECTION, "~"+p, Not(p), ~p );
- array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p );
-
- }
- for ( i = 0; i < 35; i++ ) {
- var p = -Math.pow(2,i);
-
- array[item++] = new TestCase( SECTION, "~"+p, Not(p), ~p );
-
- }
-
- return ( array );
}
+
+test();
+
function ToInteger( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( n != n ) {
- return 0;
- }
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
- return n;
- }
- return ( sign * Math.floor(Math.abs(n)) );
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- return ( n );
+ return ( n );
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
function ToUint16( n ) {
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
- if (n <0) {
- n += Math.pow(2,16);
- }
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
- return ( n );
+ return ( n );
}
function Mask( b, n ) {
- b = ToUint32BitString( b );
- b = b.substring( b.length - n );
- b = ToUint32Decimal( b );
- return ( b );
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
}
function ToUint32BitString( n ) {
- var b = "";
- for ( p = 31; p >=0; p-- ) {
- if ( n >= Math.pow(2,p) ) {
- b += "1";
- n -= Math.pow(2,p);
- } else {
- b += "0";
- }
+ var b = "";
+ for ( var p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
}
- return b;
+ }
+ return b;
}
function ToInt32BitString( n ) {
- var b = "";
- var sign = ( n < 0 ) ? -1 : 1;
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
- b += ( sign == 1 ) ? "0" : "1";
+ b += ( sign == 1 ) ? "0" : "1";
- for ( p = 30; p >=0; p-- ) {
- if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
- b += ( sign == 1 ) ? "1" : "0";
- n -= sign * Math.pow( 2, p );
- } else {
- b += ( sign == 1 ) ? "0" : "1";
- }
+ for ( var p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
}
+ }
- return b;
+ return b;
}
function ToInt32Decimal( bin ) {
- var r = 0;
- var sign;
+ var r = 0;
+ var sign;
- if ( Number(bin.charAt(0)) == 0 ) {
- sign = 1;
- r = 0;
- } else {
- sign = -1;
- r = -(Math.pow(2,31));
- }
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
- for ( var j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function ToUint32Decimal( bin ) {
- var r = 0;
+ var r = 0;
- for ( l = bin.length; l < 32; l++ ) {
- bin = "0" + bin;
- }
+ for ( var l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
- for ( j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function Not( n ) {
- n = ToInt32(n);
- n = ToInt32BitString(n);
+ n = ToInt32(n);
+ n = ToInt32BitString(n);
- r = ""
+ var r = "";
- for( var l = 0; l < n.length; l++ ) {
- r += ( n.charAt(l) == "0" ) ? "1" : "0";
- }
+ for( var l = 0; l < n.length; l++ ) {
+ r += ( n.charAt(l) == "0" ) ? "1" : "0";
+ }
- n = ToInt32Decimal(r);
+ n = ToInt32Decimal(r);
- return n;
-}
\ No newline at end of file
+ return n;
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.4.9.js b/mozilla/js/tests/ecma/Expressions/11.4.9.js
index 609a8fb934f..e680c10c922 100644
--- a/mozilla/js/tests/ecma/Expressions/11.4.9.js
+++ b/mozilla/js/tests/ecma/Expressions/11.4.9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,58 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.4.9.js
- ECMA Section: 11.4.9 Logical NOT Operator (!)
- Description: if the ToBoolean( VALUE ) result is true, return
- true. else return false.
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 11.4.9.js
+ ECMA Section: 11.4.9 Logical NOT Operator (!)
+ Description: if the ToBoolean( VALUE ) result is true, return
+ true. else return false.
+ Author: christine@netscape.com
+ Date: 7 july 1997
- Static variables:
- none
+ Static variables:
+ none
*/
- var SECTION = "11.4.9";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Logical NOT operator (!)";
+var SECTION = "11.4.9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Logical NOT operator (!)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
// version("130")
- var testcases = new Array();
- testcases[tc++] = new TestCase( SECTION, "!(null)", true, !(null) );
- testcases[tc++] = new TestCase( SECTION, "!(var x)", true, !(eval("var x")) );
- testcases[tc++] = new TestCase( SECTION, "!(void 0)", true, !(void 0) );
+new TestCase( SECTION, "!(null)", true, !(null) );
+new TestCase( SECTION, "!(var x)", true, !(eval("var x")) );
+new TestCase( SECTION, "!(void 0)", true, !(void 0) );
- testcases[tc++] = new TestCase( SECTION, "!(false)", true, !(false) );
- testcases[tc++] = new TestCase( SECTION, "!(true)", false, !(true) );
- testcases[tc++] = new TestCase( SECTION, "!()", true, !(eval()) );
- testcases[tc++] = new TestCase( SECTION, "!(0)", true, !(0) );
- testcases[tc++] = new TestCase( SECTION, "!(-0)", true, !(-0) );
- testcases[tc++] = new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) );
- testcases[tc++] = new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) );
- testcases[tc++] = new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) );
- testcases[tc++] = new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) );
- testcases[tc++] = new TestCase( SECTION, "!(1)", false, !(1) );
- testcases[tc++] = new TestCase( SECTION, "!(-1)", false, !(-1) );
- testcases[tc++] = new TestCase( SECTION, "!('')", true, !("") );
- testcases[tc++] = new TestCase( SECTION, "!('\t')", false, !("\t") );
- testcases[tc++] = new TestCase( SECTION, "!('0')", false, !("0") );
- testcases[tc++] = new TestCase( SECTION, "!('string')", false, !("string") );
- testcases[tc++] = new TestCase( SECTION, "!(new String(''))", false, !(new String("")) );
- testcases[tc++] = new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) );
- testcases[tc++] = new TestCase( SECTION, "!(new String())", false, !(new String()) );
- testcases[tc++] = new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) );
- testcases[tc++] = new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) );
- testcases[tc++] = new TestCase( SECTION, "!(new Array())", false, !(new Array()) );
- testcases[tc++] = new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) );
- testcases[tc++] = new TestCase( SECTION, "!(new Number())", false, !(new Number()) );
- testcases[tc++] = new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) );
- testcases[tc++] = new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) );
- testcases[tc++] = new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) );
+new TestCase( SECTION, "!(false)", true, !(false) );
+new TestCase( SECTION, "!(true)", false, !(true) );
+new TestCase( SECTION, "!()", true, !(eval()) );
+new TestCase( SECTION, "!(0)", true, !(0) );
+new TestCase( SECTION, "!(-0)", true, !(-0) );
+new TestCase( SECTION, "!(NaN)", true, !(Number.NaN) );
+new TestCase( SECTION, "!(Infinity)", false, !(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "!(-Infinity)", false, !(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "!(Math.PI)", false, !(Math.PI) );
+new TestCase( SECTION, "!(1)", false, !(1) );
+new TestCase( SECTION, "!(-1)", false, !(-1) );
+new TestCase( SECTION, "!('')", true, !("") );
+new TestCase( SECTION, "!('\t')", false, !("\t") );
+new TestCase( SECTION, "!('0')", false, !("0") );
+new TestCase( SECTION, "!('string')", false, !("string") );
+new TestCase( SECTION, "!(new String(''))", false, !(new String("")) );
+new TestCase( SECTION, "!(new String('string'))", false, !(new String("string")) );
+new TestCase( SECTION, "!(new String())", false, !(new String()) );
+new TestCase( SECTION, "!(new Boolean(true))", false, !(new Boolean(true)) );
+new TestCase( SECTION, "!(new Boolean(false))", false, !(new Boolean(false)) );
+new TestCase( SECTION, "!(new Array())", false, !(new Array()) );
+new TestCase( SECTION, "!(new Array(1,2,3)", false, !(new Array(1,2,3)) );
+new TestCase( SECTION, "!(new Number())", false, !(new Number()) );
+new TestCase( SECTION, "!(new Number(0))", false, !(new Number(0)) );
+new TestCase( SECTION, "!(new Number(NaN))", false, !(new Number(Number.NaN)) );
+new TestCase( SECTION, "!(new Number(Infinity))", false, !(new Number(Number.POSITIVE_INFINITY)) );
- test();
+test();
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.5.1.js b/mozilla/js/tests/ecma/Expressions/11.5.1.js
index 6441721b018..abdd3e4ccf2 100644
--- a/mozilla/js/tests/ecma/Expressions/11.5.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.5.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,97 +35,79 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.5.1.js
- ECMA Section: 11.5.1 Applying the * operator
- Description:
+ File Name: 11.5.1.js
+ ECMA Section: 11.5.1 Applying the * operator
+ Description:
- 11.5.1 Applying the * operator
+ 11.5.1 Applying the * operator
- The * operator performs multiplication, producing the product of its
- operands. Multiplication is commutative. Multiplication is not always
- associative in ECMAScript, because of finite precision.
+ The * operator performs multiplication, producing the product of its
+ operands. Multiplication is commutative. Multiplication is not always
+ associative in ECMAScript, because of finite precision.
- The result of a floating-point multiplication is governed by the rules
- of IEEE 754 double-precision arithmetic:
+ The result of a floating-point multiplication is governed by the rules
+ of IEEE 754 double-precision arithmetic:
- If either operand is NaN, the result is NaN.
- The sign of the result is positive if both operands have the same sign,
- negative if the operands have different signs.
- Multiplication of an infinity by a zero results in NaN.
- Multiplication of an infinity by an infinity results in an infinity.
- The sign is determined by the rule already stated above.
- Multiplication of an infinity by a finite non-zero value results in a
- signed infinity. The sign is determined by the rule already stated above.
- In the remaining cases, where neither an infinity or NaN is involved, the
- product is computed and rounded to the nearest representable value using IEEE
- 754 round-to-nearest mode. If the magnitude is too large to represent,
- the result is then an infinity of appropriate sign. If the magnitude is
- oo small to represent, the result is then a zero
- of appropriate sign. The ECMAScript language requires support of gradual
- underflow as defined by IEEE 754.
+ If either operand is NaN, the result is NaN.
+ The sign of the result is positive if both operands have the same sign,
+ negative if the operands have different signs.
+ Multiplication of an infinity by a zero results in NaN.
+ Multiplication of an infinity by an infinity results in an infinity.
+ The sign is determined by the rule already stated above.
+ Multiplication of an infinity by a finite non-zero value results in a
+ signed infinity. The sign is determined by the rule already stated above.
+ In the remaining cases, where neither an infinity or NaN is involved, the
+ product is computed and rounded to the nearest representable value using IEEE
+ 754 round-to-nearest mode. If the magnitude is too large to represent,
+ the result is then an infinity of appropriate sign. If the magnitude is
+ oo small to represent, the result is then a zero
+ of appropriate sign. The ECMAScript language requires support of gradual
+ underflow as defined by IEEE 754.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.5.1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.5.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Applying the * operator");
- test();
+writeHeaderToLog( SECTION + " Applying the * operator");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN );
+new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 );
+new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 );
+new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NaN * Number.NaN", Number.NaN, Number.NaN * Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN * 1", Number.NaN, Number.NaN * 1 );
- array[item++] = new TestCase( SECTION, "1 * Number.NaN", Number.NaN, 1 * Number.NaN );
+new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 0", Number.NaN, Number.POSITIVE_INFINITY * 0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 0", Number.NaN, Number.NEGATIVE_INFINITY * 0 );
- array[item++] = new TestCase( SECTION, "0 * Number.POSITIVE_INFINITY", Number.NaN, 0 * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 * Number.NEGATIVE_INFINITY", Number.NaN, 0 * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "0 * -0", -0, 0 * -0 );
+new TestCase( SECTION, "-0 * 0", -0, -0 * 0 );
+new TestCase( SECTION, "-0 * -0", 0, -0 * -0 );
+new TestCase( SECTION, "0 * 0", 0, 0 * 0 );
- array[item++] = new TestCase( SECTION, "-0 * Number.POSITIVE_INFINITY", Number.NaN, -0 * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-0 * Number.NEGATIVE_INFINITY", Number.NaN, -0 * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -0", Number.NaN, Number.POSITIVE_INFINITY * -0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -0", Number.NaN, Number.NEGATIVE_INFINITY * -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 * -0", -0, 0 * -0 );
- array[item++] = new TestCase( SECTION, "-0 * 0", -0, -0 * 0 );
- array[item++] = new TestCase( SECTION, "-0 * -0", 0, -0 * -0 );
- array[item++] = new TestCase( SECTION, "0 * 0", 0, 0 * 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 );
+new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 );
+new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY * 1 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY * -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY * -1 );
- array[item++] = new TestCase( SECTION, "1 * Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, 1 * Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 * Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, -1 * Number.NEGATIVE_INFINITY );
+test();
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY * 1 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY * -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY * -1 );
- array[item++] = new TestCase( SECTION, "1 * Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, 1 * Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 * Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, -1 * Number.POSITIVE_INFINITY );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.5.2.js b/mozilla/js/tests/ecma/Expressions/11.5.2.js
index 28e5f684da0..8cce29a215f 100644
--- a/mozilla/js/tests/ecma/Expressions/11.5.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.5.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.5.2.js
ECMA Section: 11.5.2 Applying the / operator
@@ -69,101 +71,82 @@
var SECTION = "11.5.2";
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
var BUGNUMBER="111202";
writeHeaderToLog( SECTION + " Applying the / operator");
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
// if either operand is NaN, the result is NaN.
- array[item++] = new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 );
- array[item++] = new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN );
+new TestCase( SECTION, "Number.NaN / Number.NaN", Number.NaN, Number.NaN / Number.NaN );
+new TestCase( SECTION, "Number.NaN / 1", Number.NaN, Number.NaN / 1 );
+new TestCase( SECTION, "1 / Number.NaN", Number.NaN, 1 / Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NaN", Number.NaN, Number.POSITIVE_INFINITY / Number.NaN );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY / Number.NaN );
// Division of an infinity by an infinity results in NaN.
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY / Number.POSITIVE_INFINITY );
// Division of an infinity by a zero results in an infinity.
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / 0", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 0", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -0", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -0", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -0 );
// Division of an infinity by a non-zero finite value results in a signed infinity.
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / 1 ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -1 ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / 1 ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -1 ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -1 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY / Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY / -Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY / -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / Number.MAX_VALUE ", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY / -Number.MAX_VALUE ", Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / -Number.MAX_VALUE );
// Division of a finite value by an infinity results in zero.
- array[item++] = new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 / Number.NEGATIVE_INFINITY", -0, 1 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 / Number.POSITIVE_INFINITY", 0, 1 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 / Number.POSITIVE_INFINITY", -0, -1 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 / Number.NEGATIVE_INFINITY", 0, -1 / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE / Number.NEGATIVE_INFINITY", -0, Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE / Number.POSITIVE_INFINITY", 0, Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE / Number.POSITIVE_INFINITY", -0, -Number.MAX_VALUE / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE / Number.NEGATIVE_INFINITY", 0, -Number.MAX_VALUE / Number.NEGATIVE_INFINITY );
// Division of a zero by a zero results in NaN
- array[item++] = new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 );
- array[item++] = new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 );
- array[item++] = new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 );
- array[item++] = new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 );
+new TestCase( SECTION, "0 / -0", Number.NaN, 0 / -0 );
+new TestCase( SECTION, "-0 / 0", Number.NaN, -0 / 0 );
+new TestCase( SECTION, "-0 / -0", Number.NaN, -0 / -0 );
+new TestCase( SECTION, "0 / 0", Number.NaN, 0 / 0 );
// division of zero by any other finite value results in zero
- array[item++] = new TestCase( SECTION, "0 / 1", 0, 0 / 1 );
- array[item++] = new TestCase( SECTION, "0 / -1", -0, 0 / -1 );
- array[item++] = new TestCase( SECTION, "-0 / 1", -0, -0 / 1 );
- array[item++] = new TestCase( SECTION, "-0 / -1", 0, -0 / -1 );
+new TestCase( SECTION, "0 / 1", 0, 0 / 1 );
+new TestCase( SECTION, "0 / -1", -0, 0 / -1 );
+new TestCase( SECTION, "-0 / 1", -0, -0 / 1 );
+new TestCase( SECTION, "-0 / -1", 0, -0 / -1 );
// Division of a non-zero finite value by a zero results in a signed infinity.
- array[item++] = new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 );
- array[item++] = new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 );
- array[item++] = new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 );
- array[item++] = new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 );
+new TestCase( SECTION, "1 / 0", Number.POSITIVE_INFINITY, 1/0 );
+new TestCase( SECTION, "1 / -0", Number.NEGATIVE_INFINITY, 1/-0 );
+new TestCase( SECTION, "-1 / 0", Number.NEGATIVE_INFINITY, -1/0 );
+new TestCase( SECTION, "-1 / -0", Number.POSITIVE_INFINITY, -1/-0 );
- array[item++] = new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "0 / Number.POSITIVE_INFINITY", 0, 0 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 / Number.NEGATIVE_INFINITY", -0, 0 / Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-0 / Number.POSITIVE_INFINITY", -0, -0 / Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 / Number.NEGATIVE_INFINITY", 0, -0 / Number.NEGATIVE_INFINITY );
+
+test();
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/Expressions/11.5.3.js b/mozilla/js/tests/ecma/Expressions/11.5.3.js
index b3c77bed7f7..111fee90e70 100644
--- a/mozilla/js/tests/ecma/Expressions/11.5.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.5.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.5.3.js
ECMA Section: 11.5.3 Applying the % operator
@@ -71,105 +73,87 @@
var SECTION = "11.5.3";
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
+
var BUGNUMBER="111202";
writeHeaderToLog( SECTION + " Applying the % operator");
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
// if either operand is NaN, the result is NaN.
- array[item++] = new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 );
- array[item++] = new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN );
+new TestCase( SECTION, "Number.NaN % Number.NaN", Number.NaN, Number.NaN % Number.NaN );
+new TestCase( SECTION, "Number.NaN % 1", Number.NaN, Number.NaN % 1 );
+new TestCase( SECTION, "1 % Number.NaN", Number.NaN, 1 % Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NaN", Number.NaN, Number.POSITIVE_INFINITY % Number.NaN );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NaN", Number.NaN, Number.NEGATIVE_INFINITY % Number.NaN );
// If the dividend is an infinity, or the divisor is a zero, or both, the result is NaN.
// dividend is an infinity
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % 0", Number.NaN, Number.POSITIVE_INFINITY % 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 0", Number.NaN, Number.NEGATIVE_INFINITY % 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -0", Number.NaN, Number.POSITIVE_INFINITY % -0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -0", Number.NaN, Number.NEGATIVE_INFINITY % -0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % 1 ", Number.NaN, Number.NEGATIVE_INFINITY % 1 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -1 ", Number.NaN, Number.NEGATIVE_INFINITY % -1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % 1 ", Number.NaN, Number.POSITIVE_INFINITY % 1 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -1 ", Number.NaN, Number.POSITIVE_INFINITY % -1 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % Number.MAX_VALUE );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.NEGATIVE_INFINITY % -Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % Number.MAX_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY % -Number.MAX_VALUE ", Number.NaN, Number.POSITIVE_INFINITY % -Number.MAX_VALUE );
// divisor is 0
- array[item++] = new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 );
- array[item++] = new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 );
- array[item++] = new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 );
- array[item++] = new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 );
+new TestCase( SECTION, "0 % -0", Number.NaN, 0 % -0 );
+new TestCase( SECTION, "-0 % 0", Number.NaN, -0 % 0 );
+new TestCase( SECTION, "-0 % -0", Number.NaN, -0 % -0 );
+new TestCase( SECTION, "0 % 0", Number.NaN, 0 % 0 );
- array[item++] = new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 );
- array[item++] = new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 );
- array[item++] = new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 );
- array[item++] = new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 );
+new TestCase( SECTION, "1 % 0", Number.NaN, 1%0 );
+new TestCase( SECTION, "1 % -0", Number.NaN, 1%-0 );
+new TestCase( SECTION, "-1 % 0", Number.NaN, -1%0 );
+new TestCase( SECTION, "-1 % -0", Number.NaN, -1%-0 );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 );
+new TestCase( SECTION, "Number.MAX_VALUE % 0", Number.NaN, Number.MAX_VALUE%0 );
+new TestCase( SECTION, "Number.MAX_VALUE % -0", Number.NaN, Number.MAX_VALUE%-0 );
+new TestCase( SECTION, "-Number.MAX_VALUE % 0", Number.NaN, -Number.MAX_VALUE%0 );
+new TestCase( SECTION, "-Number.MAX_VALUE % -0", Number.NaN, -Number.MAX_VALUE%-0 );
// If the dividend is finite and the divisor is an infinity, the result equals the dividend.
- array[item++] = new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 % Number.NEGATIVE_INFINITY", 1, 1 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "1 % Number.POSITIVE_INFINITY", 1, 1 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 % Number.POSITIVE_INFINITY", -1, -1 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-1 % Number.NEGATIVE_INFINITY", -1, -1 % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE % Number.NEGATIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE % Number.POSITIVE_INFINITY", Number.MAX_VALUE, Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE % Number.POSITIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Number.MAX_VALUE % Number.NEGATIVE_INFINITY", -Number.MAX_VALUE, -Number.MAX_VALUE % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "0 % Number.POSITIVE_INFINITY", 0, 0 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 % Number.NEGATIVE_INFINITY", 0, 0 % Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-0 % Number.POSITIVE_INFINITY", -0, -0 % Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-0 % Number.NEGATIVE_INFINITY", -0, -0 % Number.NEGATIVE_INFINITY );
// If the dividend is a zero and the divisor is finite, the result is the same as the dividend.
- array[item++] = new TestCase( SECTION, "0 % 1", 0, 0 % 1 );
- array[item++] = new TestCase( SECTION, "0 % -1", -0, 0 % -1 );
- array[item++] = new TestCase( SECTION, "-0 % 1", -0, -0 % 1 );
- array[item++] = new TestCase( SECTION, "-0 % -1", 0, -0 % -1 );
+new TestCase( SECTION, "0 % 1", 0, 0 % 1 );
+new TestCase( SECTION, "0 % -1", -0, 0 % -1 );
+new TestCase( SECTION, "-0 % 1", -0, -0 % 1 );
+new TestCase( SECTION, "-0 % -1", 0, -0 % -1 );
// In the remaining cases, where neither an infinity, nor a zero, nor NaN is involved, the floating-point remainder r
// from a dividend n and a divisor d is defined by the mathematical relation r = n (d * q) where q is an integer that
// is negative only if n/d is negative and positive only if n/d is positive, and whose magnitude is as large as
// possible without exceeding the magnitude of the true mathematical quotient of n and d.
- return ( array );
-}
+test();
+
diff --git a/mozilla/js/tests/ecma/Expressions/11.6.1-1.js b/mozilla/js/tests/ecma/Expressions/11.6.1-1.js
index 2a3f496e7e9..3cad0fea6aa 100644
--- a/mozilla/js/tests/ecma/Expressions/11.6.1-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.6.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.6.1-1.js
ECMA Section: 11.6.1 The addition operator ( + )
@@ -79,69 +81,48 @@
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
-
writeHeaderToLog( SECTION + " The Addition operator ( + )");
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
// a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
// set in the object's prototype, not the object itself.
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2",
1,
eval("var EXP_1 = true; var EXP_2 = false; EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2",
1,
eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2",
1,
eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
1,
eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2",
1,
eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
"[object Object][object Object]",
eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
1,
eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
"truefalse",
eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
@@ -150,55 +131,53 @@ function getTestCases() {
// a number primitive and a number object, and "MyValuelessObject", where the value is
// set in the object's prototype, not the object itself.
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2",
99,
eval("var EXP_1 = 100; var EXP_2 = -1; EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
99,
eval("var EXP_1 = new Number(100); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2",
99,
eval("var EXP_1 = new Object(100); var EXP_2 = new Object(-1); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
99,
eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2",
99,
eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(-1); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
"[object Object][object Object]",
eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2",
99,
eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(-1); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
"100-1",
eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
+new TestCase( SECTION,
"var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1",
"truetrue",
eval("var EXP_1 = new MyValuelessObject( new MyValuelessObject( new Boolean(true) ) ); EXP_1 + EXP_1") );
- return ( array );
-}
-
+test();
function MyProtoValuelessObject() {
this.valueOf = new Function ( "" );
diff --git a/mozilla/js/tests/ecma/Expressions/11.6.1-2.js b/mozilla/js/tests/ecma/Expressions/11.6.1-2.js
index d03085ec301..448b5172f8e 100644
--- a/mozilla/js/tests/ecma/Expressions/11.6.1-2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.6.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,185 +35,167 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.6.1-2.js
- ECMA Section: 11.6.1 The addition operator ( + )
- Description:
+ File Name: 11.6.1-2.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
- The addition operator either performs string concatenation or numeric
- addition.
+ The addition operator either performs string concatenation or numeric
+ addition.
- The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
- is evaluated as follows:
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
- 1. Evaluate AdditiveExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate MultiplicativeExpression.
- 4. Call GetValue(Result(3)).
- 5. Call ToPrimitive(Result(2)).
- 6. Call ToPrimitive(Result(4)).
- 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
- (Note that this step differs from step 3 in the algorithm for comparison
- for the relational operators in using or instead of and.)
- 8. Call ToNumber(Result(5)).
- 9. Call ToNumber(Result(6)).
- 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
- 11. Return Result(10).
- 12. Call ToString(Result(5)).
- 13. Call ToString(Result(6)).
- 14. Concatenate Result(12) followed by Result(13).
- 15. Return Result(14).
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
- Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
- All native ECMAScript objects except Date objects handle the absence of a
- hint as if the hint Number were given; Date objects handle the absence of a
- hint as if the hint String were given. Host objects may handle the absence
- of a hint in some other manner.
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
- This test does only covers cases where the Additive or Mulplicative expression
- ToPrimitive is a string.
+ This test does only covers cases where the Additive or Mulplicative expression
+ ToPrimitive is a string.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.6.1-2";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "11.6.1-2";
+var VERSION = "ECMA_1";
+startTest();
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
- writeHeaderToLog( SECTION + " The Addition operator ( + )");
- test();
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") );
- // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
- // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
- // set in the object's prototype, not the object itself.
+new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2",
- "stringfalse",
- eval("var EXP_1 = 'string'; var EXP_2 = false; EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2",
- "truestring",
- eval("var EXP_1 = true; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2",
- "truestring",
- eval("var EXP_1 = new Boolean(true); var EXP_2 = new String('string'); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "truestring",
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
- "truestring",
- eval("var EXP_1 = new Object(true); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2",
- "stringfalse",
- eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Boolean(false)); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
- "truestring",
- eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
+ "stringfalse",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2",
- "[object Object][object Object]",
- eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 + EXP_2") );
+// tests for number primitive, number object, Object object, a "MyObject" whose value is
+// a number primitive and a number object, and "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2",
- "stringfalse",
- eval("var EXP_1 = new MyValuelessObject('string'); var EXP_2 = new MyValuelessObject(false); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2",
- "stringfalse",
- eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
- // tests for number primitive, number object, Object object, a "MyObject" whose value is
- // a number primitive and a number object, and "MyValuelessObject", where the value is
- // set in the object's prototype, not the object itself.
+new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2",
- "100string",
- eval("var EXP_1 = 100; var EXP_2 = 'string'; EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2",
- "string-1",
- eval("var EXP_1 = new String('string'); var EXP_2 = new Number(-1); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2",
- "100string",
- eval("var EXP_1 = new Object(100); var EXP_2 = new Object('string'); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
+ "[object Object][object Object]",
+ eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2",
- "string-1",
- eval("var EXP_1 = new Object(new String('string')); var EXP_2 = new Object(new Number(-1)); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2",
+ "100string",
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2",
- "100string",
- eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject('string'); EXP_1 + EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
+ "string-1",
+ eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2",
- "[object Object][object Object]",
- eval("var EXP_1 = new MyObject(new String('string')); var EXP_2 = new MyObject(new Number(-1)); EXP_1 + EXP_2") );
+test();
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2",
- "100string",
- eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject('string'); EXP_1 + EXP_2") );
-
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2",
- "string-1",
- eval("var EXP_1 = new MyValuelessObject(new String('string')); var EXP_2 = new MyValuelessObject(new Number(-1)); EXP_1 + EXP_2") );
- return ( array );
-}
function MyProtoValuelessObject() {
- this.valueOf = new Function ( "" );
- this.__proto__ = null;
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
}
function MyProtolessObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.__proto__ = null;
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
}
function MyValuelessObject(value) {
- this.__proto__ = new MyPrototypeObject(value);
+ this.__proto__ = new MyPrototypeObject(value);
}
function MyPrototypeObject(value) {
- this.valueOf = new Function( "return this.value;" );
- this.toString = new Function( "return (this.value + '');" );
- this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
}
function MyObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.6.1-3.js b/mozilla/js/tests/ecma/Expressions/11.6.1-3.js
index df33979ee72..ac3d205e6b1 100644
--- a/mozilla/js/tests/ecma/Expressions/11.6.1-3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.6.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,163 +35,145 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.6.1-3.js
- ECMA Section: 11.6.1 The addition operator ( + )
- Description:
+ File Name: 11.6.1-3.js
+ ECMA Section: 11.6.1 The addition operator ( + )
+ Description:
- The addition operator either performs string concatenation or numeric
- addition.
+ The addition operator either performs string concatenation or numeric
+ addition.
- The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
- is evaluated as follows:
+ The production AdditiveExpression : AdditiveExpression + MultiplicativeExpression
+ is evaluated as follows:
- 1. Evaluate AdditiveExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate MultiplicativeExpression.
- 4. Call GetValue(Result(3)).
- 5. Call ToPrimitive(Result(2)).
- 6. Call ToPrimitive(Result(4)).
- 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
- (Note that this step differs from step 3 in the algorithm for comparison
- for the relational operators in using or instead of and.)
- 8. Call ToNumber(Result(5)).
- 9. Call ToNumber(Result(6)).
- 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
- 11. Return Result(10).
- 12. Call ToString(Result(5)).
- 13. Call ToString(Result(6)).
- 14. Concatenate Result(12) followed by Result(13).
- 15. Return Result(14).
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToPrimitive(Result(2)).
+ 6. Call ToPrimitive(Result(4)).
+ 7. If Type(Result(5)) is String or Type(Result(6)) is String, go to step 12.
+ (Note that this step differs from step 3 in the algorithm for comparison
+ for the relational operators in using or instead of and.)
+ 8. Call ToNumber(Result(5)).
+ 9. Call ToNumber(Result(6)).
+ 10. Apply the addition operation to Result(8) and Result(9). See the discussion below (11.6.3).
+ 11. Return Result(10).
+ 12. Call ToString(Result(5)).
+ 13. Call ToString(Result(6)).
+ 14. Concatenate Result(12) followed by Result(13).
+ 15. Return Result(14).
- Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
- All native ECMAScript objects except Date objects handle the absence of a
- hint as if the hint Number were given; Date objects handle the absence of a
- hint as if the hint String were given. Host objects may handle the absence
- of a hint in some other manner.
+ Note that no hint is provided in the calls to ToPrimitive in steps 5 and 6.
+ All native ECMAScript objects except Date objects handle the absence of a
+ hint as if the hint Number were given; Date objects handle the absence of a
+ hint as if the hint String were given. Host objects may handle the absence
+ of a hint in some other manner.
- This test does only covers cases where the Additive or Mulplicative expression
- is a Date.
+ This test does only covers cases where the Additive or Mulplicative expression
+ is a Date.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.6.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.6.1-3";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The Addition operator ( + )");
- test();
+writeHeaderToLog( SECTION + " The Addition operator ( + )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var DATE1 = new Date();
- // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
- // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
- // set in the object's prototype, not the object itself.
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + DATE1",
+ DATE1.toString() + DATE1.toString(),
+ DATE1 + DATE1 );
- var DATE1 = new Date();
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + 0",
+ DATE1.toString() + 0,
+ DATE1 + 0 );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + DATE1",
- DATE1.toString() + DATE1.toString(),
- DATE1 + DATE1 );
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Number(0)",
+ DATE1.toString() + 0,
+ DATE1 + new Number(0) );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + 0",
- DATE1.toString() + 0,
- DATE1 + 0 );
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + true",
+ DATE1.toString() + "true",
+ DATE1 + true );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + new Number(0)",
- DATE1.toString() + 0,
- DATE1 + new Number(0) );
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + true",
- DATE1.toString() + "true",
- DATE1 + true );
+new TestCase( SECTION,
+ "var DATE1 = new Date(); DATE1 + new Boolean(true)",
+ DATE1.toString() + "true",
+ DATE1 + new Boolean(true) );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + new Boolean(true)",
- DATE1.toString() + "true",
- DATE1 + new Boolean(true) );
+var MYOB1 = new MyObject( DATE1 );
+var MYOB2 = new MyValuelessObject( DATE1 );
+var MYOB3 = new MyProtolessObject( DATE1 );
+var MYOB4 = new MyProtoValuelessObject( DATE1 );
- array[item++] = new TestCase( SECTION,
- "var DATE1 = new Date(); DATE1 + new Boolean(true)",
- DATE1.toString() + "true",
- DATE1 + new Boolean(true) );
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)",
+ "[object Object]1",
+ MYOB1 + new Number(1) );
- var MYOB1 = new MyObject( DATE1 );
- var MYOB2 = new MyValuelessObject( DATE1 );
- var MYOB3 = new MyProtolessObject( DATE1 );
- var MYOB4 = new MyProtoValuelessObject( DATE1 );
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + 1",
+ "[object Object]1",
+ MYOB1 + 1 );
- array[item++] = new TestCase( SECTION,
- "MYOB1 = new MyObject(DATE1); MYOB1 + new Number(1)",
- "[object Object]1",
- MYOB1 + new Number(1) );
+new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'",
+ DATE1.toString() + "string",
+ MYOB2 + 'string' );
- array[item++] = new TestCase( SECTION,
- "MYOB1 = new MyObject(DATE1); MYOB1 + 1",
- "[object Object]1",
- MYOB1 + 1 );
-
- array[item++] = new TestCase( SECTION,
- "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + 'string'",
- DATE1.toString() + "string",
- MYOB2 + 'string' );
-
- array[item++] = new TestCase( SECTION,
- "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')",
- DATE1.toString() + "string",
- MYOB2 + new String('string') );
+new TestCase( SECTION,
+ "MYOB2 = new MyValuelessObject(DATE1); MYOB3 + new String('string')",
+ DATE1.toString() + "string",
+ MYOB2 + new String('string') );
/*
- array[item++] = new TestCase( SECTION,
- "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)",
- DATE1.toString() + "true",
- MYOB3 + new Boolean(true) );
+ new TestCase( SECTION,
+ "MYOB3 = new MyProtolessObject(DATE1); MYOB3 + new Boolean(true)",
+ DATE1.toString() + "true",
+ MYOB3 + new Boolean(true) );
*/
- array[item++] = new TestCase( SECTION,
- "MYOB1 = new MyObject(DATE1); MYOB1 + true",
- "[object Object]true",
- MYOB1 + true );
+new TestCase( SECTION,
+ "MYOB1 = new MyObject(DATE1); MYOB1 + true",
+ "[object Object]true",
+ MYOB1 + true );
+
+test();
- return ( array );
-}
function MyProtoValuelessObject() {
- this.valueOf = new Function ( "" );
- this.__proto__ = null;
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
}
function MyProtolessObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.__proto__ = null;
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
}
function MyValuelessObject(value) {
- this.__proto__ = new MyPrototypeObject(value);
+ this.__proto__ = new MyPrototypeObject(value);
}
function MyPrototypeObject(value) {
- this.valueOf = new Function( "return this.value;" );
- this.toString = new Function( "return (this.value + '');" );
- this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
}
function MyObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.6.2-1.js b/mozilla/js/tests/ecma/Expressions/11.6.2-1.js
index 00a149d088c..a2b6180fb9d 100644
--- a/mozilla/js/tests/ecma/Expressions/11.6.2-1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.6.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,181 +35,163 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.6.2-1.js
- ECMA Section: 11.6.2 The Subtraction operator ( - )
- Description:
+ File Name: 11.6.2-1.js
+ ECMA Section: 11.6.2 The Subtraction operator ( - )
+ Description:
- The production AdditiveExpression : AdditiveExpression -
- MultiplicativeExpression is evaluated as follows:
+ The production AdditiveExpression : AdditiveExpression -
+ MultiplicativeExpression is evaluated as follows:
- 1. Evaluate AdditiveExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate MultiplicativeExpression.
- 4. Call GetValue(Result(3)).
- 5. Call ToNumber(Result(2)).
- 6. Call ToNumber(Result(4)).
- 7. Apply the subtraction operation to Result(5) and Result(6). See the
- discussion below (11.6.3).
- 8. Return Result(7).
+ 1. Evaluate AdditiveExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate MultiplicativeExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToNumber(Result(2)).
+ 6. Call ToNumber(Result(4)).
+ 7. Apply the subtraction operation to Result(5) and Result(6). See the
+ discussion below (11.6.3).
+ 8. Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.6.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.6.2-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The subtraction operator ( - )");
- test();
+writeHeaderToLog( SECTION + " The subtraction operator ( - )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
+// a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") );
- // tests for boolean primitive, boolean object, Object object, a "MyObject" whose value is
- // a boolean primitive and a boolean object, and "MyValuelessObject", where the value is
- // set in the object's prototype, not the object itself.
+new TestCase( SECTION,
+ "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = true; var EXP_2 = false; EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = new Boolean(true); var EXP_2 = new Boolean(false); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = new Object(true); var EXP_2 = new Object(false); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = new Object(new Boolean(true)); var EXP_2 = new Object(new Boolean(false)); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = new MyObject(true); var EXP_2 = new MyObject(false); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2",
- Number.NaN,
- eval("var EXP_1 = new MyObject(new Boolean(true)); var EXP_2 = new MyObject(new Boolean(false)); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2",
+ 1,
+ eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2",
- Number.NaN,
- eval("var EXP_1 = new MyOtherObject(new Boolean(true)); var EXP_2 = new MyOtherObject(new Boolean(false)); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2",
- 1,
- eval("var EXP_1 = new MyValuelessObject(true); var EXP_2 = new MyValuelessObject(false); EXP_1 - EXP_2") );
+// tests for number primitive, number object, Object object, a "MyObject" whose value is
+// a number primitive and a number object, and "MyValuelessObject", where the value is
+// set in the object's prototype, not the object itself.
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2",
- Number.NaN,
- eval("var EXP_1 = new MyValuelessObject(new Boolean(true)); var EXP_2 = new MyValuelessObject(new Boolean(false)); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") );
- // tests for number primitive, number object, Object object, a "MyObject" whose value is
- // a number primitive and a number object, and "MyValuelessObject", where the value is
- // set in the object's prototype, not the object itself.
+new TestCase( SECTION,
+ "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = 100; var EXP_2 = 1; EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new Number(100); var EXP_2 = new Number(1); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new Object(100); var EXP_2 = new Object(1); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new Object(new Number(100)); var EXP_2 = new Object(new Number(1)); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new MyObject(100); var EXP_2 = new MyObject(1); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") );
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2",
- Number.NaN,
- eval("var EXP_1 = new MyObject(new Number(100)); var EXP_2 = new MyObject(new Number(1)); EXP_1 - EXP_2") );
-
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new MyOtherObject(new Number(100)); var EXP_2 = new MyOtherObject(new Number(1)); EXP_1 - EXP_2") );
-
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2",
- 99,
- eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") );
+new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2",
+ 99,
+ eval("var EXP_1 = new MyValuelessObject(100); var EXP_2 = new MyValuelessObject(1); EXP_1 - EXP_2") );
/*
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2",
- Number.NaN,
- eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") );
+ new TestCase( SECTION,
+ "var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2",
+ Number.NaN,
+ eval("var EXP_1 = new MyValuelessObject(new Number(100)); var EXP_2 = new MyValuelessObject(new Number(1)); EXP_1 - EXP_2") );
*/
- // same thing with string!
- array[item++] = new TestCase( SECTION,
- "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2",
- 254,
- eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") );
+// same thing with string!
+new TestCase( SECTION,
+ "var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1'); EXP_1 - EXP_2",
+ 254,
+ eval("var EXP_1 = new MyOtherObject(new String('0xff')); var EXP_2 = new MyOtherObject(new String('1')); EXP_1 - EXP_2") );
+
+test();
- return ( array );
-}
function MyProtoValuelessObject() {
- this.valueOf = new Function ( "" );
- this.__proto__ = null;
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
}
function MyProtolessObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.__proto__ = null;
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
}
function MyValuelessObject(value) {
- this.__proto__ = new MyPrototypeObject(value);
+ this.__proto__ = new MyPrototypeObject(value);
}
function MyPrototypeObject(value) {
- this.valueOf = new Function( "return this.value;" );
- this.toString = new Function( "return (this.value + '');" );
- this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
}
function MyObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
}
function MyOtherObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function ( "return this.value + ''" );
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value + ''" );
+ this.value = value;
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.6.3.js b/mozilla/js/tests/ecma/Expressions/11.6.3.js
index 3cb1b2e8369..d46423ab4ec 100644
--- a/mozilla/js/tests/ecma/Expressions/11.6.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.6.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,98 +35,79 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.6.3.js
- ECMA Section: 11.6.3 Applying the additive operators
- (+, -) to numbers
- Description:
- The + operator performs addition when applied to two operands of numeric
- type, producing the sum of the operands. The - operator performs
- subtraction, producing the difference of two numeric operands.
+ File Name: 11.6.3.js
+ ECMA Section: 11.6.3 Applying the additive operators
+ (+, -) to numbers
+ Description:
+ The + operator performs addition when applied to two operands of numeric
+ type, producing the sum of the operands. The - operator performs
+ subtraction, producing the difference of two numeric operands.
- Addition is a commutative operation, but not always associative.
+ Addition is a commutative operation, but not always associative.
- The result of an addition is determined using the rules of IEEE 754
- double-precision arithmetic:
+ The result of an addition is determined using the rules of IEEE 754
+ double-precision arithmetic:
- If either operand is NaN, the result is NaN.
- The sum of two infinities of opposite sign is NaN.
- The sum of two infinities of the same sign is the infinity of that sign.
- The sum of an infinity and a finite value is equal to the infinite operand.
- The sum of two negative zeros is 0. The sum of two positive zeros, or of
- two zeros of opposite sign, is +0.
- The sum of a zero and a nonzero finite value is equal to the nonzero
- operand.
- The sum of two nonzero finite values of the same magnitude and opposite
- sign is +0.
- In the remaining cases, where neither an infinity, nor a zero, nor NaN is
- involved, and the operands have the same sign or have different
- magnitudes, the sum is computed and rounded to the nearest
- representable value using IEEE 754 round-to-nearest mode. If the
- magnitude is too large to represent, the operation overflows and
- the result is then an infinity of appropriate sign. The ECMAScript
- language requires support of gradual underflow as defined by IEEE 754.
+ If either operand is NaN, the result is NaN.
+ The sum of two infinities of opposite sign is NaN.
+ The sum of two infinities of the same sign is the infinity of that sign.
+ The sum of an infinity and a finite value is equal to the infinite operand.
+ The sum of two negative zeros is 0. The sum of two positive zeros, or of
+ two zeros of opposite sign, is +0.
+ The sum of a zero and a nonzero finite value is equal to the nonzero
+ operand.
+ The sum of two nonzero finite values of the same magnitude and opposite
+ sign is +0.
+ In the remaining cases, where neither an infinity, nor a zero, nor NaN is
+ involved, and the operands have the same sign or have different
+ magnitudes, the sum is computed and rounded to the nearest
+ representable value using IEEE 754 round-to-nearest mode. If the
+ magnitude is too large to represent, the operation overflows and
+ the result is then an infinity of appropriate sign. The ECMAScript
+ language requires support of gradual underflow as defined by IEEE 754.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.6.3";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.6.3";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers");
- test();
+writeHeaderToLog( SECTION + " Applying the additive operators (+,-) to numbers");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 );
+new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 );
+new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN + 1", Number.NaN, Number.NaN + 1 );
- array[item++] = new TestCase( SECTION, "1 + Number.NaN", Number.NaN, 1 + Number.NaN );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.NaN - 1", Number.NaN, Number.NaN - 1 );
- array[item++] = new TestCase( SECTION, "1 - Number.NaN", Number.NaN, 1 - Number.NaN );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY + Number.POSITIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY + Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY + Number.NEGATIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY + Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NaN, Number.POSITIVE_INFINITY - Number.POSITIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.NaN, Number.NEGATIVE_INFINITY - Number.NEGATIVE_INFINITY);
+new TestCase( SECTION, "-0 + -0", -0, -0 + -0 );
+new TestCase( SECTION, "-0 - 0", -0, -0 - 0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY", Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY - Number.NEGATIVE_INFINITY);
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY", Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY - Number.POSITIVE_INFINITY);
+new TestCase( SECTION, "0 + 0", 0, 0 + 0 );
+new TestCase( SECTION, "0 + -0", 0, 0 + -0 );
+new TestCase( SECTION, "0 - -0", 0, 0 - -0 );
+new TestCase( SECTION, "0 - 0", 0, 0 - 0 );
+new TestCase( SECTION, "-0 - -0", 0, -0 - -0 );
+new TestCase( SECTION, "-0 + 0", 0, -0 + 0 );
- array[item++] = new TestCase( SECTION, "-0 + -0", -0, -0 + -0 );
- array[item++] = new TestCase( SECTION, "-0 - 0", -0, -0 - 0 );
+new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE );
+new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "0 + 0", 0, 0 + 0 );
- array[item++] = new TestCase( SECTION, "0 + -0", 0, 0 + -0 );
- array[item++] = new TestCase( SECTION, "0 - -0", 0, 0 - -0 );
- array[item++] = new TestCase( SECTION, "0 - 0", 0, 0 - 0 );
- array[item++] = new TestCase( SECTION, "-0 - -0", 0, -0 - -0 );
- array[item++] = new TestCase( SECTION, "-0 + 0", 0, -0 + 0 );
+new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE - Number.MAX_VALUE", 0, Number.MAX_VALUE - Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "1/Number.MAX_VALUE - 1/Number.MAX_VALUE", 0, 1/Number.MAX_VALUE - 1/Number.MAX_VALUE );
-
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE - Number.MIN_VALUE", 0, Number.MIN_VALUE - Number.MIN_VALUE );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Expressions/11.7.1.js b/mozilla/js/tests/ecma/Expressions/11.7.1.js
index 49c6b6c6e66..6fc511edbec 100644
--- a/mozilla/js/tests/ecma/Expressions/11.7.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.7.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.7.1.js
ECMA Section: 11.7.1 The Left Shift Operator ( << )
@@ -63,41 +65,21 @@
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
-
writeHeaderToLog( SECTION + " The left shift operator ( << )");
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
for ( power = 0; power < 33; power++ ) {
shiftexp = Math.pow( 2, power );
for ( addexp = 0; addexp < 33; addexp++ ) {
- array[item++] = new TestCase( SECTION,
- shiftexp + " << " + addexp,
- LeftShift( shiftexp, addexp ),
- shiftexp << addexp );
+ new TestCase( SECTION,
+ shiftexp + " << " + addexp,
+ LeftShift( shiftexp, addexp ),
+ shiftexp << addexp );
}
}
- return ( array );
-}
+test();
+
function ToInteger( n ) {
n = Number( n );
var sign = ( n < 0 ) ? -1 : 1;
diff --git a/mozilla/js/tests/ecma/Expressions/11.7.2.js b/mozilla/js/tests/ecma/Expressions/11.7.2.js
index d00dc8fa6d2..4503643197c 100644
--- a/mozilla/js/tests/ecma/Expressions/11.7.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.7.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 11.7.2.js
ECMA Section: 11.7.2 The signed right shift operator ( >> )
@@ -63,27 +65,9 @@
var SECTION = "11.7.2";
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
writeHeaderToLog( SECTION + " The signed right shift operator ( >> )");
- test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
var power = 0;
var addexp = 0;
@@ -91,10 +75,10 @@ function getTestCases() {
shiftexp = Math.pow( 2, power );
for ( addexp = 0; addexp <= 32; addexp++ ) {
- array[item++] = new TestCase( SECTION,
- shiftexp + " >> " + addexp,
- SignedRightShift( shiftexp, addexp ),
- shiftexp >> addexp );
+ new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
}
}
@@ -102,15 +86,14 @@ function getTestCases() {
shiftexp = -Math.pow( 2, power );
for ( addexp = 0; addexp <= 32; addexp++ ) {
- array[item++] = new TestCase( SECTION,
- shiftexp + " >> " + addexp,
- SignedRightShift( shiftexp, addexp ),
- shiftexp >> addexp );
+ new TestCase( SECTION,
+ shiftexp + " >> " + addexp,
+ SignedRightShift( shiftexp, addexp ),
+ shiftexp >> addexp );
}
}
- return ( array );
-}
+test();
function ToInteger( n ) {
n = Number( n );
@@ -258,4 +241,4 @@ function SignedRShift( s, a ) {
return ToInt32(ToInt32Decimal(s));
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.7.3.js b/mozilla/js/tests/ecma/Expressions/11.7.3.js
index 98276151a3e..75d52b0754c 100644
--- a/mozilla/js/tests/ecma/Expressions/11.7.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.7.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,212 +35,194 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.7.3.js
- ECMA Section: 11.7.3 The unsigned right shift operator ( >>> )
- Description:
- 11.7.3 The unsigned right shift operator ( >>> )
- Performs a zero-filling bitwise right shift operation on the left argument
- by the amount specified by the right argument.
+ File Name: 11.7.3.js
+ ECMA Section: 11.7.3 The unsigned right shift operator ( >>> )
+ Description:
+ 11.7.3 The unsigned right shift operator ( >>> )
+ Performs a zero-filling bitwise right shift operation on the left argument
+ by the amount specified by the right argument.
- The production ShiftExpression : ShiftExpression >>> AdditiveExpression is
- evaluated as follows:
+ The production ShiftExpression : ShiftExpression >>> AdditiveExpression is
+ evaluated as follows:
- 1. Evaluate ShiftExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate AdditiveExpression.
- 4. Call GetValue(Result(3)).
- 5. Call ToUint32(Result(2)).
- 6. Call ToUint32(Result(4)).
- 7. Mask out all but the least significant 5 bits of Result(6), that is,
- compute Result(6) & 0x1F.
- 8. Perform zero-filling right shift of Result(5) by Result(7) bits.
- Vacated bits are filled with zero. The result is an unsigned 32 bit
- integer.
- 9. Return Result(8).
+ 1. Evaluate ShiftExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate AdditiveExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Call ToUint32(Result(2)).
+ 6. Call ToUint32(Result(4)).
+ 7. Mask out all but the least significant 5 bits of Result(6), that is,
+ compute Result(6) & 0x1F.
+ 8. Perform zero-filling right shift of Result(5) by Result(7) bits.
+ Vacated bits are filled with zero. The result is an unsigned 32 bit
+ integer.
+ 9. Return Result(8).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.7.3";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.7.3";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )");
- test();
+writeHeaderToLog( SECTION + " The unsigned right shift operator ( >>> )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+var addexp = 0;
+var power = 0;
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( power = 0; power <= 32; power++ ) {
+ shiftexp = Math.pow( 2, power );
+
+ for ( addexp = 0; addexp <= 32; addexp++ ) {
+ new TestCase( SECTION,
+ shiftexp + " >>> " + addexp,
+ UnsignedRightShift( shiftexp, addexp ),
+ shiftexp >>> addexp );
+ }
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- var addexp = 0;
- var power = 0;
+test();
- for ( power = 0; power <= 32; power++ ) {
- shiftexp = Math.pow( 2, power );
-
- for ( addexp = 0; addexp <= 32; addexp++ ) {
- array[item++] = new TestCase( SECTION,
- shiftexp + " >>> " + addexp,
- UnsignedRightShift( shiftexp, addexp ),
- shiftexp >>> addexp );
- }
- }
-
- return ( array );
-}
function ToInteger( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( n != n ) {
- return 0;
- }
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
- return n;
- }
- return ( sign * Math.floor(Math.abs(n)) );
+ if ( n != n ) {
+ return 0;
+ }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY ) {
+ return n;
+ }
+ return ( sign * Math.floor(Math.abs(n)) );
}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- return ( n );
+ return ( n );
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
function ToUint16( n ) {
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
+ n = ( sign * Math.floor( Math.abs(n) ) ) % Math.pow(2,16);
- if (n <0) {
- n += Math.pow(2,16);
- }
+ if (n <0) {
+ n += Math.pow(2,16);
+ }
- return ( n );
+ return ( n );
}
function Mask( b, n ) {
- b = ToUint32BitString( b );
- b = b.substring( b.length - n );
- b = ToUint32Decimal( b );
- return ( b );
+ b = ToUint32BitString( b );
+ b = b.substring( b.length - n );
+ b = ToUint32Decimal( b );
+ return ( b );
}
function ToUint32BitString( n ) {
- var b = "";
- for ( p = 31; p >=0; p-- ) {
- if ( n >= Math.pow(2,p) ) {
- b += "1";
- n -= Math.pow(2,p);
- } else {
- b += "0";
- }
+ var b = "";
+ for ( p = 31; p >=0; p-- ) {
+ if ( n >= Math.pow(2,p) ) {
+ b += "1";
+ n -= Math.pow(2,p);
+ } else {
+ b += "0";
}
- return b;
+ }
+ return b;
}
function ToInt32BitString( n ) {
- var b = "";
- var sign = ( n < 0 ) ? -1 : 1;
+ var b = "";
+ var sign = ( n < 0 ) ? -1 : 1;
- b += ( sign == 1 ) ? "0" : "1";
+ b += ( sign == 1 ) ? "0" : "1";
- for ( p = 30; p >=0; p-- ) {
- if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
- b += ( sign == 1 ) ? "1" : "0";
- n -= sign * Math.pow( 2, p );
- } else {
- b += ( sign == 1 ) ? "0" : "1";
- }
+ for ( p = 30; p >=0; p-- ) {
+ if ( (sign == 1 ) ? sign * n >= Math.pow(2,p) : sign * n > Math.pow(2,p) ) {
+ b += ( sign == 1 ) ? "1" : "0";
+ n -= sign * Math.pow( 2, p );
+ } else {
+ b += ( sign == 1 ) ? "0" : "1";
}
+ }
- return b;
+ return b;
}
function ToInt32Decimal( bin ) {
- var r = 0;
- var sign;
+ var r = 0;
+ var sign;
- if ( Number(bin.charAt(0)) == 0 ) {
- sign = 1;
- r = 0;
- } else {
- sign = -1;
- r = -(Math.pow(2,31));
- }
+ if ( Number(bin.charAt(0)) == 0 ) {
+ sign = 1;
+ r = 0;
+ } else {
+ sign = -1;
+ r = -(Math.pow(2,31));
+ }
- for ( var j = 0; j < 31; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ for ( var j = 0; j < 31; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ }
- return r;
+ return r;
}
function ToUint32Decimal( bin ) {
- var r = 0;
+ var r = 0;
- for ( l = bin.length; l < 32; l++ ) {
- bin = "0" + bin;
- }
+ for ( l = bin.length; l < 32; l++ ) {
+ bin = "0" + bin;
+ }
- for ( j = 0; j < 32; j++ ) {
- r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
+ for ( j = 0; j < 32; j++ ) {
+ r += Math.pow( 2, j ) * Number(bin.charAt(31-j));
- }
+ }
- return r;
+ return r;
}
function RShift( s, a ) {
- s = ToUint32BitString( s );
- for ( z = 0; z < a; z++ ) {
- s = "0" + s;
- }
- s = s.substring( 0, s.length - a );
+ s = ToUint32BitString( s );
+ for ( z = 0; z < a; z++ ) {
+ s = "0" + s;
+ }
+ s = s.substring( 0, s.length - a );
- return ToUint32Decimal(s);
+ return ToUint32Decimal(s);
}
function UnsignedRightShift( s, a ) {
- s = ToUint32( s );
- a = ToUint32( a );
- a = Mask( a, 5 );
- return ( RShift( s, a ) );
+ s = ToUint32( s );
+ a = ToUint32( a );
+ a = Mask( a, 5 );
+ return ( RShift( s, a ) );
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.8.1.js b/mozilla/js/tests/ecma/Expressions/11.8.1.js
index 3750463c5b1..e5ab8edb0cf 100644
--- a/mozilla/js/tests/ecma/Expressions/11.8.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.8.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,103 +35,85 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.8.1.js
- ECMA Section: 11.8.1 The less-than operator ( < )
- Description:
+ File Name: 11.8.1.js
+ ECMA Section: 11.8.1 The less-than operator ( < )
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.8.1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.8.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The less-than operator ( < )");
- test();
+writeHeaderToLog( SECTION + " The less-than operator ( < )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "true < false", false, true < false );
+new TestCase( SECTION, "false < true", true, false < true );
+new TestCase( SECTION, "false < false", false, false < false );
+new TestCase( SECTION, "true < true", false, true < true );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) );
- array[item++] = new TestCase( SECTION, "true < false", false, true < false );
- array[item++] = new TestCase( SECTION, "false < true", true, false < true );
- array[item++] = new TestCase( SECTION, "false < false", false, false < false );
- array[item++] = new TestCase( SECTION, "true < true", false, true < true );
+new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(true)", false, new Boolean(true) < new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) < new Boolean(false)", false, new Boolean(true) < new Boolean(false) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(true)", true, new Boolean(false) < new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) < new Boolean(false)", false, new Boolean(false) < new Boolean(false) );
+new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) );
- array[item++] = new TestCase( SECTION, "new MyObject(Infinity) < new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) < new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) < new MyObject( Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(true)", true, new MyValueObject(false) < new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(true) < new MyValueObject(true)", false, new MyValueObject(true) < new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) < new MyValueObject(false)", false, new MyValueObject(false) < new MyValueObject(false) );
+new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN );
+new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN );
+new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(true)", true, new MyStringObject(false) < new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(true) < new MyStringObject(true)", false, new MyStringObject(true) < new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) < new MyStringObject(false)", false, new MyStringObject(false) < new MyStringObject(false) );
+new TestCase( SECTION, "0 < -0", false, 0 < -0 );
+new TestCase( SECTION, "-0 < 0", false, -0 < 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN < Number.NaN", false, Number.NaN < Number.NaN );
- array[item++] = new TestCase( SECTION, "0 < Number.NaN", false, 0 < Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN < 0", false, Number.NaN < 0 );
+new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 );
+new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 < -0", false, 0 < -0 );
- array[item++] = new TestCase( SECTION, "-0 < 0", false, -0 < 0 );
+new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity < 0", false, Number.POSITIVE_INFINITY < 0 );
- array[item++] = new TestCase( SECTION, "Infinity < Number.MAX_VALUE", false, Number.POSITIVE_INFINITY < Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Infinity < Infinity", false, Number.POSITIVE_INFINITY < Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 < Infinity", true, 0 < Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < Infinity", true, Number.MAX_VALUE < Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 );
+new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "0 < -Infinity", false, 0 < Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE < -Infinity", false, Number.MAX_VALUE < Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Infinity < -Infinity", false, Number.NEGATIVE_INFINITY < Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' );
+new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' );
+new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' );
+new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' );
+new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' );
+new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' );
- array[item++] = new TestCase( SECTION, "-Infinity < 0", true, Number.NEGATIVE_INFINITY < 0 );
- array[item++] = new TestCase( SECTION, "-Infinity < -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY < -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "-Infinity < Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY < Number.MIN_VALUE );
+test();
- array[item++] = new TestCase( SECTION, "'string' < 'string'", false, 'string' < 'string' );
- array[item++] = new TestCase( SECTION, "'astring' < 'string'", true, 'astring' < 'string' );
- array[item++] = new TestCase( SECTION, "'strings' < 'stringy'", true, 'strings' < 'stringy' );
- array[item++] = new TestCase( SECTION, "'strings' < 'stringier'", false, 'strings' < 'stringier' );
- array[item++] = new TestCase( SECTION, "'string' < 'astring'", false, 'string' < 'astring' );
- array[item++] = new TestCase( SECTION, "'string' < 'strings'", true, 'string' < 'strings' );
-
- return ( array );
-}
function MyObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function( "return this.value +''" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
}
function MyValueObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
}
function MyStringObject(value) {
- this.value = value;
- this.toString = new Function( "return this.value +''" );
-}
\ No newline at end of file
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.8.2.js b/mozilla/js/tests/ecma/Expressions/11.8.2.js
index 3e9909cb615..fc44dca5f88 100644
--- a/mozilla/js/tests/ecma/Expressions/11.8.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.8.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,104 +35,85 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.8.2.js
- ECMA Section: 11.8.2 The greater-than operator ( > )
- Description:
+ File Name: 11.8.2.js
+ ECMA Section: 11.8.2 The greater-than operator ( > )
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.8.2";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.8.2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The greater-than operator ( > )");
- test();
+writeHeaderToLog( SECTION + " The greater-than operator ( > )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "true > false", true, true > false );
+new TestCase( SECTION, "false > true", false, false > true );
+new TestCase( SECTION, "false > false", false, false > false );
+new TestCase( SECTION, "true > true", false, true > true );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) );
- array[item++] = new TestCase( SECTION, "true > false", true, true > false );
- array[item++] = new TestCase( SECTION, "false > true", false, false > true );
- array[item++] = new TestCase( SECTION, "false > false", false, false > false );
- array[item++] = new TestCase( SECTION, "true > true", false, true > true );
+new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(true)", false, new Boolean(true) > new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) > new Boolean(false)", true, new Boolean(true) > new Boolean(false) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(true)", false, new Boolean(false) > new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) > new Boolean(false)", false, new Boolean(false) > new Boolean(false) );
+new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) );
- array[item++] = new TestCase( SECTION, "new MyObject(Infinity) > new MyObject(Infinity)", false, new MyObject( Number.POSITIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) > new MyObject(-Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) > new MyObject( Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(true)", false, new MyValueObject(false) > new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(true) > new MyValueObject(true)", false, new MyValueObject(true) > new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) > new MyValueObject(false)", false, new MyValueObject(false) > new MyValueObject(false) );
+new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN );
+new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN );
+new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(true)", false, new MyStringObject(false) > new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(true) > new MyStringObject(true)", false, new MyStringObject(true) > new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) > new MyStringObject(false)", false, new MyStringObject(false) > new MyStringObject(false) );
+new TestCase( SECTION, "0 > -0", false, 0 > -0 );
+new TestCase( SECTION, "-0 > 0", false, -0 > 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN > Number.NaN", false, Number.NaN > Number.NaN );
- array[item++] = new TestCase( SECTION, "0 > Number.NaN", false, 0 > Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN > 0", false, Number.NaN > 0 );
+new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 );
+new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 > -0", false, 0 > -0 );
- array[item++] = new TestCase( SECTION, "-0 > 0", false, -0 > 0 );
+new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity > 0", true, Number.POSITIVE_INFINITY > 0 );
- array[item++] = new TestCase( SECTION, "Infinity > Number.MAX_VALUE", true, Number.POSITIVE_INFINITY > Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Infinity > Infinity", false, Number.POSITIVE_INFINITY > Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 > Infinity", false, 0 > Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > Infinity", false, Number.MAX_VALUE > Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 );
+new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "0 > -Infinity", true, 0 > Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE > -Infinity", true, Number.MAX_VALUE > Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Infinity > -Infinity", false, Number.NEGATIVE_INFINITY > Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
- array[item++] = new TestCase( SECTION, "-Infinity > 0", false, Number.NEGATIVE_INFINITY > 0 );
- array[item++] = new TestCase( SECTION, "-Infinity > -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY > -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "-Infinity > Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY > Number.MIN_VALUE );
+test();
- array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
- array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
- array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
- array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
- array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
- array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
-
-
- return ( array );
-}
function MyObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function( "return this.value +''" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
}
function MyValueObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
}
function MyStringObject(value) {
- this.value = value;
- this.toString = new Function( "return this.value +''" );
-}
\ No newline at end of file
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.8.3.js b/mozilla/js/tests/ecma/Expressions/11.8.3.js
index 761f2587065..bebfc9e0be4 100644
--- a/mozilla/js/tests/ecma/Expressions/11.8.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.8.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,102 +35,84 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.8.3.js
- ECMA Section: 11.8.3 The less-than-or-equal operator ( <= )
- Description:
+ File Name: 11.8.3.js
+ ECMA Section: 11.8.3 The less-than-or-equal operator ( <= )
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.8.1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.8.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )");
- test();
+writeHeaderToLog( SECTION + " The less-than-or-equal operator ( <= )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "true <= false", false, true <= false );
+new TestCase( SECTION, "false <= true", true, false <= true );
+new TestCase( SECTION, "false <= false", true, false <= false );
+new TestCase( SECTION, "true <= true", true, true <= true );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) );
- array[item++] = new TestCase( SECTION, "true <= false", false, true <= false );
- array[item++] = new TestCase( SECTION, "false <= true", true, false <= true );
- array[item++] = new TestCase( SECTION, "false <= false", true, false <= false );
- array[item++] = new TestCase( SECTION, "true <= true", true, true <= true );
+new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(true)", true, new Boolean(true) <= new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) <= new Boolean(false)", false, new Boolean(true) <= new Boolean(false) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(true)", true, new Boolean(false) <= new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) <= new Boolean(false)", true, new Boolean(false) <= new Boolean(false) );
+new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) );
- array[item++] = new TestCase( SECTION, "new MyObject(Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) <= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) <= new MyObject( Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(true)", true, new MyValueObject(false) <= new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(true) <= new MyValueObject(true)", true, new MyValueObject(true) <= new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) <= new MyValueObject(false)", true, new MyValueObject(false) <= new MyValueObject(false) );
+new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN );
+new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN );
+new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(true)", true, new MyStringObject(false) <= new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(true) <= new MyStringObject(true)", true, new MyStringObject(true) <= new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) <= new MyStringObject(false)", true, new MyStringObject(false) <= new MyStringObject(false) );
+new TestCase( SECTION, "0 <= -0", true, 0 <= -0 );
+new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN <= Number.NaN", false, Number.NaN <= Number.NaN );
- array[item++] = new TestCase( SECTION, "0 <= Number.NaN", false, 0 <= Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN <= 0", false, Number.NaN <= 0 );
+new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 );
+new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 <= -0", true, 0 <= -0 );
- array[item++] = new TestCase( SECTION, "-0 <= 0", true, -0 <= 0 );
+new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity <= 0", false, Number.POSITIVE_INFINITY <= 0 );
- array[item++] = new TestCase( SECTION, "Infinity <= Number.MAX_VALUE", false, Number.POSITIVE_INFINITY <= Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Infinity <= Infinity", true, Number.POSITIVE_INFINITY <= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 <= Infinity", true, 0 <= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= Infinity", true, Number.MAX_VALUE <= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 );
+new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "0 <= -Infinity", false, 0 <= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE <= -Infinity", false, Number.MAX_VALUE <= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Infinity <= -Infinity", true, Number.NEGATIVE_INFINITY <= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' );
+new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' );
+new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' );
+new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' );
+new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' );
+new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' );
- array[item++] = new TestCase( SECTION, "-Infinity <= 0", true, Number.NEGATIVE_INFINITY <= 0 );
- array[item++] = new TestCase( SECTION, "-Infinity <= -Number.MAX_VALUE", true, Number.NEGATIVE_INFINITY <= -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "-Infinity <= Number.MIN_VALUE", true, Number.NEGATIVE_INFINITY <= Number.MIN_VALUE );
+test();
- array[item++] = new TestCase( SECTION, "'string' <= 'string'", true, 'string' <= 'string' );
- array[item++] = new TestCase( SECTION, "'astring' <= 'string'", true, 'astring' <= 'string' );
- array[item++] = new TestCase( SECTION, "'strings' <= 'stringy'", true, 'strings' <= 'stringy' );
- array[item++] = new TestCase( SECTION, "'strings' <= 'stringier'", false, 'strings' <= 'stringier' );
- array[item++] = new TestCase( SECTION, "'string' <= 'astring'", false, 'string' <= 'astring' );
- array[item++] = new TestCase( SECTION, "'string' <= 'strings'", true, 'string' <= 'strings' );
-
- return ( array );
-}
function MyObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function( "return this.value +''" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
}
function MyValueObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
}
function MyStringObject(value) {
- this.value = value;
- this.toString = new Function( "return this.value +''" );
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
}
diff --git a/mozilla/js/tests/ecma/Expressions/11.8.4.js b/mozilla/js/tests/ecma/Expressions/11.8.4.js
index f8aa977d624..59b3673b514 100644
--- a/mozilla/js/tests/ecma/Expressions/11.8.4.js
+++ b/mozilla/js/tests/ecma/Expressions/11.8.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,104 +35,85 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.8.4.js
- ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= )
- Description:
+ File Name: 11.8.4.js
+ ECMA Section: 11.8.4 The greater-than-or-equal operator ( >= )
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.8.4";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "11.8.4";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )");
- test();
+writeHeaderToLog( SECTION + " The greater-than-or-equal operator ( >= )");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "true >= false", true, true >= false );
+new TestCase( SECTION, "false >= true", false, false >= true );
+new TestCase( SECTION, "false >= false", true, false >= false );
+new TestCase( SECTION, "true >= true", true, true >= true );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) );
- array[item++] = new TestCase( SECTION, "true >= false", true, true >= false );
- array[item++] = new TestCase( SECTION, "false >= true", false, false >= true );
- array[item++] = new TestCase( SECTION, "false >= false", true, false >= false );
- array[item++] = new TestCase( SECTION, "true >= true", true, true >= true );
+new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(true)", true, new Boolean(true) >= new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) >= new Boolean(false)", true, new Boolean(true) >= new Boolean(false) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(true)", false, new Boolean(false) >= new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) >= new Boolean(false)", true, new Boolean(false) >= new Boolean(false) );
+new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) );
+new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) );
- array[item++] = new TestCase( SECTION, "new MyObject(Infinity) >= new MyObject(Infinity)", true, new MyObject( Number.POSITIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(Infinity)", false, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "new MyObject(-Infinity) >= new MyObject(-Infinity)", true, new MyObject( Number.NEGATIVE_INFINITY ) >= new MyObject( Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) );
+new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(true)", false, new MyValueObject(false) >= new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(true) >= new MyValueObject(true)", true, new MyValueObject(true) >= new MyValueObject(true) );
- array[item++] = new TestCase( SECTION, "new MyValueObject(false) >= new MyValueObject(false)", true, new MyValueObject(false) >= new MyValueObject(false) );
+new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN );
+new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN );
+new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(true)", false, new MyStringObject(false) >= new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(true) >= new MyStringObject(true)", true, new MyStringObject(true) >= new MyStringObject(true) );
- array[item++] = new TestCase( SECTION, "new MyStringObject(false) >= new MyStringObject(false)", true, new MyStringObject(false) >= new MyStringObject(false) );
+new TestCase( SECTION, "0 >= -0", true, 0 >= -0 );
+new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN >= Number.NaN", false, Number.NaN >= Number.NaN );
- array[item++] = new TestCase( SECTION, "0 >= Number.NaN", false, 0 >= Number.NaN );
- array[item++] = new TestCase( SECTION, "Number.NaN >= 0", false, Number.NaN >= 0 );
+new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 );
+new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE );
+new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 >= -0", true, 0 >= -0 );
- array[item++] = new TestCase( SECTION, "-0 >= 0", true, -0 >= 0 );
+new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity >= 0", true, Number.POSITIVE_INFINITY >= 0 );
- array[item++] = new TestCase( SECTION, "Infinity >= Number.MAX_VALUE", true, Number.POSITIVE_INFINITY >= Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Infinity >= Infinity", true, Number.POSITIVE_INFINITY >= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "0 >= Infinity", false, 0 >= Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= Infinity", false, Number.MAX_VALUE >= Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 );
+new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE );
+new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "0 >= -Infinity", true, 0 >= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE >= -Infinity", true, Number.MAX_VALUE >= Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "-Infinity >= -Infinity", true, Number.NEGATIVE_INFINITY >= Number.NEGATIVE_INFINITY );
+new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
+new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
+new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
+new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
+new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
+new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
- array[item++] = new TestCase( SECTION, "-Infinity >= 0", false, Number.NEGATIVE_INFINITY >= 0 );
- array[item++] = new TestCase( SECTION, "-Infinity >= -Number.MAX_VALUE", false, Number.NEGATIVE_INFINITY >= -Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "-Infinity >= Number.MIN_VALUE", false, Number.NEGATIVE_INFINITY >= Number.MIN_VALUE );
+test();
- array[item++] = new TestCase( SECTION, "'string' > 'string'", false, 'string' > 'string' );
- array[item++] = new TestCase( SECTION, "'astring' > 'string'", false, 'astring' > 'string' );
- array[item++] = new TestCase( SECTION, "'strings' > 'stringy'", false, 'strings' > 'stringy' );
- array[item++] = new TestCase( SECTION, "'strings' > 'stringier'", true, 'strings' > 'stringier' );
- array[item++] = new TestCase( SECTION, "'string' > 'astring'", true, 'string' > 'astring' );
- array[item++] = new TestCase( SECTION, "'string' > 'strings'", false, 'string' > 'strings' );
-
-
- return ( array );
-}
function MyObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function( "return this.value +''" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = new Function( "return this.value +''" );
}
function MyValueObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
}
function MyStringObject(value) {
- this.value = value;
- this.toString = new Function( "return this.value +''" );
-}
\ No newline at end of file
+ this.value = value;
+ this.toString = new Function( "return this.value +''" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.9.1.js b/mozilla/js/tests/ecma/Expressions/11.9.1.js
index 07b04635e3c..759cc796a04 100644
--- a/mozilla/js/tests/ecma/Expressions/11.9.1.js
+++ b/mozilla/js/tests/ecma/Expressions/11.9.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,144 +35,123 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.9.1.js
- ECMA Section: 11.9.1 The equals operator ( == )
- Description:
+ File Name: 11.9.1.js
+ ECMA Section: 11.9.1 The equals operator ( == )
+ Description:
- The production EqualityExpression:
- EqualityExpression == RelationalExpression is evaluated as follows:
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
- 1. Evaluate EqualityExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate RelationalExpression.
- 4. Call GetValue(Result(3)).
- 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
- 6. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.9.1";
- var VERSION = "ECMA_1";
- startTest();
- var BUGNUMBER="77391";
+var SECTION = "11.9.1";
+var VERSION = "ECMA_1";
+startTest();
+var BUGNUMBER="77391";
+
+writeHeaderToLog( SECTION + " The equals operator ( == )");
+
+// type x and type y are the same. if type x is undefined or null, return true
+
+new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+new TestCase( SECTION, "null == null", true, null == null );
+
+// if x is NaN, return false. if y is NaN, return false.
+
+new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+
+// if x is the same number value as y, return true.
+
+new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+
+new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
+
+// return false.
+
+new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
+
+// type x and type y are the same type, but not numbers.
- var testcases = getTestCases();
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
- writeHeaderToLog( SECTION + " The equals operator ( == )");
- test();
+new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// x and y are booleans. return true if both are true or both are false.
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "true == true", true, true == true );
+new TestCase( SECTION, "false == false", true, false == false );
+new TestCase( SECTION, "true == false", false, true == false );
+new TestCase( SECTION, "false == true", false, false == true );
- // type x and type y are the same. if type x is undefined or null, return true
+// return true if x and y refer to the same object. otherwise return false.
- array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
- array[item++] = new TestCase( SECTION, "null == null", true, null == null );
-
- // if x is NaN, return false. if y is NaN, return false.
-
- array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
- array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
-
- // if x is the same number value as y, return true.
-
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
-
- // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
-
- array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 );
- array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 );
- array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
- array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
-
- // return false.
-
- array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
- array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
-
- // type x and type y are the same type, but not numbers.
+new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
- // x and y are strings. return true if x and y are exactly the same sequence of characters.
- // otherwise, return false.
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
- // x and y are booleans. return true if both are true or both are false.
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
- array[item++] = new TestCase( SECTION, "true == true", true, true == true );
- array[item++] = new TestCase( SECTION, "false == false", true, false == false );
- array[item++] = new TestCase( SECTION, "true == false", false, true == false );
- array[item++] = new TestCase( SECTION, "false == true", false, false == true );
+new TestCase( SECTION, "null == void 0", true, null == void 0 );
+new TestCase( SECTION, "void 0 == null", true, void 0 == null );
- // return true if x and y refer to the same object. otherwise return false.
+// if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
- array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
- array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
- // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 );
- array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
- // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
-
- array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
- array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
- array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
- array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
-
-
- array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
-
- array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
- array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
-
- array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
-
- array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
- array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
-
- return ( array );
-}
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.9.2.js b/mozilla/js/tests/ecma/Expressions/11.9.2.js
index 36ddbd1399e..482d1518421 100644
--- a/mozilla/js/tests/ecma/Expressions/11.9.2.js
+++ b/mozilla/js/tests/ecma/Expressions/11.9.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,143 +35,123 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.9.2.js
- ECMA Section: 11.9.2 The equals operator ( == )
- Description:
+ File Name: 11.9.2.js
+ ECMA Section: 11.9.2 The equals operator ( == )
+ Description:
- The production EqualityExpression:
- EqualityExpression == RelationalExpression is evaluated as follows:
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
- 1. Evaluate EqualityExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate RelationalExpression.
- 4. Call GetValue(Result(3)).
- 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
- 6. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.9.2";
- var VERSION = "ECMA_1";
- startTest();
- var BUGNUMBER="77391";
+var SECTION = "11.9.2";
+var VERSION = "ECMA_1";
+startTest();
+var BUGNUMBER="77391";
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " The equals operator ( == )");
- writeHeaderToLog( SECTION + " The equals operator ( == )");
- test();
+// type x and type y are the same. if type x is undefined or null, return true
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 );
+new TestCase( SECTION, "null == null", false, null != null );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// if x is NaN, return false. if y is NaN, return false.
- // type x and type y are the same. if type x is undefined or null, return true
+new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN );
+new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 );
+new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN );
+new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN );
- array[item++] = new TestCase( SECTION, "void 0 == void 0", false, void 0 != void 0 );
- array[item++] = new TestCase( SECTION, "null == null", false, null != null );
+// if x is the same number value as y, return true.
- // if x is NaN, return false. if y is NaN, return false.
+new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "NaN != NaN", true, Number.NaN != Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN != 0", true, Number.NaN != 0 );
- array[item++] = new TestCase( SECTION, "0 != NaN", true, 0 != Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN != Infinity", true, Number.NaN != Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity != NaN", true, Number.POSITIVE_INFINITY != Number.NaN );
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
- // if x is the same number value as y, return true.
+new TestCase( SECTION, "0 != 0", false, 0 != 0 );
+new TestCase( SECTION, "0 != -0", false, 0 != -0 );
+new TestCase( SECTION, "-0 != 0", false, -0 != 0 );
+new TestCase( SECTION, "-0 != -0", false, -0 != -0 );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE != Number.MAX_VALUE", false, Number.MAX_VALUE != Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE != Number.MIN_VALUE", false, Number.MIN_VALUE != Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY", false, Number.POSITIVE_INFINITY != Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY", false, Number.NEGATIVE_INFINITY != Number.NEGATIVE_INFINITY );
+// return false.
- // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 );
+new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 );
+new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 );
+new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 );
- array[item++] = new TestCase( SECTION, "0 != 0", false, 0 != 0 );
- array[item++] = new TestCase( SECTION, "0 != -0", false, 0 != -0 );
- array[item++] = new TestCase( SECTION, "-0 != 0", false, -0 != 0 );
- array[item++] = new TestCase( SECTION, "-0 != -0", false, -0 != -0 );
-
- // return false.
-
- array[item++] = new TestCase( SECTION, "0.9 != 1", true, 0.9 != 1 );
- array[item++] = new TestCase( SECTION, "0.999999 != 1", true, 0.999999 != 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999 != 1", true, 0.9999999999 != 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999999 != 1", true, 0.9999999999999 != 1 );
-
- // type x and type y are the same type, but not numbers.
+// type x and type y are the same type, but not numbers.
- // x and y are strings. return true if x and y are exactly the same sequence of characters.
- // otherwise, return false.
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
- array[item++] = new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" );
+new TestCase( SECTION, "'hello' != 'hello'", false, "hello" != "hello" );
- // x and y are booleans. return true if both are true or both are false.
+// x and y are booleans. return true if both are true or both are false.
- array[item++] = new TestCase( SECTION, "true != true", false, true != true );
- array[item++] = new TestCase( SECTION, "false != false", false, false != false );
- array[item++] = new TestCase( SECTION, "true != false", true, true != false );
- array[item++] = new TestCase( SECTION, "false != true", true, false != true );
+new TestCase( SECTION, "true != true", false, true != true );
+new TestCase( SECTION, "false != false", false, false != false );
+new TestCase( SECTION, "true != false", true, true != false );
+new TestCase( SECTION, "false != true", true, false != true );
- // return true if x and y refer to the same object. otherwise return false.
+// return true if x and y refer to the same object. otherwise return false.
- array[item++] = new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+new TestCase( SECTION, "new MyObject(true) != new MyObject(true)", true, new MyObject(true) != new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
- array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") );
- array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z != y", false, eval("x = new MyObject(true); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z != y", false, eval("x = new MyObject(false); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z != y", false, eval("x = new Boolean(true); y = x; z = x; z != y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z != y", false, eval("x = new Boolean(false); y = x; z = x; z != y") );
- array[item++] = new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
+new TestCase( SECTION, "new Boolean(true) != new Boolean(true)", true, new Boolean(true) != new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) != new Boolean(false)", true, new Boolean(false) != new Boolean(false) );
- // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
- array[item++] = new TestCase( SECTION, "null != void 0", false, null != void 0 );
- array[item++] = new TestCase( SECTION, "void 0 != null", false, void 0 != null );
+new TestCase( SECTION, "null != void 0", false, null != void 0 );
+new TestCase( SECTION, "void 0 != null", false, void 0 != null );
- // if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y).
+// if type(x) is Number and type(y) is string, return the result of the comparison x != ToNumber(y).
- array[item++] = new TestCase( SECTION, "1 != '1'", false, 1 != '1' );
- array[item++] = new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' );
- array[item++] = new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" );
- array[item++] = new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" );
+new TestCase( SECTION, "1 != '1'", false, 1 != '1' );
+new TestCase( SECTION, "255 != '0xff'", false, 255 != '0xff' );
+new TestCase( SECTION, "0 != '\r'", false, 0 != "\r" );
+new TestCase( SECTION, "1e19 != '1e19'", false, 1e19 != "1e19" );
- array[item++] = new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) != true", false, true != new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) != true", false, true != new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false );
- array[item++] = new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false );
+new TestCase( SECTION, "new Boolean(false) != false", false, new Boolean(false) != false );
+new TestCase( SECTION, "new MyObject(false) != false", false, new MyObject(false) != false );
- array[item++] = new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) );
- array[item++] = new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) );
+new TestCase( SECTION, "true != new Boolean(true)", false, true != new Boolean(true) );
+new TestCase( SECTION, "true != new MyObject(true)", false, true != new MyObject(true) );
- array[item++] = new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) );
- array[item++] = new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) );
+new TestCase( SECTION, "false != new Boolean(false)", false, false != new Boolean(false) );
+new TestCase( SECTION, "false != new MyObject(false)", false, false != new MyObject(false) );
- return ( array );
-}
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/11.9.3.js b/mozilla/js/tests/ecma/Expressions/11.9.3.js
index 2d3ef9ad8eb..35751d71c2a 100644
--- a/mozilla/js/tests/ecma/Expressions/11.9.3.js
+++ b/mozilla/js/tests/ecma/Expressions/11.9.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,143 +35,123 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 11.9.3.js
- ECMA Section: 11.9.3 The equals operator ( == )
- Description:
+ File Name: 11.9.3.js
+ ECMA Section: 11.9.3 The equals operator ( == )
+ Description:
- The production EqualityExpression:
- EqualityExpression == RelationalExpression is evaluated as follows:
+ The production EqualityExpression:
+ EqualityExpression == RelationalExpression is evaluated as follows:
- 1. Evaluate EqualityExpression.
- 2. Call GetValue(Result(1)).
- 3. Evaluate RelationalExpression.
- 4. Call GetValue(Result(3)).
- 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
- 6. Return Result(5).
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. Evaluate EqualityExpression.
+ 2. Call GetValue(Result(1)).
+ 3. Evaluate RelationalExpression.
+ 4. Call GetValue(Result(3)).
+ 5. Perform the comparison Result(4) == Result(2). (See section 11.9.3)
+ 6. Return Result(5).
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "11.9.3";
- var VERSION = "ECMA_1";
- startTest();
- var BUGNUMBER="77391";
+var SECTION = "11.9.3";
+var VERSION = "ECMA_1";
+startTest();
+var BUGNUMBER="77391";
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " The equals operator ( == )");
- writeHeaderToLog( SECTION + " The equals operator ( == )");
- test();
+// type x and type y are the same. if type x is undefined or null, return true
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
+new TestCase( SECTION, "null == null", true, null == null );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// if x is NaN, return false. if y is NaN, return false.
- // type x and type y are the same. if type x is undefined or null, return true
+new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
+new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
+new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
+new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
- array[item++] = new TestCase( SECTION, "void 0 = void 0", true, void 0 == void 0 );
- array[item++] = new TestCase( SECTION, "null == null", true, null == null );
+// if x is the same number value as y, return true.
- // if x is NaN, return false. if y is NaN, return false.
+new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
+new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "NaN == NaN", false, Number.NaN == Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN == 0", false, Number.NaN == 0 );
- array[item++] = new TestCase( SECTION, "0 == NaN", false, 0 == Number.NaN );
- array[item++] = new TestCase( SECTION, "NaN == Infinity", false, Number.NaN == Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Infinity == NaN", false, Number.POSITIVE_INFINITY == Number.NaN );
+// if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
- // if x is the same number value as y, return true.
+new TestCase( SECTION, "0 == 0", true, 0 == 0 );
+new TestCase( SECTION, "0 == -0", true, 0 == -0 );
+new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
+new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE == Number.MAX_VALUE", true, Number.MAX_VALUE == Number.MAX_VALUE );
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE == Number.MIN_VALUE", true, Number.MIN_VALUE == Number.MIN_VALUE );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY", true, Number.POSITIVE_INFINITY == Number.POSITIVE_INFINITY );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY", true, Number.NEGATIVE_INFINITY == Number.NEGATIVE_INFINITY );
+// return false.
- // if xis 0 and y is -0, return true. if x is -0 and y is 0, return true.
+new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
+new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
+new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
+new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
- array[item++] = new TestCase( SECTION, "0 == 0", true, 0 == 0 );
- array[item++] = new TestCase( SECTION, "0 == -0", true, 0 == -0 );
- array[item++] = new TestCase( SECTION, "-0 == 0", true, -0 == 0 );
- array[item++] = new TestCase( SECTION, "-0 == -0", true, -0 == -0 );
-
- // return false.
-
- array[item++] = new TestCase( SECTION, "0.9 == 1", false, 0.9 == 1 );
- array[item++] = new TestCase( SECTION, "0.999999 == 1", false, 0.999999 == 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999 == 1", false, 0.9999999999 == 1 );
- array[item++] = new TestCase( SECTION, "0.9999999999999 == 1", false, 0.9999999999999 == 1 );
-
- // type x and type y are the same type, but not numbers.
+// type x and type y are the same type, but not numbers.
- // x and y are strings. return true if x and y are exactly the same sequence of characters.
- // otherwise, return false.
+// x and y are strings. return true if x and y are exactly the same sequence of characters.
+// otherwise, return false.
- array[item++] = new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
+new TestCase( SECTION, "'hello' == 'hello'", true, "hello" == "hello" );
- // x and y are booleans. return true if both are true or both are false.
+// x and y are booleans. return true if both are true or both are false.
- array[item++] = new TestCase( SECTION, "true == true", true, true == true );
- array[item++] = new TestCase( SECTION, "false == false", true, false == false );
- array[item++] = new TestCase( SECTION, "true == false", false, true == false );
- array[item++] = new TestCase( SECTION, "false == true", false, false == true );
+new TestCase( SECTION, "true == true", true, true == true );
+new TestCase( SECTION, "false == false", true, false == false );
+new TestCase( SECTION, "true == false", false, true == false );
+new TestCase( SECTION, "false == true", false, false == true );
- // return true if x and y refer to the same object. otherwise return false.
+// return true if x and y refer to the same object. otherwise return false.
- array[item++] = new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+new TestCase( SECTION, "new MyObject(true) == new MyObject(true)", false, new MyObject(true) == new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
- array[item++] = new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new MyObject(true); y = x; z = x; z == y", true, eval("x = new MyObject(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new MyObject(false); y = x; z = x; z == y", true, eval("x = new MyObject(false); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(true); y = x; z = x; z == y", true, eval("x = new Boolean(true); y = x; z = x; z == y") );
+new TestCase( SECTION, "x = new Boolean(false); y = x; z = x; z == y", true, eval("x = new Boolean(false); y = x; z = x; z == y") );
- array[item++] = new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
+new TestCase( SECTION, "new Boolean(true) == new Boolean(true)", false, new Boolean(true) == new Boolean(true) );
+new TestCase( SECTION, "new Boolean(false) == new Boolean(false)", false, new Boolean(false) == new Boolean(false) );
- // if x is null and y is undefined, return true. if x is undefined and y is null return true.
+// if x is null and y is undefined, return true. if x is undefined and y is null return true.
- array[item++] = new TestCase( SECTION, "null == void 0", true, null == void 0 );
- array[item++] = new TestCase( SECTION, "void 0 == null", true, void 0 == null );
+new TestCase( SECTION, "null == void 0", true, null == void 0 );
+new TestCase( SECTION, "void 0 == null", true, void 0 == null );
- // if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
+// if type(x) is Number and type(y) is string, return the result of the comparison x == ToNumber(y).
- array[item++] = new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
- array[item++] = new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
- array[item++] = new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
- array[item++] = new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
+new TestCase( SECTION, "1 == '1'", true, 1 == '1' );
+new TestCase( SECTION, "255 == '0xff'", true, 255 == '0xff' );
+new TestCase( SECTION, "0 == '\r'", true, 0 == "\r" );
+new TestCase( SECTION, "1e19 == '1e19'", true, 1e19 == "1e19" );
- array[item++] = new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
+new TestCase( SECTION, "new Boolean(true) == true", true, true == new Boolean(true) );
+new TestCase( SECTION, "new MyObject(true) == true", true, true == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
- array[item++] = new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
+new TestCase( SECTION, "new Boolean(false) == false", true, new Boolean(false) == false );
+new TestCase( SECTION, "new MyObject(false) == false", true, new MyObject(false) == false );
- array[item++] = new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
- array[item++] = new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
+new TestCase( SECTION, "true == new Boolean(true)", true, true == new Boolean(true) );
+new TestCase( SECTION, "true == new MyObject(true)", true, true == new MyObject(true) );
- array[item++] = new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
- array[item++] = new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
+new TestCase( SECTION, "false == new Boolean(false)", true, false == new Boolean(false) );
+new TestCase( SECTION, "false == new MyObject(false)", true, false == new MyObject(false) );
- return ( array );
-}
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/mozilla/js/tests/ecma/Expressions/browser.js b/mozilla/js/tests/ecma/Expressions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Expressions/shell.js b/mozilla/js/tests/ecma/Expressions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-1.js
index d8ce56085aa..4f5ab9872cf 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,105 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.1.1.js
- ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ File Name: 15.3.1.1.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
- Description:
- When the Function function is called with some arguments p1, p2, . . . , pn, body
- (where n might be 0, that is, there are no "p" arguments, and where body might
- also not be provided), the following steps are taken:
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn, body
+ (where n might be 0, that is, there are no "p" arguments, and where body might
+ also not be provided), the following steps are taken:
- 1. Create and return a new Function object exactly if the function constructor had
- been called with the same arguments (15.3.2.1).
+ 1. Create and return a new Function object exactly if the function constructor had
+ been called with the same arguments (15.3.2.1).
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.1.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor Called as a Function";
+var SECTION = "15.3.1.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" );
+var MyObject = Function( "value", "this.value = value; this.valueOf = Function( 'return this.value' ); this.toString = Function( 'return String(this.value);' )" );
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var myfunc = Function();
- myfunc.toString = Object.prototype.toString;
+var myfunc = Function();
+myfunc.toString = Object.prototype.toString;
// not going to test toString here since it is implementation dependent.
-// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+// new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+myfunc.toString = Object.prototype.toString;
+new TestCase( SECTION,
+ "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+
+new TestCase( SECTION,
+ "myfunc.length",
+ 0,
+ myfunc.length );
+
+new TestCase( SECTION,
+ "myfunc.prototype.toString()",
+ "[object Object]",
+ myfunc.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc.prototype.constructor",
+ myfunc,
+ myfunc.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc.arguments",
+ null,
+ myfunc.arguments );
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject(true); OBJ.valueOf()",
+ true,
+ eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION,
+ "OBJ.toString()",
+ "true",
+ OBJ.toString() );
+
+new TestCase( SECTION,
+ "OBJ.toString = Object.prototype.toString; OBJ.toString()",
+ "[object Object]",
+ eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.toString = Object.prototype.toString; MyObject.toString()",
+ "[object Function]",
+ eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.__proto__ == Function.prototype",
+ true,
+ MyObject.__proto__ == Function.prototype );
+
+new TestCase( SECTION,
+ "MyObject.length",
+ 1,
+ MyObject.length );
+
+new TestCase( SECTION,
+ "MyObject.prototype.constructor",
+ MyObject,
+ MyObject.prototype.constructor );
+
+new TestCase( SECTION,
+ "MyObject.arguments",
+ null,
+ MyObject.arguments );
+
+test();
- myfunc.toString = Object.prototype.toString;
- array[item++] = new TestCase( SECTION,
- "myfunc = Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc.toString() );
- array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length );
- array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() );
- array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() );
- array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
- array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
- array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype );
- array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length );
- array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor );
- array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-2.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-2.js
index 635128b5c68..79664559538 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-2.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,100 +35,157 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.1.1-2.js
- ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
- Function(p1, p2, ..., pn, body )
+ File Name: 15.3.1.1-2.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ Function(p1, p2, ..., pn, body )
- Description:
- When the Function function is called with some arguments p1, p2, . . . , pn,
- body (where n might be 0, that is, there are no "p" arguments, and where body
- might also not be provided), the following steps are taken:
+ Description:
+ When the Function function is called with some arguments p1, p2, . . . , pn,
+ body (where n might be 0, that is, there are no "p" arguments, and where body
+ might also not be provided), the following steps are taken:
- 1. Create and return a new Function object exactly if the function constructor
- had been called with the same arguments (15.3.2.1).
+ 1. Create and return a new Function object exactly if the function constructor
+ had been called with the same arguments (15.3.2.1).
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.1.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor Called as a Function";
+var SECTION = "15.3.1.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var myfunc1 = Function("a","b","c", "return a+b+c" );
+var myfunc2 = Function("a, b, c", "return a+b+c" );
+var myfunc3 = Function("a,b", "c", "return a+b+c" );
+myfunc1.toString = Object.prototype.toString;
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
- var myfunc1 = Function("a","b","c", "return a+b+c" );
- var myfunc2 = Function("a, b, c", "return a+b+c" );
- var myfunc3 = Function("a,b", "c", "return a+b+c" );
+new TestCase( SECTION,
+ "myfunc1.length",
+ 3,
+ myfunc1.length );
- myfunc1.toString = Object.prototype.toString;
- myfunc2.toString = Object.prototype.toString;
- myfunc3.toString = Object.prototype.toString;
+new TestCase( SECTION,
+ "myfunc1.prototype.toString()",
+ "[object Object]",
+ myfunc1.prototype.toString() );
- array[item++] = new TestCase( SECTION, "myfunc1 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc1.toString() );
+new TestCase( SECTION,
+ "myfunc1.prototype.constructor",
+ myfunc1,
+ myfunc1.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
- array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
+new TestCase( SECTION,
+ "myfunc1.arguments",
+ null,
+ myfunc1.arguments );
- array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
- array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+new TestCase( SECTION,
+ "myfunc1(1,2,3)",
+ 6,
+ myfunc1(1,2,3) );
- array[item++] = new TestCase( SECTION, "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc2.toString() );
- array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
- array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
- array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
- array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
- array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+new TestCase( SECTION,
+ "myfunc2 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
- array[item++] = new TestCase( SECTION, "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc3.toString() );
- array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
- array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
- array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
+new TestCase( SECTION,
+ "myfunc2.__proto__",
+ Function.prototype,
+ myfunc2.__proto__ );
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+new TestCase( SECTION,
+ "myfunc2.length",
+ 3,
+ myfunc2.length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION,
+ "myfunc2.prototype.toString()",
+ "[object Object]",
+ myfunc2.prototype.toString() );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "myfunc2.prototype.constructor",
+ myfunc2,
+ myfunc2.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc2.arguments",
+ null,
+ myfunc2.arguments );
+
+new TestCase( SECTION,
+ "myfunc2( 1000, 200, 30 )",
+ 1230,
+ myfunc2(1000,200,30) );
+
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION,
+ "myfunc3 = Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+
+new TestCase( SECTION,
+ "myfunc3.__proto__",
+ Function.prototype,
+ myfunc3.__proto__ );
+
+new TestCase( SECTION,
+ "myfunc3.length",
+ 3,
+ myfunc3.length );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.toString()",
+ "[object Object]",
+ myfunc3.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.valueOf() +''",
+ "[object Object]",
+ myfunc3.prototype.valueOf() +'' );
+
+new TestCase( SECTION,
+ "myfunc3.prototype.constructor",
+ myfunc3,
+ myfunc3.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc3.arguments",
+ null,
+ myfunc3.arguments );
+
+new TestCase( SECTION,
+ "myfunc3(-100,100,NaN)",
+ Number.NaN,
+ myfunc3(-100,100,NaN) );
+
+new TestCase( SECTION,
+ "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-3.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-3.js
index ca5bcf22da1..a15dce471a0 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-3.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.1.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,63 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.1.1-3.js
- ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
+ File Name: 15.3.1.1-3.js
+ ECMA Section: 15.3.1.1 The Function Constructor Called as a Function
- new Function(p1, p2, ..., pn, body )
+ new Function(p1, p2, ..., pn, body )
- Description: The last argument specifies the body (executable code)
- of a function; any preceeding arguments sepcify formal
- parameters.
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
- See the text for description of this section.
+ See the text for description of this section.
- This test examples from the specification.
+ This test examples from the specification.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.1.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor Called as a Function";
+var SECTION = "15.3.1.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+var args = "";
- var testcases = new Array();
-
- var args = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- args += "arg"+i;
- if ( i != 1999 ) {
- args += ",";
- }
- }
-
- var s = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- s += ".0005";
- if ( i != 1999 ) {
- s += ",";
- }
- }
-
- MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
- MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
-
- var MY_OB = eval( "MyFunc("+ s +")" );
-
- testcases[testcases.length] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
- testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB );
- testcases[testcases.length] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
-
- testcases[testcases.length] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
-
- testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
- testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
- testcases[testcases.length] = new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
}
+
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
+}
+
+MyFunc = Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+var MY_OB = eval( "MyFunc("+ s +")" );
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, MY_OB );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-1.js
index cca0e680679..05ee86912f5 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,76 +35,100 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.2.1.js
- ECMA Section: 15.3.2.1 The Function Constructor
- new Function(p1, p2, ..., pn, body )
-
- Description: The last argument specifies the body (executable code)
- of a function; any preceeding arguments sepcify formal
- parameters.
-
- See the text for description of this section.
-
- This test examples from the specification.
-
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var SECTION = "15.3.2.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" );
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var myfunc = new Function();
-
-// not going to test toString here since it is implementation dependent.
-// array[item++] = new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
-
- myfunc.toString = Object.prototype.toString;
-
- array[item++] = new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc.toString() );
- array[item++] = new TestCase( SECTION, "myfunc.length", 0, myfunc.length );
- array[item++] = new TestCase( SECTION, "myfunc.prototype.toString()", "[object Object]", myfunc.prototype.toString() );
-
- array[item++] = new TestCase( SECTION, "myfunc.prototype.constructor", myfunc, myfunc.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc.arguments", null, myfunc.arguments );
-
- array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "OBJ.toString()", "true", OBJ.toString() );
- array[item++] = new TestCase( SECTION, "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]", eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
- array[item++] = new TestCase( SECTION, "MyObject.toString = Object.prototype.toString; MyObject.toString()", "[object Function]", eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
-
- array[item++] = new TestCase( SECTION, "MyObject.__proto__ == Function.prototype", true, MyObject.__proto__ == Function.prototype );
- array[item++] = new TestCase( SECTION, "MyObject.length", 1, MyObject.length );
- array[item++] = new TestCase( SECTION, "MyObject.prototype.constructor", MyObject, MyObject.prototype.constructor );
- array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
+
+ See the text for description of this section.
+
+ This test examples from the specification.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MyObject = new Function( "value", "this.value = value; this.valueOf = new Function( 'return this.value' ); this.toString = new Function( 'return String(this.value);' )" );
+
+var myfunc = new Function();
+
+// not going to test toString here since it is implementation dependent.
+// new TestCase( SECTION, "myfunc.toString()", "function anonymous() { }", myfunc.toString() );
+
+myfunc.toString = Object.prototype.toString;
+
+new TestCase( SECTION, "myfunc = new Function(); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc.toString() );
+
+new TestCase( SECTION,
+ "myfunc.length",
+ 0,
+ myfunc.length );
+
+new TestCase( SECTION,
+ "myfunc.prototype.toString()",
+ "[object Object]",
+ myfunc.prototype.toString() );
+
+new TestCase( SECTION,
+ "myfunc.prototype.constructor",
+ myfunc,
+ myfunc.prototype.constructor );
+
+new TestCase( SECTION,
+ "myfunc.arguments",
+ null,
+ myfunc.arguments );
+
+new TestCase( SECTION,
+ "var OBJ = new MyObject(true); OBJ.valueOf()",
+ true,
+ eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+
+new TestCase( SECTION,
+ "OBJ.toString()",
+ "true",
+ OBJ.toString() );
+
+new TestCase( SECTION,
+ "OBJ.toString = Object.prototype.toString; OBJ.toString()", "[object Object]",
+ eval("OBJ.toString = Object.prototype.toString; OBJ.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.toString = Object.prototype.toString; MyObject.toString()",
+ "[object Function]",
+ eval("MyObject.toString = Object.prototype.toString; MyObject.toString()") );
+
+new TestCase( SECTION,
+ "MyObject.__proto__ == Function.prototype",
+ true,
+ MyObject.__proto__ == Function.prototype );
+
+new TestCase( SECTION,
+ "MyObject.length",
+ 1,
+ MyObject.length );
+
+new TestCase( SECTION,
+ "MyObject.prototype.constructor",
+ MyObject,
+ MyObject.prototype.constructor );
+
+new TestCase( SECTION,
+ "MyObject.arguments",
+ null,
+ MyObject.arguments );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-2.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-2.js
index d5d2990ee58..ab78b0135f9 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-2.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,72 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.2.1.js
- ECMA Section: 15.3.2.1 The Function Constructor
- new Function(p1, p2, ..., pn, body )
-
- Description:
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var SECTION = "15.3.2.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var myfunc1 = new Function("a","b","c", "return a+b+c" );
- var myfunc2 = new Function("a, b, c", "return a+b+c" );
- var myfunc3 = new Function("a,b", "c", "return a+b+c" );
-
- myfunc1.toString = Object.prototype.toString;
- myfunc2.toString = Object.prototype.toString;
- myfunc3.toString = Object.prototype.toString;
-
- array[item++] = new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc1.toString() );
-
- array[item++] = new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
- array[item++] = new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
-
- array[item++] = new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
- array[item++] = new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
-
- array[item++] = new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc2.toString() );
- array[item++] = new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
- array[item++] = new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
- array[item++] = new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
-
- array[item++] = new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
- array[item++] = new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
-
- array[item++] = new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- myfunc3.toString() );
- array[item++] = new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
- array[item++] = new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
- array[item++] = new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
- array[item++] = new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
- array[item++] = new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
-
- array[item++] = new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
- "",
- eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.2.1.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+var myfunc1 = new Function("a","b","c", "return a+b+c" );
+var myfunc2 = new Function("a, b, c", "return a+b+c" );
+var myfunc3 = new Function("a,b", "c", "return a+b+c" );
+
+myfunc1.toString = Object.prototype.toString;
+myfunc2.toString = Object.prototype.toString;
+myfunc3.toString = Object.prototype.toString;
+
+new TestCase( SECTION, "myfunc1 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc1.toString() );
+
+new TestCase( SECTION, "myfunc1.length", 3, myfunc1.length );
+new TestCase( SECTION, "myfunc1.prototype.toString()", "[object Object]", myfunc1.prototype.toString() );
+
+new TestCase( SECTION, "myfunc1.prototype.constructor", myfunc1, myfunc1.prototype.constructor );
+new TestCase( SECTION, "myfunc1.arguments", null, myfunc1.arguments );
+new TestCase( SECTION, "myfunc1(1,2,3)", 6, myfunc1(1,2,3) );
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc1.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION, "myfunc2 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc2.toString() );
+new TestCase( SECTION, "myfunc2.__proto__", Function.prototype, myfunc2.__proto__ );
+new TestCase( SECTION, "myfunc2.length", 3, myfunc2.length );
+new TestCase( SECTION, "myfunc2.prototype.toString()", "[object Object]", myfunc2.prototype.toString() );
+
+new TestCase( SECTION, "myfunc2.prototype.constructor", myfunc2, myfunc2.prototype.constructor );
+new TestCase( SECTION, "myfunc2.arguments", null, myfunc2.arguments );
+new TestCase( SECTION, "myfunc2( 1000, 200, 30 )", 1230, myfunc2(1000,200,30) );
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc2.prototype ) { MYPROPS += p; }; MYPROPS") );
+
+new TestCase( SECTION, "myfunc3 = new Function('a','b','c'); myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ myfunc3.toString() );
+new TestCase( SECTION, "myfunc3.__proto__", Function.prototype, myfunc3.__proto__ );
+new TestCase( SECTION, "myfunc3.length", 3, myfunc3.length );
+new TestCase( SECTION, "myfunc3.prototype.toString()", "[object Object]", myfunc3.prototype.toString() );
+new TestCase( SECTION, "myfunc3.prototype.valueOf() +''", "[object Object]", myfunc3.prototype.valueOf() +'' );
+new TestCase( SECTION, "myfunc3.prototype.constructor", myfunc3, myfunc3.prototype.constructor );
+new TestCase( SECTION, "myfunc3.arguments", null, myfunc3.arguments );
+new TestCase( SECTION, "myfunc3(-100,100,NaN)", Number.NaN, myfunc3(-100,100,NaN) );
+
+new TestCase( SECTION, "var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS",
+ "",
+ eval("var MYPROPS = ''; for ( var p in myfunc3.prototype ) { MYPROPS += p; }; MYPROPS") );
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-3.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-3.js
index ffcb14c149d..565a578becd 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-3.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.2.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,59 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.2.1-3.js
- ECMA Section: 15.3.2.1 The Function Constructor
- new Function(p1, p2, ..., pn, body )
+ File Name: 15.3.2.1-3.js
+ ECMA Section: 15.3.2.1 The Function Constructor
+ new Function(p1, p2, ..., pn, body )
- Description: The last argument specifies the body (executable code)
- of a function; any preceeding arguments sepcify formal
- parameters.
+ Description: The last argument specifies the body (executable code)
+ of a function; any preceeding arguments sepcify formal
+ parameters.
- See the text for description of this section.
+ See the text for description of this section.
- This test examples from the specification.
+ This test examples from the specification.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.2.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Function Constructor";
+var SECTION = "15.3.2.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Function Constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var args = "";
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var args = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- args += "arg"+i;
- if ( i != 1999 ) {
- args += ",";
- }
- }
-
- var s = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- s += ".0005";
- if ( i != 1999 ) {
- s += ",";
- }
- }
-
- MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
- MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
-
- array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
- array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
-
- array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
-
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
-
- return ( array );
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
}
+
+MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-1.js
index a0c979ed861..63ab250bda8 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,44 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.3.1-1.js
- ECMA Section: 15.3.3.1 Properties of the Function Constructor
- Function.prototype
+ File Name: 15.3.3.1-1.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
- Description: The initial value of Function.prototype is the built-in
- Function prototype object.
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
- This property shall have the attributes [DontEnum |
- DontDelete | ReadOnly]
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
- This test the value of Function.prototype.
+ This test the value of Function.prototype.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.3.1-1";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "Function.prototype";
+var SECTION = "15.3.3.1-1";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Function.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- testcases[tc++] = new TestCase( SECTION, "Function.prototype == Function.proto", true, Function.__proto__ == Function.prototype );
+new TestCase( SECTION, "Function.prototype == Function.proto", true, Function.__proto__ == Function.prototype );
- test();
-
-function test() {
- for (tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-2.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-2.js
index aa84745d9b4..9b10b1accc1 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-2.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.3.1-2.js
- ECMA Section: 15.3.3.1 Properties of the Function Constructor
- Function.prototype
+ File Name: 15.3.3.1-2.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
- Description: The initial value of Function.prototype is the built-in
- Function prototype object.
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
- This property shall have the attributes [DontEnum |
- DontDelete | ReadOnly]
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
- This test the DontEnum property of Function.prototype.
+ This test the DontEnum property of Function.prototype.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.prototype";
+var SECTION = "15.3.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "var str='';for (prop in Function ) str += prop; str;",
- "",
- eval("var str='';for (prop in Function) str += prop; str;")
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "var str='';for (prop in Function ) str += prop; str;",
+ "",
+ eval("var str='';for (prop in Function) str += prop; str;")
+ );
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-3.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-3.js
index ca3c50fe825..8aa836ef635 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-3.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,43 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.3.1-3.js
- ECMA Section: 15.3.3.1 Properties of the Function Constructor
- Function.prototype
+ File Name: 15.3.3.1-3.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
- Description: The initial value of Function.prototype is the built-in
- Function prototype object.
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
- This property shall have the attributes [DontEnum |
- DontDelete | ReadOnly]
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
- This test the DontDelete property of Function.prototype.
+ This test the DontDelete property of Function.prototype.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.3.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.prototype";
+var SECTION = "15.3.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var FUN_PROTO = Function.prototype;
- var FUN_PROTO = Function.prototype;
+new TestCase( SECTION,
+ "delete Function.prototype",
+ false,
+ delete Function.prototype
+ );
- array[item++] = new TestCase( SECTION,
- "delete Function.prototype",
- false,
- delete Function.prototype
- );
-
- array[item++] = new TestCase( SECTION,
- "delete Function.prototype; Function.prototype",
- FUN_PROTO,
- eval("delete Function.prototype; Function.prototype")
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "delete Function.prototype; Function.prototype",
+ FUN_PROTO,
+ eval("delete Function.prototype; Function.prototype")
+ );
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-4.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-4.js
index 70c5cc5830d..f10538bd68d 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-4.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.1-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.3.1-4.js
- ECMA Section: 15.3.3.1 Properties of the Function Constructor
- Function.prototype
+ File Name: 15.3.3.1-4.js
+ ECMA Section: 15.3.3.1 Properties of the Function Constructor
+ Function.prototype
- Description: The initial value of Function.prototype is the built-in
- Function prototype object.
+ Description: The initial value of Function.prototype is the built-in
+ Function prototype object.
- This property shall have the attributes [DontEnum |
- DontDelete | ReadOnly]
+ This property shall have the attributes [DontEnum |
+ DontDelete | ReadOnly]
- This test the ReadOnly property of Function.prototype.
+ This test the ReadOnly property of Function.prototype.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.3.1-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.prototype";
+var SECTION = "15.3.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "Function.prototype = null; Function.prototype",
- Function.prototype,
- eval("Function.prototype = null; Function.prototype")
- );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Function.prototype = null; Function.prototype",
+ Function.prototype,
+ eval("Function.prototype = null; Function.prototype")
+ );
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.2.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.2.js
index 210c82a19a2..854b344d6b6 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.3.2.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.3.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,42 +35,25 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.3.2.js
- ECMA Section: 15.3.3.2 Properties of the Function Constructor
- Function.length
-
- Description: The length property is 1.
-
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
-
- var SECTION = "15.3.3.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.length";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Function.length", 1, Function.length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.3.2.js
+ ECMA Section: 15.3.3.2 Properties of the Function Constructor
+ Function.length
+
+ Description: The length property is 1.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.3.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Function.length", 1, Function.length );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.4-1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.4-1.js
index 7b983cf49b6..885f4c081e3 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.4-1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,57 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.4-1.js
- ECMA Section: 15.3.4 Properties of the Function Prototype Object
-
- Description: The Function prototype object is itself a Function
- object ( its [[Class]] is "Function") that, when
- invoked, accepts any arguments and returns undefined.
-
- The value of the internal [[Prototype]] property
- object is the Object prototype object.
-
- It is a function with an "empty body"; if it is
- invoked, it merely returns undefined.
-
- The Function prototype object does not have a valueOf
- property of its own; however it inherits the valueOf
- property from the Object prototype Object.
-
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
-
- var SECTION = "15.3.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Function Prototype Object";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
-
-
-// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
- array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
- array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.4-1.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Function Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+
+new TestCase( SECTION,
+ "Function.prototype.valueOf",
+ Object.prototype.valueOf,
+ Function.prototype.valueOf );
+
+new TestCase( SECTION,
+ "Function.prototype()",
+ (void 0),
+ Function.prototype() );
+
+new TestCase( SECTION,
+ "Function.prototype(1,true,false,'string', new Date(),null)",
+ (void 0),
+ Function.prototype(1,true,false,'string', new Date(),null) );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.4.1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.4.1.js
index c2e10e2624b..252a768c323 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.4.1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,44 +35,24 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.4.1.js
- ECMA Section: 15.3.4.1 Function.prototype.constructor
-
- Description: The initial value of Function.prototype.constructor
- is the built-in Function constructor.
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
-
- var SECTION = "15.3.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.prototype.constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor );
-
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.4.1.js
+ ECMA Section: 15.3.4.1 Function.prototype.constructor
+
+ Description: The initial value of Function.prototype.constructor
+ is the built-in Function constructor.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+
+var SECTION = "15.3.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "Function.prototype.constructor", Function, Function.prototype.constructor );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.4.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.4.js
index 80c99415931..c7fc147e556 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.4.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,44 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.3.4.js
- ECMA Section: 15.3.4 Properties of the Function Prototype Object
-
- Description: The Function prototype object is itself a Function
- object ( its [[Class]] is "Function") that, when
- invoked, accepts any arguments and returns undefined.
-
- The value of the internal [[Prototype]] property
- object is the Object prototype object.
-
- It is a function with an "empty body"; if it is
- invoked, it merely returns undefined.
-
- The Function prototype object does not have a valueOf
- property of its own; however it inherits the valueOf
- property from the Object prototype Object.
-
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var SECTION = "15.3.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Function Prototype Object";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
- "[object Function]",
- eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
-
-
-// array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
- array[item++] = new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
- array[item++] = new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.3.4.js
+ ECMA Section: 15.3.4 Properties of the Function Prototype Object
+
+ Description: The Function prototype object is itself a Function
+ object ( its [[Class]] is "Function") that, when
+ invoked, accepts any arguments and returns undefined.
+
+ The value of the internal [[Prototype]] property
+ object is the Object prototype object.
+
+ It is a function with an "empty body"; if it is
+ invoked, it merely returns undefined.
+
+ The Function prototype object does not have a valueOf
+ property of its own; however it inherits the valueOf
+ property from the Object prototype Object.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.3.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Function Prototype Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()",
+ "[object Function]",
+ eval("var myfunc = Function.prototype; myfunc.toString = Object.prototype.toString; myfunc.toString()"));
+
+
+// new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+new TestCase( SECTION, "Function.prototype.valueOf", Object.prototype.valueOf, Function.prototype.valueOf );
+new TestCase( SECTION, "Function.prototype()", (void 0), Function.prototype() );
+new TestCase( SECTION, "Function.prototype(1,true,false,'string', new Date(),null)", (void 0), Function.prototype(1,true,false,'string', new Date(),null) );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.5-1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.5-1.js
index 3540c083361..0b1ad0689f2 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.5-1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,100 +35,81 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.5-1.js
- ECMA Section: 15.3.5 Properties of Function Instances
- new Function(p1, p2, ..., pn, body )
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
- Description:
+ Description:
- 15.3.5.1 length
+ 15.3.5.1 length
- The value of the length property is usually an integer that indicates
- the "typical" number of arguments expected by the function. However,
- the language permits the function to be invoked with some other number
- of arguments. The behavior of a function when invoked on a number of
- arguments other than the number specified by its length property depends
- on the function.
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
- 15.3.5.2 prototype
- The value of the prototype property is used to initialize the internal [[
- Prototype]] property of a newly created object before the Function object
- is invoked as a constructor for that newly created object.
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
- 15.3.5.3 arguments
+ 15.3.5.3 arguments
- The value of the arguments property is normally null if there is no
- outstanding invocation of the function in progress (that is, the function has been called
- but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
- arguments property is "dynamically bound" to a newly created object that contains the
- arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
- property is discouraged; it is provided principally for compatibility with existing old code.
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of Function Instances";
+var SECTION = "15.3.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of Function Instances";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test();
+var args = "";
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var args = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- args += "arg"+i;
- if ( i != 1999 ) {
- args += ",";
- }
- }
-
- var s = "";
-
- for ( var i = 0; i < 2000; i++ ) {
- s += ".0005";
- if ( i != 1999 ) {
- s += ",";
- }
- }
-
- MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
- MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
-
-
- array[item++] = new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
- array[item++] = new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
- array[item++] = new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() );
- array[item++] = new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype );
-
-
- array[item++] = new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
-
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
- array[item++] = new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
-
- return ( array );
+for ( var i = 0; i < 2000; i++ ) {
+ args += "arg"+i;
+ if ( i != 1999 ) {
+ args += ",";
+ }
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+var s = "";
+
+for ( var i = 0; i < 2000; i++ ) {
+ s += ".0005";
+ if ( i != 1999 ) {
+ s += ",";
+ }
}
+
+MyFunc = new Function( args, "var r=0; for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; else r += eval('arg'+i); }; return r");
+MyObject = new Function( args, "for (var i = 0; i < MyFunc.length; i++ ) { if ( eval('arg'+i) == void 0) break; eval('this.arg'+i +'=arg'+i); };");
+
+
+new TestCase( SECTION, "MyFunc.length", 2000, MyFunc.length );
+new TestCase( SECTION, "var MY_OB = eval('MyFunc(s)')", 1, eval("var MY_OB = MyFunc("+s+"); MY_OB") );
+new TestCase( SECTION, "MyFunc.prototype.toString()", "[object Object]", MyFunc.prototype.toString() );
+new TestCase( SECTION, "typeof MyFunc.prototype", "object", typeof MyFunc.prototype );
+
+
+new TestCase( SECTION, "MyObject.length", 2000, MyObject.length );
+
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1.length") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1()") );
+new TestCase( SECTION, "FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)", 3, eval("FUN1 = new Function( 'a','b','c', 'return FUN1.length' ); FUN1(1,2,3,4,5)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.5-2.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.5-2.js
index 2b219cf87c9..f0da85a183f 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.5-2.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,74 +35,54 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.5-1.js
- ECMA Section: 15.3.5 Properties of Function Instances
- new Function(p1, p2, ..., pn, body )
+ File Name: 15.3.5-1.js
+ ECMA Section: 15.3.5 Properties of Function Instances
+ new Function(p1, p2, ..., pn, body )
- Description:
+ Description:
- 15.3.5.1 length
+ 15.3.5.1 length
- The value of the length property is usually an integer that indicates
- the "typical" number of arguments expected by the function. However,
- the language permits the function to be invoked with some other number
- of arguments. The behavior of a function when invoked on a number of
- arguments other than the number specified by its length property depends
- on the function.
+ The value of the length property is usually an integer that indicates
+ the "typical" number of arguments expected by the function. However,
+ the language permits the function to be invoked with some other number
+ of arguments. The behavior of a function when invoked on a number of
+ arguments other than the number specified by its length property depends
+ on the function.
- 15.3.5.2 prototype
- The value of the prototype property is used to initialize the internal [[
- Prototype]] property of a newly created object before the Function object
- is invoked as a constructor for that newly created object.
+ 15.3.5.2 prototype
+ The value of the prototype property is used to initialize the internal [[
+ Prototype]] property of a newly created object before the Function object
+ is invoked as a constructor for that newly created object.
- 15.3.5.3 arguments
+ 15.3.5.3 arguments
- The value of the arguments property is normally null if there is no
- outstanding invocation of the function in progress (that is, the function has been called
- but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
- arguments property is "dynamically bound" to a newly created object that contains the
- arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
- property is discouraged; it is provided principally for compatibility with existing old code.
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the function has been called
+ but has not yet returned). When a non-internal Function object (15.3.2.1) is invoked, its
+ arguments property is "dynamically bound" to a newly created object that contains the
+ arguments on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility with existing old code.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.3.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of Function Instances";
+var SECTION = "15.3.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of Function Instances";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test();
+var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var MyObject = new Function( 'a', 'b', 'c', 'this.a = a; this.b = b; this.c = c; this.value = a+b+c; this.valueOf = new Function( "return this.value" )' );
-
- array[item++] = new TestCase( SECTION, "MyObject.length", 3, MyObject.length );
- array[item++] = new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype );
- array[item++] = new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor );
- array[item++] = new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION, "MyObject.length", 3, MyObject.length );
+new TestCase( SECTION, "typeof MyObject.prototype", "object", typeof MyObject.prototype );
+new TestCase( SECTION, "typeof MyObject.prototype.constructor", "function", typeof MyObject.prototype.constructor );
+new TestCase( SECTION, "MyObject.arguments", null, MyObject.arguments );
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.5.1.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.5.1.js
index 9245d24ac7c..e51ddd29708 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.5.1.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.5.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.5.1.js
- ECMA Section: Function.length
- Description:
+ File Name: 15.3.5.1.js
+ ECMA Section: Function.length
+ Description:
- The value of the length property is usually an integer that indicates the
- "typical" number of arguments expected by the function. However, the
- language permits the function to be invoked with some other number of
- arguments. The behavior of a function when invoked on a number of arguments
- other than the number specified by its length property depends on the function.
+ The value of the length property is usually an integer that indicates the
+ "typical" number of arguments expected by the function. However, the
+ language permits the function to be invoked with some other number of
+ arguments. The behavior of a function when invoked on a number of arguments
+ other than the number specified by its length property depends on the function.
- this test needs a 1.2 version check.
+ this test needs a 1.2 version check.
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=104204
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.3.5.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.length";
- var BUGNUMBER="104204";
+var SECTION = "15.3.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.length";
+var BUGNUMBER="104204";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var f = new Function( "a","b", "c", "return f.length");
- var f = new Function( "a","b", "c", "return f.length");
-
- testcases[tc++] = new TestCase( SECTION,
- 'var f = new Function( "a","b", "c", "return f.length"); f()',
- 3,
- f() );
+new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f()',
+ 3,
+ f() );
- testcases[tc++] = new TestCase( SECTION,
- 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
- 3,
- f(1,2,3,4,5) );
+new TestCase( SECTION,
+ 'var f = new Function( "a","b", "c", "return f.length"); f(1,2,3,4,5)',
+ 3,
+ f(1,2,3,4,5) );
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/FunctionObjects/15.3.5.3.js b/mozilla/js/tests/ecma/FunctionObjects/15.3.5.3.js
index 235a64a5fe6..9cf95b1c664 100644
--- a/mozilla/js/tests/ecma/FunctionObjects/15.3.5.3.js
+++ b/mozilla/js/tests/ecma/FunctionObjects/15.3.5.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.3.5.3.js
- ECMA Section: Function.arguments
- Description:
+ File Name: 15.3.5.3.js
+ ECMA Section: Function.arguments
+ Description:
- The value of the arguments property is normally null if there is no
- outstanding invocation of the function in progress (that is, the
- function has been called but has not yet returned). When a non-internal
- Function object (15.3.2.1) is invoked, its arguments property is
- "dynamically bound" to a newly created object that contains the arguments
- on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
- property is discouraged; it is provided principally for compatibility
- with existing old code.
+ The value of the arguments property is normally null if there is no
+ outstanding invocation of the function in progress (that is, the
+ function has been called but has not yet returned). When a non-internal
+ Function object (15.3.2.1) is invoked, its arguments property is
+ "dynamically bound" to a newly created object that contains the arguments
+ on which it was invoked (see 10.1.6 and 10.1.8). Note that the use of this
+ property is discouraged; it is provided principally for compatibility
+ with existing old code.
- See sections 10.1.6 and 10.1.8 for more extensive tests.
+ See sections 10.1.6 and 10.1.8 for more extensive tests.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.3.5.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Function.arguments";
+var SECTION = "15.3.5.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Function.arguments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var MYFUNCTION = new Function( "return this.arguments" );
-function getTestCases() {
- var array =new Array();
- var item = 0;
+new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments );
- var MYFUNCTION = new Function( "return this.arguments" );
-
-
- array[item++] = new TestCase( SECTION, "var MYFUNCTION = new Function( 'return this.arguments' ); MYFUNCTION.arguments", null, MYFUNCTION.arguments );
-
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/FunctionObjects/browser.js b/mozilla/js/tests/ecma/FunctionObjects/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/FunctionObjects/shell.js b/mozilla/js/tests/ecma/FunctionObjects/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1-1-n.js b/mozilla/js/tests/ecma/GlobalObject/15.1-1-n.js
index ddc1ab992e1..ab7aa79ea9f 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1-1-n.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1-1-n.js
- ECMA Section: The global object
- Description:
+ File Name: 15.1-1-n.js
+ ECMA Section: The global object
+ Description:
- The global object does not have a [[Construct]] property; it is not
- possible to use the global object as a constructor with the new operator.
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.1-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Global Object";
+var SECTION = "15.1-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Global Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+DESCRIPTION = "var MY_GLOBAL = new this()";
+EXPECTED = "error";
- testcases[tc] = new TestCase( SECTION,
- "var MY_GLOBAL = new this()",
- "error",
- "var MY_GLOBAL = new this()" );
+new TestCase( SECTION,
+ "var MY_GLOBAL = new this()",
+ "error",
+ eval("var MY_GLOBAL = new this()") );
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual);
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1-2-n.js b/mozilla/js/tests/ecma/GlobalObject/15.1-2-n.js
index f2654cc71e1..55641988a1a 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1-2-n.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.1-2-n.js
- ECMA Section: The global object
- Description:
-
- The global object does not have a [[Call]] property; it is not possible
- to invoke the global object as a function.
-
- Author: christine@netscape.com
- Date: 12 november 1997
-*/
-
- var SECTION = "15.1-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Global Object";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = new Array();
-
- testcases[tc] = new TestCase( SECTION,
- "var MY_GLOBAL = this()",
- "error",
- "var MY_GLOBAL = this()" );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual);
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.1-2-n.js
+ ECMA Section: The global object
+ Description:
+
+ The global object does not have a [[Call]] property; it is not possible
+ to invoke the global object as a function.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Global Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var MY_GLOBAL = this()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "var MY_GLOBAL = this()",
+ "error",
+ eval("var MY_GLOBAL = this()") );
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.1.1.js b/mozilla/js/tests/ecma/GlobalObject/15.1.1.1.js
index c0287f8f08d..f20c2ae41fa 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.1.1.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.1.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.1.1.js
- ECMA Section: 15.1.1.1 NaN
+ File Name: 15.1.1.1.js
+ ECMA Section: 15.1.1.1 NaN
- Description: The initial value of NaN is NaN.
+ Description: The initial value of NaN is NaN.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.1.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "NaN";
+var SECTION = "15.1.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "NaN";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[array.length] = new TestCase( SECTION, "NaN", Number.NaN, NaN );
- array[array.length] = new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN );
- array[array.length] = new TestCase( SECTION, "typeof NaN", "number", typeof NaN );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION, "NaN", Number.NaN, NaN );
+new TestCase( SECTION, "this.NaN", Number.NaN, this.NaN );
+new TestCase( SECTION, "typeof NaN", "number", typeof NaN );
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.1.2.js b/mozilla/js/tests/ecma/GlobalObject/15.1.1.2.js
index b3a1d252d30..6416d65c02c 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.1.2.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.1.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.1.2.js
- ECMA Section: 15.1.1.2 Infinity
+ File Name: 15.1.1.2.js
+ ECMA Section: 15.1.1.2 Infinity
- Description: The initial value of Infinity is +Infinity.
+ Description: The initial value of Infinity is +Infinity.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.1.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Infinity";
+var SECTION = "15.1.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Infinity";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity );
+new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity );
+new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity );
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Infinity", Number.POSITIVE_INFINITY, Infinity );
- array[item++] = new TestCase( SECTION, "this.Infinity", Number.POSITIVE_INFINITY, this.Infinity );
- array[item++] = new TestCase( SECTION, "typeof Infinity", "number", typeof Infinity );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-1.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-1.js
index 4e86b501df3..41e92f995bd 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-1.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,73 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.1-1.js
- ECMA Section: 15.1.2.1 eval(x)
+File Name: 15.1.2.1-1.js
+ECMA Section: 15.1.2.1 eval(x)
- if x is not a string object, return x.
- Description:
- Author: christine@netscape.com
- Date: 16 september 1997
+if x is not a string object, return x.
+Description:
+Author: christine@netscape.com
+Date: 16 september 1997
*/
- var SECTION = "15.1.2.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "eval(x)";
+var SECTION = "15.1.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "eval(x)";
- var BUGNUMBER = "111199";
+var BUGNUMBER = "111199";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "eval.length", 1, eval.length );
+new TestCase( SECTION, "delete eval.length", false, delete eval.length );
+new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") );
+new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") );
+// new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
- test();
+// test cases where argument is not a string. should return the argument.
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "eval()", void 0, eval() );
+new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) );
+new TestCase( SECTION, "eval(null)", null, eval( null ) );
+new TestCase( SECTION, "eval(true)", true, eval( true ) );
+new TestCase( SECTION, "eval(false)", false, eval( false ) );
- array[item++] = new TestCase( SECTION, "eval.length", 1, eval.length );
- array[item++] = new TestCase( SECTION, "delete eval.length", false, delete eval.length );
- array[item++] = new TestCase( SECTION, "var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS", "", eval("var PROPS = ''; for ( p in eval ) { PROPS += p }; PROPS") );
- array[item++] = new TestCase( SECTION, "eval.length = null; eval.length", 1, eval( "eval.length = null; eval.length") );
-// array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) );
- // test cases where argument is not a string. should return the argument.
+new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) );
+new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) );
+new TestCase( SECTION, "eval(1)", 1, eval(1) );
+new TestCase( SECTION, "eval(0)", 0, eval(0) );
+new TestCase( SECTION, "eval(-1)", -1, eval(-1) );
+new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) );
+new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) );
+new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) );
+new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) );
+new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) );
- array[item++] = new TestCase( SECTION, "eval()", void 0, eval() );
- array[item++] = new TestCase( SECTION, "eval(void 0)", void 0, eval( void 0) );
- array[item++] = new TestCase( SECTION, "eval(null)", null, eval( null ) );
- array[item++] = new TestCase( SECTION, "eval(true)", true, eval( true ) );
- array[item++] = new TestCase( SECTION, "eval(false)", false, eval( false ) );
-
- array[item++] = new TestCase( SECTION, "typeof eval(new String('Infinity/-0')", "object", typeof eval(new String('Infinity/-0')) );
-
- array[item++] = new TestCase( SECTION, "eval([1,2,3,4,5,6])", "1,2,3,4,5,6", ""+eval([1,2,3,4,5,6]) );
- array[item++] = new TestCase( SECTION, "eval(new Array(0,1,2,3)", "1,2,3", ""+ eval(new Array(1,2,3)) );
- array[item++] = new TestCase( SECTION, "eval(1)", 1, eval(1) );
- array[item++] = new TestCase( SECTION, "eval(0)", 0, eval(0) );
- array[item++] = new TestCase( SECTION, "eval(-1)", -1, eval(-1) );
- array[item++] = new TestCase( SECTION, "eval(Number.NaN)", Number.NaN, eval(Number.NaN) );
- array[item++] = new TestCase( SECTION, "eval(Number.MIN_VALUE)", 5e-308, eval(Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "eval(-Number.MIN_VALUE)", -5e-308, eval(-Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "eval(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, eval(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "eval(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, eval(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "eval( 4294967296 )", 4294967296, eval(4294967296) );
- array[item++] = new TestCase( SECTION, "eval( 2147483648 )", 2147483648, eval(2147483648) );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-2.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-2.js
index 247410db8ac..4e570403e45 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-2.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.1-2.js
- ECMA Section: 15.1.2.1 eval(x)
+ File Name: 15.1.2.1-2.js
+ ECMA Section: 15.1.2.1 eval(x)
- Parse x as an ECMAScript Program. If the parse fails,
- generate a runtime error. Evaluate the program. If
- result is "Normal completion after value V", return
- the value V. Else, return undefined.
- Description:
- Author: christine@netscape.com
- Date: 16 september 1997
+ Parse x as an ECMAScript Program. If the parse fails,
+ generate a runtime error. Evaluate the program. If
+ result is "Normal completion after value V", return
+ the value V. Else, return undefined.
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.1.2.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "eval(x)";
+var SECTION = "15.1.2.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "eval(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION,
+ "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x",
+ "0/1/1970",
+ eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" ));
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[0] = new TestCase( SECTION,
- "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x",
- "0/1/1970",
- eval( "d = new Date(0); with (d) { x = getUTCMonth() +'/'+ getUTCDate() +'/'+ getUTCFullYear(); } x" )
- );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-1.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-1.js
index 6751015742b..fcd9f385c7c 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-1.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,272 +36,371 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.1.2.2-1.js
- ECMA Section: 15.1.2.2 Function properties of the global object
- parseInt( string, radix )
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
- Description:
+ Description:
- The parseInt function produces an integer value dictated by intepretation
- of the contents of the string argument according to the specified radix.
+ The parseInt function produces an integer value dictated by intepretation
+ of the contents of the string argument according to the specified radix.
- When the parseInt function is called, the following steps are taken:
+ When the parseInt function is called, the following steps are taken:
1. Call ToString(string).
2. Compute a substring of Result(1) consisting of the leftmost character
- that is not a StrWhiteSpaceChar and all characters to the right of
- that character. (In other words, remove leading whitespace.)
+ that is not a StrWhiteSpaceChar and all characters to the right of
+ that character. (In other words, remove leading whitespace.)
3. Let sign be 1.
4. If Result(2) is not empty and the first character of Result(2) is a
- minus sign -, let sign be -1.
+ minus sign -, let sign be -1.
5. If Result(2) is not empty and the first character of Result(2) is a
- plus sign + or a minus sign -, then Result(5) is the substring of
- Result(2) produced by removing the first character; otherwise, Result(5)
- is Result(2).
+ plus sign + or a minus sign -, then Result(5) is the substring of
+ Result(2) produced by removing the first character; otherwise, Result(5)
+ is Result(2).
6. If the radix argument is not supplied, go to step 12.
7. Call ToInt32(radix).
8. If Result(7) is zero, go to step 12; otherwise, if Result(7) < 2 or
- Result(7) > 36, return NaN.
+ Result(7) > 36, return NaN.
9. Let R be Result(7).
- 10. If R = 16 and the length of Result(5) is at least 2 and the first two
- characters of Result(5) are either "0x" or "0X", let S be the substring
- of Result(5) consisting of all but the first two characters; otherwise,
- let S be Result(5).
- 11. Go to step 22.
- 12. If Result(5) is empty or the first character of Result(5) is not 0,
- go to step 20.
- 13. If the length of Result(5) is at least 2 and the second character of
- Result(5) is x or X, go to step 17.
- 14. Let R be 8.
- 15. Let S be Result(5).
- 16. Go to step 22.
- 17. Let R be 16.
- 18. Let S be the substring of Result(5) consisting of all but the first
- two characters.
- 19. Go to step 22.
- 20. Let R be 10.
- 21. Let S be Result(5).
- 22. If S contains any character that is not a radix-R digit, then let Z be
- the substring of S consisting of all characters to the left of the
- leftmost such character; otherwise, let Z be S.
- 23. If Z is empty, return NaN.
- 24. Compute the mathematical integer value that is represented by Z in
- radix-R notation. (But if R is 10 and Z contains more than 20
- significant digits, every digit after the 20th may be replaced by a 0
- digit, at the option of the implementation; and if R is not 2, 4, 8,
- 10, 16, or 32, then Result(24) may be an implementation-dependent
- approximation to the mathematical integer value that is represented
- by Z in radix-R notation.)
- 25. Compute the number value for Result(24).
- 26. Return sign Result(25).
+ 10. If R = 16 and the length of Result(5) is at least 2 and the first two
+ characters of Result(5) are either "0x" or "0X", let S be the substring
+ of Result(5) consisting of all but the first two characters; otherwise,
+ let S be Result(5).
+ 11. Go to step 22.
+ 12. If Result(5) is empty or the first character of Result(5) is not 0,
+ go to step 20.
+ 13. If the length of Result(5) is at least 2 and the second character of
+ Result(5) is x or X, go to step 17.
+ 14. Let R be 8.
+ 15. Let S be Result(5).
+ 16. Go to step 22.
+ 17. Let R be 16.
+ 18. Let S be the substring of Result(5) consisting of all but the first
+ two characters.
+ 19. Go to step 22.
+ 20. Let R be 10.
+ 21. Let S be Result(5).
+ 22. If S contains any character that is not a radix-R digit, then let Z be
+ the substring of S consisting of all characters to the left of the
+ leftmost such character; otherwise, let Z be S.
+ 23. If Z is empty, return NaN.
+ 24. Compute the mathematical integer value that is represented by Z in
+ radix-R notation. (But if R is 10 and Z contains more than 20
+ significant digits, every digit after the 20th may be replaced by a 0
+ digit, at the option of the implementation; and if R is not 2, 4, 8,
+ 10, 16, or 32, then Result(24) may be an implementation-dependent
+ approximation to the mathematical integer value that is represented
+ by Z in radix-R notation.)
+ 25. Compute the number value for Result(24).
+ 26. Return sign Result(25).
- Note that parseInt may interpret only a leading portion of the string as
- an integer value; it ignores any characters that cannot be interpreted as
- part of the notation of an integer, and no indication is given that any
- such characters were ignored.
+ Note that parseInt may interpret only a leading portion of the string as
+ an integer value; it ignores any characters that cannot be interpreted as
+ part of the notation of an integer, and no indication is given that any
+ such characters were ignored.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "parseInt(string, radix)";
- var BUGNUMBER="111199";
+var SECTION = "15.1.2.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "parseInt(string, radix)";
+var BUGNUMBER="111199";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+var HEX_STRING = "0x0";
+var HEX_VALUE = 0;
- test();
+new TestCase( SECTION,
+ "parseInt.length",
+ 2,
+ parseInt.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "parseInt.length = 0; parseInt.length",
+ 2,
+ eval("parseInt.length = 0; parseInt.length") );
- var HEX_STRING = "0x0";
- var HEX_VALUE = 0;
+new TestCase( SECTION,
+ "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "",
+ eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") );
- array[item++] = new TestCase( SECTION, "parseInt.length", 2, parseInt.length );
- array[item++] = new TestCase( SECTION, "parseInt.length = 0; parseInt.length", 2, eval("parseInt.length = 0; parseInt.length") );
- array[item++] = new TestCase( SECTION, "var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS", "", eval("var PROPS=''; for ( var p in parseInt ) { PROPS += p; }; PROPS") );
- array[item++] = new TestCase( SECTION, "delete parseInt.length", false, delete parseInt.length );
- array[item++] = new TestCase( SECTION, "delete parseInt.length; parseInt.length", 2, eval("delete parseInt.length; parseInt.length") );
- array[item++] = new TestCase( SECTION, "parseInt.length = null; parseInt.length", 2, eval("parseInt.length = null; parseInt.length") );
+new TestCase( SECTION,
+ "delete parseInt.length",
+ false,
+ delete parseInt.length );
- array[item++] = new TestCase( SECTION, "parseInt()", NaN, parseInt() );
- array[item++] = new TestCase( SECTION, "parseInt('')", NaN, parseInt("") );
- array[item++] = new TestCase( SECTION, "parseInt('','')", NaN, parseInt("","") );
- array[item++] = new TestCase( SECTION,
- "parseInt(\" 0xabcdef ",
- 11259375,
- parseInt( " 0xabcdef " ));
+new TestCase( SECTION,
+ "delete parseInt.length; parseInt.length",
+ 2,
+ eval("delete parseInt.length; parseInt.length") );
- array[item++] = new TestCase( SECTION,
- "parseInt(\" 0XABCDEF ",
- 11259375,
- parseInt( " 0XABCDEF " ) );
+new TestCase( SECTION,
+ "parseInt.length = null; parseInt.length",
+ 2,
+ eval("parseInt.length = null; parseInt.length") );
- array[item++] = new TestCase( SECTION,
- "parseInt( 0xabcdef )",
- 11259375,
- parseInt( "0xabcdef") );
+new TestCase( SECTION,
+ "parseInt()",
+ NaN,
+ parseInt() );
- array[item++] = new TestCase( SECTION,
- "parseInt( 0XABCDEF )",
- 11259375,
- parseInt( "0XABCDEF") );
+new TestCase( SECTION,
+ "parseInt('')",
+ NaN,
+ parseInt("") );
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
+new TestCase( SECTION,
+ "parseInt('','')",
+ NaN,
+ parseInt("","") );
- // a few tests with spaces
+new TestCase( SECTION,
+ "parseInt(\" 0xabcdef ",
+ 11259375,
+ parseInt( " 0xabcdef " ));
- for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0;
- POWER < 15;
- POWER++, HEX_STRING = HEX_STRING +"f", space += " ")
- {
- array[item++] = new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
+new TestCase( SECTION,
+ "parseInt(\" 0XABCDEF ",
+ 11259375,
+ parseInt( " 0XABCDEF " ) );
- // a few tests with negative numbers
- for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
- HEX_VALUE -= Math.pow(16,POWER)*15;
- }
+new TestCase( SECTION,
+ "parseInt( 0xabcdef )",
+ 11259375,
+ parseInt( "0xabcdef") );
- // we should stop parsing when we get to a value that is not a numeric literal for the type we expect
+new TestCase( SECTION,
+ "parseInt( 0XABCDEF )",
+ 11259375,
+ parseInt( "0XABCDEF") );
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) );
- HEX_VALUE += Math.pow(16,POWER)*15;
- }
-
- for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
- HEX_VALUE -= Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
- HEX_VALUE -= Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
- HEX_VALUE -= Math.pow(16,POWER)*15;
- }
- for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
- HEX_VALUE -= Math.pow(16,POWER)*15;
- }
-
- // let us do some octal tests. numbers that start with 0 and do not provid a radix should
- // default to using "0" as a radix.
-
- var OCT_STRING = "0";
- var OCT_VALUE = 0;
-
- for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
- OCT_VALUE += Math.pow(8,POWER)*7;
- }
-
- for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
- OCT_VALUE -= Math.pow(8,POWER)*7;
- }
-
- // should get the same results as above if we provid the radix of 8 (or 010)
-
- for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) );
- OCT_VALUE += Math.pow(8,POWER)*7;
- }
- for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) );
- OCT_VALUE -= Math.pow(8,POWER)*7;
- }
-
- // we shall stop parsing digits when we get one that isn't a numeric literal of the type we think
- // it should be.
- for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) );
- OCT_VALUE += Math.pow(8,POWER)*7;
- }
- for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
- array[item++] = new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) );
- OCT_VALUE -= Math.pow(8,POWER)*7;
- }
-
- array[item++] = new TestCase( SECTION, "parseInt( '0x' )", NaN, parseInt("0x") );
- array[item++] = new TestCase( SECTION, "parseInt( '0X' )", NaN, parseInt("0X") );
-
- array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222' )", 11111111112222222222, parseInt("11111111112222222222") );
- array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223' )", 111111111122222222220, parseInt("111111111122222222223") );
- array[item++] = new TestCase( SECTION, "parseInt( '11111111112222222222',10 )", 11111111112222222222, parseInt("11111111112222222222",10) );
- array[item++] = new TestCase( SECTION, "parseInt( '111111111122222222223',10 )", 111111111122222222220, parseInt("111111111122222222223",10) );
-
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', -1 )", Number.NaN, parseInt("01234567890",-1) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 0 )", Number.NaN, parseInt("01234567890",1) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 1 )", Number.NaN, parseInt("01234567890",1) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 2 )", 1, parseInt("01234567890",2) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 3 )", 5, parseInt("01234567890",3) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 4 )", 27, parseInt("01234567890",4) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 5 )", 194, parseInt("01234567890",5) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 6 )", 1865, parseInt("01234567890",6) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 7 )", 22875, parseInt("01234567890",7) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 8 )", 342391, parseInt("01234567890",8) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 9 )", 6053444, parseInt("01234567890",9) );
- array[item++] = new TestCase( SECTION, "parseInt( '01234567890', 10 )", 1234567890, parseInt("01234567890",10) );
-
- // need more test cases with hex radix
-
- array[item++] = new TestCase( SECTION, "parseInt( '1234567890', '0xa')", 1234567890, parseInt("1234567890","0xa") );
-
- array[item++] = new TestCase( SECTION, "parseInt( '012345', 11 )", 17715, parseInt("012345",11) );
-
- array[item++] = new TestCase( SECTION, "parseInt( '012345', 35 )", 1590195, parseInt("012345",35) );
- array[item++] = new TestCase( SECTION, "parseInt( '012345', 36 )", 1776965, parseInt("012345",36) );
- array[item++] = new TestCase( SECTION, "parseInt( '012345', 37 )", Number.NaN, parseInt("012345",37) );
-
- return ( array );
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
}
-function test( array ) {
- for ( tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( HEX_STRING = "0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",null)", HEX_VALUE, parseInt(HEX_STRING,null) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+", void 0)", HEX_VALUE, parseInt(HEX_STRING, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+// a few tests with spaces
+
+for ( var space = " ", HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0;
+ POWER < 15;
+ POWER++, HEX_STRING = HEX_STRING +"f", space += " ")
+{
+ new TestCase( SECTION, "parseInt("+space+HEX_STRING+space+", void 0)", HEX_VALUE, parseInt(space+HEX_STRING+space, void 0) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+// a few tests with negative numbers
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+
+// we should stop parsing when we get to a value that is not a numeric literal for the type we expect
+
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"g",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+"g,16)", HEX_VALUE, parseInt(HEX_STRING+"G",16) );
+ HEX_VALUE += Math.pow(16,POWER)*15;
+}
+
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0X0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+")", HEX_VALUE, parseInt(HEX_STRING) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+for ( HEX_STRING = "-0x0", HEX_VALUE = 0, POWER = 0; POWER < 15; POWER++, HEX_STRING = HEX_STRING +"f" ) {
+ new TestCase( SECTION, "parseInt("+HEX_STRING+",16)", HEX_VALUE, parseInt(HEX_STRING,16) );
+ HEX_VALUE -= Math.pow(16,POWER)*15;
+}
+
+// let us do some octal tests. numbers that start with 0 and do not provid a radix should
+// default to using "0" as a radix.
+
+var OCT_STRING = "0";
+var OCT_VALUE = 0;
+
+for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+}
+
+for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+")", OCT_VALUE, parseInt(OCT_STRING) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+}
+
+// should get the same results as above if we provid the radix of 8 (or 010)
+
+for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+",8)", OCT_VALUE, parseInt(OCT_STRING,8) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+}
+for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+",010)", OCT_VALUE, parseInt(OCT_STRING,010) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+}
+
+// we shall stop parsing digits when we get one that isn't a numeric literal of the type we think
+// it should be.
+for ( OCT_STRING = "0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+"8,8)", OCT_VALUE, parseInt(OCT_STRING+"8",8) );
+ OCT_VALUE += Math.pow(8,POWER)*7;
+}
+for ( OCT_STRING = "-0", OCT_VALUE = 0, POWER = 0; POWER < 15; POWER++, OCT_STRING = OCT_STRING +"7" ) {
+ new TestCase( SECTION, "parseInt("+OCT_STRING+"8,010)", OCT_VALUE, parseInt(OCT_STRING+"8",010) );
+ OCT_VALUE -= Math.pow(8,POWER)*7;
+}
+
+new TestCase( SECTION,
+ "parseInt( '0x' )",
+ NaN,
+ parseInt("0x") );
+
+new TestCase( SECTION,
+ "parseInt( '0X' )",
+ NaN,
+ parseInt("0X") );
+
+new TestCase( SECTION,
+ "parseInt( '11111111112222222222' )",
+ 11111111112222222222,
+ parseInt("11111111112222222222") );
+
+new TestCase( SECTION,
+ "parseInt( '111111111122222222223' )",
+ 111111111122222222220,
+ parseInt("111111111122222222223") );
+
+new TestCase( SECTION,
+ "parseInt( '11111111112222222222',10 )",
+ 11111111112222222222,
+ parseInt("11111111112222222222",10) );
+
+new TestCase( SECTION,
+ "parseInt( '111111111122222222223',10 )",
+ 111111111122222222220,
+ parseInt("111111111122222222223",10) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', -1 )",
+ Number.NaN,
+ parseInt("01234567890",-1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 0 )",
+ Number.NaN,
+ parseInt("01234567890",1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 1 )",
+ Number.NaN,
+ parseInt("01234567890",1) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 2 )",
+ 1,
+ parseInt("01234567890",2) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 3 )",
+ 5,
+ parseInt("01234567890",3) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 4 )",
+ 27,
+ parseInt("01234567890",4) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 5 )",
+ 194,
+ parseInt("01234567890",5) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 6 )",
+ 1865,
+ parseInt("01234567890",6) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 7 )",
+ 22875,
+ parseInt("01234567890",7) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 8 )",
+ 342391,
+ parseInt("01234567890",8) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 9 )",
+ 6053444,
+ parseInt("01234567890",9) );
+
+new TestCase( SECTION,
+ "parseInt( '01234567890', 10 )",
+ 1234567890,
+ parseInt("01234567890",10) );
+
+// need more test cases with hex radix
+
+new TestCase( SECTION,
+ "parseInt( '1234567890', '0xa')",
+ 1234567890,
+ parseInt("1234567890","0xa") );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 11 )",
+ 17715,
+ parseInt("012345",11) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 35 )",
+ 1590195,
+ parseInt("012345",35) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 36 )",
+ 1776965,
+ parseInt("012345",36) );
+
+new TestCase( SECTION,
+ "parseInt( '012345', 37 )",
+ Number.NaN,
+ parseInt("012345",37) );
+
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-2.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-2.js
index 2c0231c235a..8d02dd4ca51 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-2.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,161 +35,160 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.2-1.js
- ECMA Section: 15.1.2.2 Function properties of the global object
- parseInt( string, radix )
+ File Name: 15.1.2.2-1.js
+ ECMA Section: 15.1.2.2 Function properties of the global object
+ parseInt( string, radix )
- Description: parseInt test cases written by waldemar, and documented in
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874.
+ Description: parseInt test cases written by waldemar, and documented in
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=123874.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
var SECTION = "15.1.2.2-2";
var VERSION = "ECMA_1";
- startTest();
+startTest();
var TITLE = "parseInt(string, radix)";
var BUGNUMBER="123874";
writeHeaderToLog( SECTION + " "+ TITLE);
-var testcases = new Array();
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("000000100000000100100011010001010110011110001001101010111100",2)',
- 9027215253084860,
- parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)',
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111101",2));
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("000000100000000100100011010001010110011110001001101010111101",2)',
- 9027215253084860,
- parseInt("000000100000000100100011010001010110011110001001101010111101",2));
+new TestCase( SECTION,
+ 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)',
+ 9027215253084864,
+ parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("000000100000000100100011010001010110011110001001101010111111",2)',
- 9027215253084864,
- parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)',
+ 18054430506169720,
+ parseInt("0000001000000001001000110100010101100111100010011010101111010",2) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0000001000000001001000110100010101100111100010011010101111010",2)',
- 18054430506169720,
- parseInt("0000001000000001001000110100010101100111100010011010101111010",2) );
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111011",2));
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0000001000000001001000110100010101100111100010011010101111011",2)',
- 18054430506169724,
- parseInt("0000001000000001001000110100010101100111100010011010101111011",2));
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)',
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111100",2) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0000001000000001001000110100010101100111100010011010101111100",2)',
- 18054430506169724,
- parseInt("0000001000000001001000110100010101100111100010011010101111100",2) );
+new TestCase( SECTION,
+ 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)',
+ 18054430506169728,
+ parseInt("0000001000000001001000110100010101100111100010011010101111110",2) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0000001000000001001000110100010101100111100010011010101111110",2)',
- 18054430506169728,
- parseInt("0000001000000001001000110100010101100111100010011010101111110",2) );
+new TestCase( SECTION,
+ 'parseInt("yz",35)',
+ 34,
+ parseInt("yz",35) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("yz",35)',
- 34,
- parseInt("yz",35) );
+new TestCase( SECTION,
+ 'parseInt("yz",36)',
+ 1259,
+ parseInt("yz",36) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("yz",36)',
- 1259,
- parseInt("yz",36) );
+new TestCase( SECTION,
+ 'parseInt("yz",37)',
+ NaN,
+ parseInt("yz",37) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("yz",37)',
- NaN,
- parseInt("yz",37) );
+new TestCase( SECTION,
+ 'parseInt("+77")',
+ 77,
+ parseInt("+77") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("+77")',
- 77,
- parseInt("+77") );
+new TestCase( SECTION,
+ 'parseInt("-77",9)',
+ -70,
+ parseInt("-77",9) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("-77",9)',
- -70,
- parseInt("-77",9) );
+new TestCase( SECTION,
+ 'parseInt("\u20001234\u2000")',
+ 1234,
+ parseInt("\u20001234\u2000") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("\u20001234\u2000")',
- 1234,
- parseInt("\u20001234\u2000") );
+new TestCase( SECTION,
+ 'parseInt("123456789012345678")',
+ 123456789012345680,
+ parseInt("123456789012345678") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("123456789012345678")',
- 123456789012345680,
- parseInt("123456789012345678") );
+new TestCase( SECTION,
+ 'parseInt("9",8)',
+ NaN,
+ parseInt("9",8) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("9",8)',
- NaN,
- parseInt("9",8) );
+new TestCase( SECTION,
+ 'parseInt("1e2")',
+ 1,
+ parseInt("1e2") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("1e2")',
- 1,
- parseInt("1e2") );
+new TestCase( SECTION,
+ 'parseInt("1.9999999999999999999")',
+ 1,
+ parseInt("1.9999999999999999999") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("1.9999999999999999999")',
- 1,
- parseInt("1.9999999999999999999") );
+new TestCase( SECTION,
+ 'parseInt("0x10")',
+ 16,
+ parseInt("0x10") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0x10")',
- 16,
- parseInt("0x10") );
+new TestCase( SECTION,
+ 'parseInt("0x10",10)',
+ 0,
+ parseInt("0x10",10));
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0x10",10)',
- 0,
- parseInt("0x10",10));
+new TestCase( SECTION,
+ 'parseInt("0022")',
+ 18,
+ parseInt("0022"));
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0022")',
- 18,
- parseInt("0022"));
+new TestCase( SECTION,
+ 'parseInt("0022",10)',
+ 22,
+ parseInt("0022",10) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0022",10)',
- 22,
- parseInt("0022",10) );
+new TestCase( SECTION,
+ 'parseInt("0x1000000000000080")',
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0x1000000000000080")',
- 1152921504606847000,
- parseInt("0x1000000000000080") );
-
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt("0x1000000000000081")',
- 1152921504606847200,
- parseInt("0x1000000000000081") );
+new TestCase( SECTION,
+ 'parseInt("0x1000000000000081")',
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
s =
"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
s += "0000000000000000000000000000000000000";
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s +"; -s",
- -1.7976931348623157e+308,
- -s );
+new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
s =
"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
s += "0000000000000000000000000000000000001";
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s +"; -s",
- -1.7976931348623157e+308,
- -s );
+new TestCase( SECTION,
+ "s = " + s +"; -s",
+ -1.7976931348623157e+308,
+ -s );
s = "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
@@ -196,52 +196,40 @@ s = "0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000
s += "0000000000000000000000000000000000000"
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s + "; -s",
- -Infinity,
- -s );
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
s = "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
s += "0000000000000000000000000000000000001";
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s + "; -s",
- -1.7976931348623157e+308,
- -s );
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -1.7976931348623157e+308,
+ -s );
s += "0"
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s + "; -s",
- -Infinity,
- -s );
+new TestCase( SECTION,
+ "s = " + s + "; -s",
+ -Infinity,
+ -s );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt(s)',
- Infinity,
- parseInt(s) );
+new TestCase( SECTION,
+ 'parseInt(s)',
+ Infinity,
+ parseInt(s) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt(s,32)',
- 0,
- parseInt(s,32) );
+new TestCase( SECTION,
+ 'parseInt(s,32)',
+ 0,
+ parseInt(s,32) );
-testcases[tc++] = new TestCase( SECTION,
- 'parseInt(s,36)',
- Infinity,
- parseInt(s,36));
+new TestCase( SECTION,
+ 'parseInt(s,36)',
+ Infinity,
+ parseInt(s,36));
test();
-function test( array ) {
- for ( tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-1.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-1.js
index 6b5bd951961..6b99c97b30f 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-1.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,425 +36,403 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.1.2.3.js
- ECMA Section: 15.1.2.3 Function properties of the global object:
- parseFloat( string )
+ File Name: 15.1.2.3.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
- Description: The parseFloat function produces a number value dictated
- by the interpretation of the contents of the string
- argument defined as a decimal literal.
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
- When the parseFloat function is called, the following
- steps are taken:
+ When the parseFloat function is called, the following
+ steps are taken:
- 1. Call ToString( string ).
- 2. Remove leading whitespace Result(1).
- 3. If neither Result(2) nor any prefix of Result(2)
- satisfies the syntax of a StrDecimalLiteral,
- return NaN.
- 4. Compute the longest prefix of Result(2) which might
- be Resusult(2) itself, that satisfies the syntax of
- a StrDecimalLiteral
- 5. Return the number value for the MV of Result(4).
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
- Note that parseFloate may interpret only a leading
- portion of the string as a number value; it ignores any
- characters that cannot be interpreted as part of the
- notation of a decimal literal, and no indication is given
- that such characters were ignored.
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
- StrDecimalLiteral::
- Infinity
- DecimalDigits.DecimalDigits opt ExponentPart opt
- .DecimalDigits ExponentPart opt
- DecimalDigits ExponentPart opt
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "parseFloat(string)";
- var BUGNUMBER= "77391";
+var SECTION = "15.1.2.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "parseFloat(string)";
+var BUGNUMBER= "77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length );
- test();
+new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") );
+new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length );
+new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") );
+new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() );
+new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') );
+new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
- array[item++] = new TestCase( SECTION, "parseFloat.length", 1, parseFloat.length );
+new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") );
+new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') );
- array[item++] = new TestCase( SECTION, "parseFloat.length = null; parseFloat.length", 1, eval("parseFloat.length = null; parseFloat.length") );
- array[item++] = new TestCase( SECTION, "delete parseFloat.length", false, delete parseFloat.length );
- array[item++] = new TestCase( SECTION, "delete parseFloat.length; parseFloat.length", 1, eval("delete parseFloat.length; parseFloat.length") );
- array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in parseFloat ) { MYPROPS += p }; MYPROPS") );
+new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") );
+new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) );
- array[item++] = new TestCase( SECTION, "parseFloat()", Number.NaN, parseFloat() );
- array[item++] = new TestCase( SECTION, "parseFloat('')", Number.NaN, parseFloat('') );
- array[item++] = new TestCase( SECTION, "parseFloat(' ')", Number.NaN, parseFloat(' ') );
- array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
- array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
- array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") );
+new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') );
- array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Infinity, parseFloat("Infinity") );
- array[item++] = new TestCase( SECTION, "parseFloat(' Infinity ')", Infinity, parseFloat(' Infinity ') );
+new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") );
+new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) );
- array[item++] = new TestCase( SECTION, "parseFloat('Infinity')", Infinity, parseFloat("Infinity") );
- array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Infinity, parseFloat(Infinity) );
+new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") );
+new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") );
+new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") );
+new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") );
+new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") );
+new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +Infinity')", +Infinity, parseFloat("+Infinity") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -Infinity ')", -Infinity, parseFloat(' -Infinity ') );
+new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") );
+new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") );
+new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") );
- array[item++] = new TestCase( SECTION, "parseFloat('+Infinity')", +Infinity, parseFloat("+Infinity") );
- array[item++] = new TestCase( SECTION, "parseFloat(-Infinity)", -Infinity, parseFloat(-Infinity) );
+new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") );
+new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") );
+new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") );
- array[item++] = new TestCase( SECTION, "parseFloat('0')", 0, parseFloat("0") );
- array[item++] = new TestCase( SECTION, "parseFloat('-0')", -0, parseFloat("-0") );
- array[item++] = new TestCase( SECTION, "parseFloat('+0')", 0, parseFloat("+0") );
+new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") );
+new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") );
+new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") );
- array[item++] = new TestCase( SECTION, "parseFloat('1')", 1, parseFloat("1") );
- array[item++] = new TestCase( SECTION, "parseFloat('-1')", -1, parseFloat("-1") );
- array[item++] = new TestCase( SECTION, "parseFloat('+1')", 1, parseFloat("+1") );
+new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") );
+new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") );
+new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") );
- array[item++] = new TestCase( SECTION, "parseFloat('2')", 2, parseFloat("2") );
- array[item++] = new TestCase( SECTION, "parseFloat('-2')", -2, parseFloat("-2") );
- array[item++] = new TestCase( SECTION, "parseFloat('+2')", 2, parseFloat("+2") );
+new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") );
+new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") );
+new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") );
- array[item++] = new TestCase( SECTION, "parseFloat('3')", 3, parseFloat("3") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3')", -3, parseFloat("-3") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3')", 3, parseFloat("+3") );
+new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") );
+new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") );
+new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") );
- array[item++] = new TestCase( SECTION, "parseFloat('4')", 4, parseFloat("4") );
- array[item++] = new TestCase( SECTION, "parseFloat('-4')", -4, parseFloat("-4") );
- array[item++] = new TestCase( SECTION, "parseFloat('+4')", 4, parseFloat("+4") );
+new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") );
+new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") );
+new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") );
- array[item++] = new TestCase( SECTION, "parseFloat('5')", 5, parseFloat("5") );
- array[item++] = new TestCase( SECTION, "parseFloat('-5')", -5, parseFloat("-5") );
- array[item++] = new TestCase( SECTION, "parseFloat('+5')", 5, parseFloat("+5") );
+new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") );
+new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") );
+new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") );
- array[item++] = new TestCase( SECTION, "parseFloat('6')", 6, parseFloat("6") );
- array[item++] = new TestCase( SECTION, "parseFloat('-6')", -6, parseFloat("-6") );
- array[item++] = new TestCase( SECTION, "parseFloat('+6')", 6, parseFloat("+6") );
+new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") );
+new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") );
+new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat('7')", 7, parseFloat("7") );
- array[item++] = new TestCase( SECTION, "parseFloat('-7')", -7, parseFloat("-7") );
- array[item++] = new TestCase( SECTION, "parseFloat('+7')", 7, parseFloat("+7") );
+new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") );
+new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") );
+new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") );
- array[item++] = new TestCase( SECTION, "parseFloat('8')", 8, parseFloat("8") );
- array[item++] = new TestCase( SECTION, "parseFloat('-8')", -8, parseFloat("-8") );
- array[item++] = new TestCase( SECTION, "parseFloat('+8')", 8, parseFloat("+8") );
+new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") );
+new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") );
+new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat('9')", 9, parseFloat("9") );
- array[item++] = new TestCase( SECTION, "parseFloat('-9')", -9, parseFloat("-9") );
- array[item++] = new TestCase( SECTION, "parseFloat('+9')", 9, parseFloat("+9") );
+new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") );
+new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") );
+new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat('3.14159')", 3.14159, parseFloat("3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3.14159')", -3.14159, parseFloat("-3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3.14159')", 3.14159, parseFloat("+3.14159") );
+new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") );
+new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") );
+new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat('3.')", 3, parseFloat("3.") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3.')", -3, parseFloat("-3.") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3.')", 3, parseFloat("+3.") );
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat('3.e1')", 30, parseFloat("3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3.e1')", -30, parseFloat("-3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3.e1')", 30, parseFloat("+3.e1") );
+new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") );
+new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") );
+new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") );
- array[item++] = new TestCase( SECTION, "parseFloat('3.e+1')", 30, parseFloat("3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3.e+1')", -30, parseFloat("-3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3.e+1')", 30, parseFloat("+3.e+1") );
+new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") );
+new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") );
+new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") );
- array[item++] = new TestCase( SECTION, "parseFloat('3.e-1')", .30, parseFloat("3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat('-3.e-1')", -.30, parseFloat("-3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat('+3.e-1')", .30, parseFloat("+3.e-1") );
+new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") );
+new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") );
+new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") );
- // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") );
+new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") );
+new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat('.00001')", 0.00001, parseFloat(".00001") );
- array[item++] = new TestCase( SECTION, "parseFloat('+.00001')", 0.00001, parseFloat("+.00001") );
- array[item++] = new TestCase( SECTION, "parseFloat('-0.0001')", -0.00001, parseFloat("-.00001") );
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat('.01e2')", 1, parseFloat(".01e2") );
- array[item++] = new TestCase( SECTION, "parseFloat('+.01e2')", 1, parseFloat("+.01e2") );
- array[item++] = new TestCase( SECTION, "parseFloat('-.01e2')", -1, parseFloat("-.01e2") );
+new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") );
+new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") );
+new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat('.01e+2')", 1, parseFloat(".01e+2") );
- array[item++] = new TestCase( SECTION, "parseFloat('+.01e+2')", 1, parseFloat("+.01e+2") );
- array[item++] = new TestCase( SECTION, "parseFloat('-.01e+2')", -1, parseFloat("-.01e+2") );
+new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") );
+new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") );
+new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") );
- array[item++] = new TestCase( SECTION, "parseFloat('.01e-2')", 0.0001, parseFloat(".01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat('+.01e-2')", 0.0001, parseFloat("+.01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat('-.01e-2')", -0.0001, parseFloat("-.01e-2") );
+new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") );
+new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") );
+new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") );
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat('1234e5')", 123400000, parseFloat("1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat('+1234e5')", 123400000, parseFloat("+1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat('-1234e5')", -123400000, parseFloat("-1234e5") );
+new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) );
+new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) );
- array[item++] = new TestCase( SECTION, "parseFloat('1234e+5')", 123400000, parseFloat("1234e+5") );
- array[item++] = new TestCase( SECTION, "parseFloat('+1234e+5')", 123400000, parseFloat("+1234e+5") );
- array[item++] = new TestCase( SECTION, "parseFloat('-1234e+5')", -123400000, parseFloat("-1234e+5") );
+new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) );
+new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) );
- array[item++] = new TestCase( SECTION, "parseFloat('1234e-5')", 0.01234, parseFloat("1234e-5") );
- array[item++] = new TestCase( SECTION, "parseFloat('+1234e-5')", 0.01234, parseFloat("+1234e-5") );
- array[item++] = new TestCase( SECTION, "parseFloat('-1234e-5')", -0.01234, parseFloat("-1234e-5") );
+new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) );
+new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) );
+new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) );
+new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) );
- array[item++] = new TestCase( SECTION, "parseFloat(0)", 0, parseFloat(0) );
- array[item++] = new TestCase( SECTION, "parseFloat(-0)", -0, parseFloat(-0) );
+new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) );
+new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) );
- array[item++] = new TestCase( SECTION, "parseFloat(1)", 1, parseFloat(1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-1)", -1, parseFloat(-1) );
+new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) );
+new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) );
- array[item++] = new TestCase( SECTION, "parseFloat(2)", 2, parseFloat(2) );
- array[item++] = new TestCase( SECTION, "parseFloat(-2)", -2, parseFloat(-2) );
+new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) );
+new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) );
- array[item++] = new TestCase( SECTION, "parseFloat(3)", 3, parseFloat(3) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3)", -3, parseFloat(-3) );
+new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) );
+new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) );
- array[item++] = new TestCase( SECTION, "parseFloat(4)", 4, parseFloat(4) );
- array[item++] = new TestCase( SECTION, "parseFloat(-4)", -4, parseFloat(-4) );
+new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) );
+new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) );
- array[item++] = new TestCase( SECTION, "parseFloat(5)", 5, parseFloat(5) );
- array[item++] = new TestCase( SECTION, "parseFloat(-5)", -5, parseFloat(-5) );
+new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) );
+new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) );
- array[item++] = new TestCase( SECTION, "parseFloat(6)", 6, parseFloat(6) );
- array[item++] = new TestCase( SECTION, "parseFloat(-6)", -6, parseFloat(-6) );
+new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) );
+new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) );
- array[item++] = new TestCase( SECTION, "parseFloat(7)", 7, parseFloat(7) );
- array[item++] = new TestCase( SECTION, "parseFloat(-7)", -7, parseFloat(-7) );
+new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) );
+new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) );
- array[item++] = new TestCase( SECTION, "parseFloat(8)", 8, parseFloat(8) );
- array[item++] = new TestCase( SECTION, "parseFloat(-8)", -8, parseFloat(-8) );
+new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) );
+new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) );
- array[item++] = new TestCase( SECTION, "parseFloat(9)", 9, parseFloat(9) );
- array[item++] = new TestCase( SECTION, "parseFloat(-9)", -9, parseFloat(-9) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.14159)", 3.14159, parseFloat(3.14159) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.14159)", -3.14159, parseFloat(-3.14159) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.)", 3, parseFloat(3.) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.)", -3, parseFloat(-3.) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.e1)", 30, parseFloat(3.e1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.e1)", -30, parseFloat(-3.e1) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) );
-
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) );
- array[item++] = new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) );
-
- // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
-
- array[item++] = new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) );
- array[item++] = new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) );
- array[item++] = new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) );
- array[item++] = new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) );
- array[item++] = new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) );
-
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
-
- array[item++] = new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) );
- array[item++] = new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) );
- array[item++] = new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) );
-
- array[item++] = new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) );
- array[item++] = new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) );
-
- // hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral)
-
- array[item++] = new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8"));
- array[item++] = new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE"));
- array[item++] = new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF"));
-
- array[item++] = new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8"));
- array[item++] = new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe"));
- array[item++] = new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE"));
- array[item++] = new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF "));
-
- // hex literals should still succeed
-
- array[item++] = new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0));
- array[item++] = new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1));
- array[item++] = new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2));
- array[item++] = new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3));
- array[item++] = new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4));
- array[item++] = new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5));
- array[item++] = new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6));
- array[item++] = new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7));
- array[item++] = new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8));
- array[item++] = new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9));
- array[item++] = new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa));
- array[item++] = new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb));
- array[item++] = new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc));
- array[item++] = new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd));
- array[item++] = new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe));
- array[item++] = new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf));
- array[item++] = new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA));
- array[item++] = new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB));
- array[item++] = new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC));
- array[item++] = new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD));
- array[item++] = new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE));
- array[item++] = new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF));
-
- array[item++] = new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0));
- array[item++] = new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1));
- array[item++] = new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2));
- array[item++] = new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3));
- array[item++] = new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4));
- array[item++] = new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5));
- array[item++] = new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6));
- array[item++] = new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7));
- array[item++] = new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8));
- array[item++] = new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe));
- array[item++] = new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf));
- array[item++] = new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA));
- array[item++] = new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB));
- array[item++] = new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC));
- array[item++] = new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD));
- array[item++] = new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE));
- array[item++] = new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF));
-
-
- // A StringNumericLiteral may not use octal notation
-
- array[item++] = new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00"));
- array[item++] = new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01"));
- array[item++] = new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02"));
- array[item++] = new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03"));
- array[item++] = new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04"));
- array[item++] = new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05"));
- array[item++] = new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06"));
- array[item++] = new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07"));
- array[item++] = new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010"));
- array[item++] = new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011"));
-
- // A StringNumericLIteral may have any number of leading 0 digits
-
- array[item++] = new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001"));
- array[item++] = new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 "));
-
- // an octal numeric literal should be treated as an octal
-
- array[item++] = new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00));
- array[item++] = new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01));
- array[item++] = new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02));
- array[item++] = new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03));
- array[item++] = new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04));
- array[item++] = new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05));
- array[item++] = new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06));
- array[item++] = new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07));
- array[item++] = new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010));
- array[item++] = new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011));
-
- // A StringNumericLIteral may have any number of leading 0 digits
-
- array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
- array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
-
- // make sure it's reflexive
- array[item++] = new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2));
-
- array[item++] = new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+''));
- array[item++] = new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+''));
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION, "parseFloat(3.e+1)", 30, parseFloat(3.e+1) );
+new TestCase( SECTION, "parseFloat(-3.e+1)", -30, parseFloat(-3.e+1) );
+
+new TestCase( SECTION, "parseFloat(3.e-1)", .30, parseFloat(3.e-1) );
+new TestCase( SECTION, "parseFloat(-3.e-1)", -.30, parseFloat(-3.e-1) );
+
+
+new TestCase( SECTION, "parseFloat(3.E1)", 30, parseFloat(3.E1) );
+new TestCase( SECTION, "parseFloat(-3.E1)", -30, parseFloat(-3.E1) );
+
+new TestCase( SECTION, "parseFloat(3.E+1)", 30, parseFloat(3.E+1) );
+new TestCase( SECTION, "parseFloat(-3.E+1)", -30, parseFloat(-3.E+1) );
+
+new TestCase( SECTION, "parseFloat(3.E-1)", .30, parseFloat(3.E-1) );
+new TestCase( SECTION, "parseFloat(-3.E-1)", -.30, parseFloat(-3.E-1) );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(.00001)", 0.00001, parseFloat(.00001) );
+new TestCase( SECTION, "parseFloat(-0.0001)", -0.00001, parseFloat(-.00001) );
+
+new TestCase( SECTION, "parseFloat(.01e2)", 1, parseFloat(.01e2) );
+new TestCase( SECTION, "parseFloat(-.01e2)", -1, parseFloat(-.01e2) );
+
+new TestCase( SECTION, "parseFloat(.01e+2)", 1, parseFloat(.01e+2) );
+new TestCase( SECTION, "parseFloat(-.01e+2)", -1, parseFloat(-.01e+2) );
+
+new TestCase( SECTION, "parseFloat(.01e-2)", 0.0001, parseFloat(.01e-2) );
+new TestCase( SECTION, "parseFloat(-.01e-2)", -0.0001, parseFloat(-.01e-2) );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "parseFloat(1234e5)", 123400000, parseFloat(1234e5) );
+new TestCase( SECTION, "parseFloat(-1234e5)", -123400000, parseFloat(-1234e5) );
+
+new TestCase( SECTION, "parseFloat(1234e+5)", 123400000, parseFloat(1234e+5) );
+new TestCase( SECTION, "parseFloat(-1234e+5)", -123400000, parseFloat(-1234e+5) );
+
+new TestCase( SECTION, "parseFloat(1234e-5)", 0.01234, parseFloat(1234e-5) );
+new TestCase( SECTION, "parseFloat(-1234e-5)", -0.01234, parseFloat(-1234e-5) );
+
+// hex cases should all return 0 (0 is the longest string that satisfies a StringDecimalLiteral)
+
+new TestCase( SECTION, "parseFloat('0x0')", 0, parseFloat("0x0"));
+new TestCase( SECTION, "parseFloat('0x1')", 0, parseFloat("0x1"));
+new TestCase( SECTION, "parseFloat('0x2')", 0, parseFloat("0x2"));
+new TestCase( SECTION, "parseFloat('0x3')", 0, parseFloat("0x3"));
+new TestCase( SECTION, "parseFloat('0x4')", 0, parseFloat("0x4"));
+new TestCase( SECTION, "parseFloat('0x5')", 0, parseFloat("0x5"));
+new TestCase( SECTION, "parseFloat('0x6')", 0, parseFloat("0x6"));
+new TestCase( SECTION, "parseFloat('0x7')", 0, parseFloat("0x7"));
+new TestCase( SECTION, "parseFloat('0x8')", 0, parseFloat("0x8"));
+new TestCase( SECTION, "parseFloat('0x9')", 0, parseFloat("0x9"));
+new TestCase( SECTION, "parseFloat('0xa')", 0, parseFloat("0xa"));
+new TestCase( SECTION, "parseFloat('0xb')", 0, parseFloat("0xb"));
+new TestCase( SECTION, "parseFloat('0xc')", 0, parseFloat("0xc"));
+new TestCase( SECTION, "parseFloat('0xd')", 0, parseFloat("0xd"));
+new TestCase( SECTION, "parseFloat('0xe')", 0, parseFloat("0xe"));
+new TestCase( SECTION, "parseFloat('0xf')", 0, parseFloat("0xf"));
+new TestCase( SECTION, "parseFloat('0xA')", 0, parseFloat("0xA"));
+new TestCase( SECTION, "parseFloat('0xB')", 0, parseFloat("0xB"));
+new TestCase( SECTION, "parseFloat('0xC')", 0, parseFloat("0xC"));
+new TestCase( SECTION, "parseFloat('0xD')", 0, parseFloat("0xD"));
+new TestCase( SECTION, "parseFloat('0xE')", 0, parseFloat("0xE"));
+new TestCase( SECTION, "parseFloat('0xF')", 0, parseFloat("0xF"));
+
+new TestCase( SECTION, "parseFloat('0X0')", 0, parseFloat("0X0"));
+new TestCase( SECTION, "parseFloat('0X1')", 0, parseFloat("0X1"));
+new TestCase( SECTION, "parseFloat('0X2')", 0, parseFloat("0X2"));
+new TestCase( SECTION, "parseFloat('0X3')", 0, parseFloat("0X3"));
+new TestCase( SECTION, "parseFloat('0X4')", 0, parseFloat("0X4"));
+new TestCase( SECTION, "parseFloat('0X5')", 0, parseFloat("0X5"));
+new TestCase( SECTION, "parseFloat('0X6')", 0, parseFloat("0X6"));
+new TestCase( SECTION, "parseFloat('0X7')", 0, parseFloat("0X7"));
+new TestCase( SECTION, "parseFloat('0X8')", 0, parseFloat("0X8"));
+new TestCase( SECTION, "parseFloat('0X9')", 0, parseFloat("0X9"));
+new TestCase( SECTION, "parseFloat('0Xa')", 0, parseFloat("0Xa"));
+new TestCase( SECTION, "parseFloat('0Xb')", 0, parseFloat("0Xb"));
+new TestCase( SECTION, "parseFloat('0Xc')", 0, parseFloat("0Xc"));
+new TestCase( SECTION, "parseFloat('0Xd')", 0, parseFloat("0Xd"));
+new TestCase( SECTION, "parseFloat('0Xe')", 0, parseFloat("0Xe"));
+new TestCase( SECTION, "parseFloat('0Xf')", 0, parseFloat("0Xf"));
+new TestCase( SECTION, "parseFloat('0XA')", 0, parseFloat("0XA"));
+new TestCase( SECTION, "parseFloat('0XB')", 0, parseFloat("0XB"));
+new TestCase( SECTION, "parseFloat('0XC')", 0, parseFloat("0XC"));
+new TestCase( SECTION, "parseFloat('0XD')", 0, parseFloat("0XD"));
+new TestCase( SECTION, "parseFloat('0XE')", 0, parseFloat("0XE"));
+new TestCase( SECTION, "parseFloat('0XF')", 0, parseFloat("0XF"));
+new TestCase( SECTION, "parseFloat(' 0XF ')", 0, parseFloat(" 0XF "));
+
+// hex literals should still succeed
+
+new TestCase( SECTION, "parseFloat(0x0)", 0, parseFloat(0x0));
+new TestCase( SECTION, "parseFloat(0x1)", 1, parseFloat(0x1));
+new TestCase( SECTION, "parseFloat(0x2)", 2, parseFloat(0x2));
+new TestCase( SECTION, "parseFloat(0x3)", 3, parseFloat(0x3));
+new TestCase( SECTION, "parseFloat(0x4)", 4, parseFloat(0x4));
+new TestCase( SECTION, "parseFloat(0x5)", 5, parseFloat(0x5));
+new TestCase( SECTION, "parseFloat(0x6)", 6, parseFloat(0x6));
+new TestCase( SECTION, "parseFloat(0x7)", 7, parseFloat(0x7));
+new TestCase( SECTION, "parseFloat(0x8)", 8, parseFloat(0x8));
+new TestCase( SECTION, "parseFloat(0x9)", 9, parseFloat(0x9));
+new TestCase( SECTION, "parseFloat(0xa)", 10, parseFloat(0xa));
+new TestCase( SECTION, "parseFloat(0xb)", 11, parseFloat(0xb));
+new TestCase( SECTION, "parseFloat(0xc)", 12, parseFloat(0xc));
+new TestCase( SECTION, "parseFloat(0xd)", 13, parseFloat(0xd));
+new TestCase( SECTION, "parseFloat(0xe)", 14, parseFloat(0xe));
+new TestCase( SECTION, "parseFloat(0xf)", 15, parseFloat(0xf));
+new TestCase( SECTION, "parseFloat(0xA)", 10, parseFloat(0xA));
+new TestCase( SECTION, "parseFloat(0xB)", 11, parseFloat(0xB));
+new TestCase( SECTION, "parseFloat(0xC)", 12, parseFloat(0xC));
+new TestCase( SECTION, "parseFloat(0xD)", 13, parseFloat(0xD));
+new TestCase( SECTION, "parseFloat(0xE)", 14, parseFloat(0xE));
+new TestCase( SECTION, "parseFloat(0xF)", 15, parseFloat(0xF));
+
+new TestCase( SECTION, "parseFloat(0X0)", 0, parseFloat(0X0));
+new TestCase( SECTION, "parseFloat(0X1)", 1, parseFloat(0X1));
+new TestCase( SECTION, "parseFloat(0X2)", 2, parseFloat(0X2));
+new TestCase( SECTION, "parseFloat(0X3)", 3, parseFloat(0X3));
+new TestCase( SECTION, "parseFloat(0X4)", 4, parseFloat(0X4));
+new TestCase( SECTION, "parseFloat(0X5)", 5, parseFloat(0X5));
+new TestCase( SECTION, "parseFloat(0X6)", 6, parseFloat(0X6));
+new TestCase( SECTION, "parseFloat(0X7)", 7, parseFloat(0X7));
+new TestCase( SECTION, "parseFloat(0X8)", 8, parseFloat(0X8));
+new TestCase( SECTION, "parseFloat(0X9)", 9, parseFloat(0X9));
+new TestCase( SECTION, "parseFloat(0Xa)", 10, parseFloat(0Xa));
+new TestCase( SECTION, "parseFloat(0Xb)", 11, parseFloat(0Xb));
+new TestCase( SECTION, "parseFloat(0Xc)", 12, parseFloat(0Xc));
+new TestCase( SECTION, "parseFloat(0Xd)", 13, parseFloat(0Xd));
+new TestCase( SECTION, "parseFloat(0Xe)", 14, parseFloat(0Xe));
+new TestCase( SECTION, "parseFloat(0Xf)", 15, parseFloat(0Xf));
+new TestCase( SECTION, "parseFloat(0XA)", 10, parseFloat(0XA));
+new TestCase( SECTION, "parseFloat(0XB)", 11, parseFloat(0XB));
+new TestCase( SECTION, "parseFloat(0XC)", 12, parseFloat(0XC));
+new TestCase( SECTION, "parseFloat(0XD)", 13, parseFloat(0XD));
+new TestCase( SECTION, "parseFloat(0XE)", 14, parseFloat(0XE));
+new TestCase( SECTION, "parseFloat(0XF)", 15, parseFloat(0XF));
+
+
+// A StringNumericLiteral may not use octal notation
+
+new TestCase( SECTION, "parseFloat('00')", 0, parseFloat("00"));
+new TestCase( SECTION, "parseFloat('01')", 1, parseFloat("01"));
+new TestCase( SECTION, "parseFloat('02')", 2, parseFloat("02"));
+new TestCase( SECTION, "parseFloat('03')", 3, parseFloat("03"));
+new TestCase( SECTION, "parseFloat('04')", 4, parseFloat("04"));
+new TestCase( SECTION, "parseFloat('05')", 5, parseFloat("05"));
+new TestCase( SECTION, "parseFloat('06')", 6, parseFloat("06"));
+new TestCase( SECTION, "parseFloat('07')", 7, parseFloat("07"));
+new TestCase( SECTION, "parseFloat('010')", 10, parseFloat("010"));
+new TestCase( SECTION, "parseFloat('011')", 11, parseFloat("011"));
+
+// A StringNumericLIteral may have any number of leading 0 digits
+
+new TestCase( SECTION, "parseFloat('001')", 1, parseFloat("001"));
+new TestCase( SECTION, "parseFloat('0001')", 1, parseFloat("0001"));
+new TestCase( SECTION, "parseFloat(' 0001 ')", 1, parseFloat(" 0001 "));
+
+// an octal numeric literal should be treated as an octal
+
+new TestCase( SECTION, "parseFloat(00)", 0, parseFloat(00));
+new TestCase( SECTION, "parseFloat(01)", 1, parseFloat(01));
+new TestCase( SECTION, "parseFloat(02)", 2, parseFloat(02));
+new TestCase( SECTION, "parseFloat(03)", 3, parseFloat(03));
+new TestCase( SECTION, "parseFloat(04)", 4, parseFloat(04));
+new TestCase( SECTION, "parseFloat(05)", 5, parseFloat(05));
+new TestCase( SECTION, "parseFloat(06)", 6, parseFloat(06));
+new TestCase( SECTION, "parseFloat(07)", 7, parseFloat(07));
+new TestCase( SECTION, "parseFloat(010)", 8, parseFloat(010));
+new TestCase( SECTION, "parseFloat(011)", 9, parseFloat(011));
+
+// A StringNumericLIteral may have any number of leading 0 digits
+
+new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
+new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
+
+// make sure it's reflexive
+new TestCase( SECTION, "parseFloat(Math.PI)", Math.PI, parseFloat(Math.PI));
+new TestCase( SECTION, "parseFloat(Math.LN2)", Math.LN2, parseFloat(Math.LN2));
+new TestCase( SECTION, "parseFloat(Math.LN10)", Math.LN10, parseFloat(Math.LN10));
+new TestCase( SECTION, "parseFloat(Math.LOG2E)", Math.LOG2E, parseFloat(Math.LOG2E));
+new TestCase( SECTION, "parseFloat(Math.LOG10E)", Math.LOG10E, parseFloat(Math.LOG10E));
+new TestCase( SECTION, "parseFloat(Math.SQRT2)", Math.SQRT2, parseFloat(Math.SQRT2));
+new TestCase( SECTION, "parseFloat(Math.SQRT1_2)", Math.SQRT1_2, parseFloat(Math.SQRT1_2));
+
+new TestCase( SECTION, "parseFloat(Math.PI+'')", Math.PI, parseFloat(Math.PI+''));
+new TestCase( SECTION, "parseFloat(Math.LN2+'')", Math.LN2, parseFloat(Math.LN2+''));
+new TestCase( SECTION, "parseFloat(Math.LN10+'')", Math.LN10, parseFloat(Math.LN10+''));
+new TestCase( SECTION, "parseFloat(Math.LOG2E+'')", Math.LOG2E, parseFloat(Math.LOG2E+''));
+new TestCase( SECTION, "parseFloat(Math.LOG10E+'')", Math.LOG10E, parseFloat(Math.LOG10E+''));
+new TestCase( SECTION, "parseFloat(Math.SQRT2+'')", Math.SQRT2, parseFloat(Math.SQRT2+''));
+new TestCase( SECTION, "parseFloat(Math.SQRT1_2+'')", Math.SQRT1_2, parseFloat(Math.SQRT1_2+''));
+
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-2.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-2.js
index b54b821945c..2340af97c5b 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-2.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,276 +36,253 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.1.2.3-2.js
- ECMA Section: 15.1.2.3 Function properties of the global object:
- parseFloat( string )
+ File Name: 15.1.2.3-2.js
+ ECMA Section: 15.1.2.3 Function properties of the global object:
+ parseFloat( string )
- Description: The parseFloat function produces a number value dictated
- by the interpretation of the contents of the string
- argument defined as a decimal literal.
+ Description: The parseFloat function produces a number value dictated
+ by the interpretation of the contents of the string
+ argument defined as a decimal literal.
- When the parseFloat function is called, the following
- steps are taken:
+ When the parseFloat function is called, the following
+ steps are taken:
- 1. Call ToString( string ).
- 2. Remove leading whitespace Result(1).
- 3. If neither Result(2) nor any prefix of Result(2)
- satisfies the syntax of a StrDecimalLiteral,
- return NaN.
- 4. Compute the longest prefix of Result(2) which might
- be Resusult(2) itself, that satisfies the syntax of
- a StrDecimalLiteral
- 5. Return the number value for the MV of Result(4).
+ 1. Call ToString( string ).
+ 2. Remove leading whitespace Result(1).
+ 3. If neither Result(2) nor any prefix of Result(2)
+ satisfies the syntax of a StrDecimalLiteral,
+ return NaN.
+ 4. Compute the longest prefix of Result(2) which might
+ be Resusult(2) itself, that satisfies the syntax of
+ a StrDecimalLiteral
+ 5. Return the number value for the MV of Result(4).
- Note that parseFloate may interpret only a leading
- portion of the string as a number value; it ignores any
- characters that cannot be interpreted as part of the
- notation of a decimal literal, and no indication is given
- that such characters were ignored.
+ Note that parseFloate may interpret only a leading
+ portion of the string as a number value; it ignores any
+ characters that cannot be interpreted as part of the
+ notation of a decimal literal, and no indication is given
+ that such characters were ignored.
- StrDecimalLiteral::
- Infinity
- DecimalDigits.DecimalDigits opt ExponentPart opt
- .DecimalDigits ExponentPart opt
- DecimalDigits ExponentPart opt
+ StrDecimalLiteral::
+ Infinity
+ DecimalDigits.DecimalDigits opt ExponentPart opt
+ .DecimalDigits ExponentPart opt
+ DecimalDigits ExponentPart opt
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.3-2";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.1.2.3-2";
+var VERSION = "ECMA_1";
+startTest();
- var BUGNUMBER = "77391";
+var BUGNUMBER = "77391";
- var testcases = getTestCases();
+new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
+new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
+new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
- writeHeaderToLog( SECTION + " parseFloat(string)");
- test();
+new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") );
+// new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") );
+new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") );
+new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") );
- array[item++] = new TestCase( SECTION, "parseFloat(true)", Number.NaN, parseFloat(true) );
- array[item++] = new TestCase( SECTION, "parseFloat(false)", Number.NaN, parseFloat(false) );
- array[item++] = new TestCase( SECTION, "parseFloat('string')", Number.NaN, parseFloat("string") );
+new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") );
+new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") );
+new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' Infinity')", Number.POSITIVE_INFINITY, parseFloat("Infinity") );
-// array[item++] = new TestCase( SECTION, "parseFloat(Infinity)", Number.POSITIVE_INFINITY, parseFloat(Infinity) );
+new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") );
+new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") );
+new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 0')", 0, parseFloat(" 0") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -0')", -0, parseFloat(" -0") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +0')", 0, parseFloat(" +0") );
+new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") );
+new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") );
+new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 1')", 1, parseFloat(" 1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1')", -1, parseFloat(" -1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1')", 1, parseFloat(" +1") );
+new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") );
+new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") );
+new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 2')", 2, parseFloat(" 2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -2')", -2, parseFloat(" -2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +2')", 2, parseFloat(" +2") );
+new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") );
+new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") );
+new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 3')", 3, parseFloat(" 3") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3')", -3, parseFloat(" -3") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3')", 3, parseFloat(" +3") );
+new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") );
+new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") );
+new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 4')", 4, parseFloat(" 4") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -4')", -4, parseFloat(" -4") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +4')", 4, parseFloat(" +4") );
+new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") );
+new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") );
+new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 5')", 5, parseFloat(" 5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -5')", -5, parseFloat(" -5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +5')", 5, parseFloat(" +5") );
+new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") );
+new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") );
+new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 6')", 6, parseFloat(" 6") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -6')", -6, parseFloat(" -6") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +6')", 6, parseFloat(" +6") );
+new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") );
+new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") );
+new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 7')", 7, parseFloat(" 7") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -7')", -7, parseFloat(" -7") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +7')", 7, parseFloat(" +7") );
+new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") );
+new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") );
+new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 8')", 8, parseFloat(" 8") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -8')", -8, parseFloat(" -8") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +8')", 8, parseFloat(" +8") );
+new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") );
+new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") );
+new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 9')", 9, parseFloat(" 9") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -9')", -9, parseFloat(" -9") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +9')", 9, parseFloat(" +9") );
+new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") );
+new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") );
+new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 3.14159')", 3.14159, parseFloat(" 3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3.14159')", -3.14159, parseFloat(" -3.14159") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3.14159')", 3.14159, parseFloat(" +3.14159") );
+new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") );
+new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") );
+new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 3.')", 3, parseFloat(" 3.") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3.')", -3, parseFloat(" -3.") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3.')", 3, parseFloat(" +3.") );
+new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") );
+new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") );
+new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 3.e1')", 30, parseFloat(" 3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3.e1')", -30, parseFloat(" -3.e1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3.e1')", 30, parseFloat(" +3.e1") );
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat(' 3.e+1')", 30, parseFloat(" 3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3.e+1')", -30, parseFloat(" -3.e+1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3.e+1')", 30, parseFloat(" +3.e+1") );
+new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") );
+new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") );
+new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 3.e-1')", .30, parseFloat(" 3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -3.e-1')", -.30, parseFloat(" -3.e-1") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +3.e-1')", .30, parseFloat(" +3.e-1") );
+new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") );
+new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") );
+new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") );
- // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") );
+new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") );
+new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .00001')", 0.00001, parseFloat(" .00001") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.00001')", 0.00001, parseFloat(" +.00001") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -0.0001')", -0.00001, parseFloat(" -.00001") );
+new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") );
+new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") );
+new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .01e2')", 1, parseFloat(" .01e2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01e2')", 1, parseFloat(" +.01e2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01e2')", -1, parseFloat(" -.01e2") );
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat(' .01e+2')", 1, parseFloat(" .01e+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01e+2')", 1, parseFloat(" +.01e+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01e+2')", -1, parseFloat(" -.01e+2") );
+new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") );
+new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") );
+new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .01e-2')", 0.0001, parseFloat(" .01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01e-2')", 0.0001, parseFloat(" +.01e-2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01e-2')", -0.0001, parseFloat(" -.01e-2") );
+new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") );
+new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") );
+new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") );
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
-
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234e5')", 123400000, parseFloat(" 1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234e5')", 123400000, parseFloat(" +1234e5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234e5')", -123400000, parseFloat(" -1234e5") );
-
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234e+5')", 123400000, parseFloat(" 1234e+5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234e+5')", 123400000, parseFloat(" +1234e+5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234e+5')", -123400000, parseFloat(" -1234e+5") );
-
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") );
+new TestCase( SECTION, "parseFloat(' 1234e-5')", 0.01234, parseFloat(" 1234e-5") );
+new TestCase( SECTION, "parseFloat(' +1234e-5')", 0.01234, parseFloat(" +1234e-5") );
+new TestCase( SECTION, "parseFloat(' -1234e-5')", -0.01234, parseFloat(" -1234e-5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") );
+new TestCase( SECTION, "parseFloat(' .01E2')", 1, parseFloat(" .01E2") );
+new TestCase( SECTION, "parseFloat(' +.01E2')", 1, parseFloat(" +.01E2") );
+new TestCase( SECTION, "parseFloat(' -.01E2')", -1, parseFloat(" -.01E2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") );
+new TestCase( SECTION, "parseFloat(' .01E+2')", 1, parseFloat(" .01E+2") );
+new TestCase( SECTION, "parseFloat(' +.01E+2')", 1, parseFloat(" +.01E+2") );
+new TestCase( SECTION, "parseFloat(' -.01E+2')", -1, parseFloat(" -.01E+2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") );
+new TestCase( SECTION, "parseFloat(' .01E-2')", 0.0001, parseFloat(" .01E-2") );
+new TestCase( SECTION, "parseFloat(' +.01E-2')", 0.0001, parseFloat(" +.01E-2") );
+new TestCase( SECTION, "parseFloat(' -.01E-2')", -0.0001, parseFloat(" -.01E-2") );
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") );
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+new TestCase( SECTION, "parseFloat(' 1234E5')", 123400000, parseFloat(" 1234E5") );
+new TestCase( SECTION, "parseFloat(' +1234E5')", 123400000, parseFloat(" +1234E5") );
+new TestCase( SECTION, "parseFloat(' -1234E5')", -123400000, parseFloat(" -1234E5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") );
+new TestCase( SECTION, "parseFloat(' 1234E+5')", 123400000, parseFloat(" 1234E+5") );
+new TestCase( SECTION, "parseFloat(' +1234E+5')", 123400000, parseFloat(" +1234E+5") );
+new TestCase( SECTION, "parseFloat(' -1234E+5')", -123400000, parseFloat(" -1234E+5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") );
- array[item++] = new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") );
+new TestCase( SECTION, "parseFloat(' 1234E-5')", 0.01234, parseFloat(" 1234E-5") );
+new TestCase( SECTION, "parseFloat(' +1234E-5')", 0.01234, parseFloat(" +1234E-5") );
+new TestCase( SECTION, "parseFloat(' -1234E-5')", -0.01234, parseFloat(" -1234E-5") );
- // hex cases should all return NaN
+// hex cases should all return NaN
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF"));
+new TestCase( SECTION, "parseFloat(' 0x0')", 0, parseFloat(" 0x0"));
+new TestCase( SECTION, "parseFloat(' 0x1')", 0, parseFloat(" 0x1"));
+new TestCase( SECTION, "parseFloat(' 0x2')", 0, parseFloat(" 0x2"));
+new TestCase( SECTION, "parseFloat(' 0x3')", 0, parseFloat(" 0x3"));
+new TestCase( SECTION, "parseFloat(' 0x4')", 0, parseFloat(" 0x4"));
+new TestCase( SECTION, "parseFloat(' 0x5')", 0, parseFloat(" 0x5"));
+new TestCase( SECTION, "parseFloat(' 0x6')", 0, parseFloat(" 0x6"));
+new TestCase( SECTION, "parseFloat(' 0x7')", 0, parseFloat(" 0x7"));
+new TestCase( SECTION, "parseFloat(' 0x8')", 0, parseFloat(" 0x8"));
+new TestCase( SECTION, "parseFloat(' 0x9')", 0, parseFloat(" 0x9"));
+new TestCase( SECTION, "parseFloat(' 0xa')", 0, parseFloat(" 0xa"));
+new TestCase( SECTION, "parseFloat(' 0xb')", 0, parseFloat(" 0xb"));
+new TestCase( SECTION, "parseFloat(' 0xc')", 0, parseFloat(" 0xc"));
+new TestCase( SECTION, "parseFloat(' 0xd')", 0, parseFloat(" 0xd"));
+new TestCase( SECTION, "parseFloat(' 0xe')", 0, parseFloat(" 0xe"));
+new TestCase( SECTION, "parseFloat(' 0xf')", 0, parseFloat(" 0xf"));
+new TestCase( SECTION, "parseFloat(' 0xA')", 0, parseFloat(" 0xA"));
+new TestCase( SECTION, "parseFloat(' 0xB')", 0, parseFloat(" 0xB"));
+new TestCase( SECTION, "parseFloat(' 0xC')", 0, parseFloat(" 0xC"));
+new TestCase( SECTION, "parseFloat(' 0xD')", 0, parseFloat(" 0xD"));
+new TestCase( SECTION, "parseFloat(' 0xE')", 0, parseFloat(" 0xE"));
+new TestCase( SECTION, "parseFloat(' 0xF')", 0, parseFloat(" 0xF"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF"));
+new TestCase( SECTION, "parseFloat(' 0X0')", 0, parseFloat(" 0X0"));
+new TestCase( SECTION, "parseFloat(' 0X1')", 0, parseFloat(" 0X1"));
+new TestCase( SECTION, "parseFloat(' 0X2')", 0, parseFloat(" 0X2"));
+new TestCase( SECTION, "parseFloat(' 0X3')", 0, parseFloat(" 0X3"));
+new TestCase( SECTION, "parseFloat(' 0X4')", 0, parseFloat(" 0X4"));
+new TestCase( SECTION, "parseFloat(' 0X5')", 0, parseFloat(" 0X5"));
+new TestCase( SECTION, "parseFloat(' 0X6')", 0, parseFloat(" 0X6"));
+new TestCase( SECTION, "parseFloat(' 0X7')", 0, parseFloat(" 0X7"));
+new TestCase( SECTION, "parseFloat(' 0X8')", 0, parseFloat(" 0X8"));
+new TestCase( SECTION, "parseFloat(' 0X9')", 0, parseFloat(" 0X9"));
+new TestCase( SECTION, "parseFloat(' 0Xa')", 0, parseFloat(" 0Xa"));
+new TestCase( SECTION, "parseFloat(' 0Xb')", 0, parseFloat(" 0Xb"));
+new TestCase( SECTION, "parseFloat(' 0Xc')", 0, parseFloat(" 0Xc"));
+new TestCase( SECTION, "parseFloat(' 0Xd')", 0, parseFloat(" 0Xd"));
+new TestCase( SECTION, "parseFloat(' 0Xe')", 0, parseFloat(" 0Xe"));
+new TestCase( SECTION, "parseFloat(' 0Xf')", 0, parseFloat(" 0Xf"));
+new TestCase( SECTION, "parseFloat(' 0XA')", 0, parseFloat(" 0XA"));
+new TestCase( SECTION, "parseFloat(' 0XB')", 0, parseFloat(" 0XB"));
+new TestCase( SECTION, "parseFloat(' 0XC')", 0, parseFloat(" 0XC"));
+new TestCase( SECTION, "parseFloat(' 0XD')", 0, parseFloat(" 0XD"));
+new TestCase( SECTION, "parseFloat(' 0XE')", 0, parseFloat(" 0XE"));
+new TestCase( SECTION, "parseFloat(' 0XF')", 0, parseFloat(" 0XF"));
- // A StringNumericLiteral may not use octal notation
+// A StringNumericLiteral may not use octal notation
- array[item++] = new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011"));
+new TestCase( SECTION, "parseFloat(' 00')", 0, parseFloat(" 00"));
+new TestCase( SECTION, "parseFloat(' 01')", 1, parseFloat(" 01"));
+new TestCase( SECTION, "parseFloat(' 02')", 2, parseFloat(" 02"));
+new TestCase( SECTION, "parseFloat(' 03')", 3, parseFloat(" 03"));
+new TestCase( SECTION, "parseFloat(' 04')", 4, parseFloat(" 04"));
+new TestCase( SECTION, "parseFloat(' 05')", 5, parseFloat(" 05"));
+new TestCase( SECTION, "parseFloat(' 06')", 6, parseFloat(" 06"));
+new TestCase( SECTION, "parseFloat(' 07')", 7, parseFloat(" 07"));
+new TestCase( SECTION, "parseFloat(' 010')", 10, parseFloat(" 010"));
+new TestCase( SECTION, "parseFloat(' 011')", 11, parseFloat(" 011"));
- // A StringNumericLIteral may have any number of leading 0 digits
+// A StringNumericLIteral may have any number of leading 0 digits
- array[item++] = new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001"));
- array[item++] = new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001"));
+new TestCase( SECTION, "parseFloat(' 001')", 1, parseFloat(" 001"));
+new TestCase( SECTION, "parseFloat(' 0001')", 1, parseFloat(" 0001"));
- // A StringNumericLIteral may have any number of leading 0 digits
+// A StringNumericLIteral may have any number of leading 0 digits
- array[item++] = new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
- array[item++] = new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
+new TestCase( SECTION, "parseFloat(001)", 1, parseFloat(001));
+new TestCase( SECTION, "parseFloat(0001)", 1, parseFloat(0001));
- // make sure it' s reflexive
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' '));
- array[item++] = new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' '));
+// make sure it' s reflexive
+new TestCase( SECTION, "parseFloat( ' ' +Math.PI+' ')", Math.PI, parseFloat( ' ' +Math.PI+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LN2+' ')", Math.LN2, parseFloat( ' ' +Math.LN2+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LN10+' ')", Math.LN10, parseFloat( ' ' +Math.LN10+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LOG2E+' ')", Math.LOG2E, parseFloat( ' ' +Math.LOG2E+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.LOG10E+' ')", Math.LOG10E, parseFloat( ' ' +Math.LOG10E+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT2+' ')", Math.SQRT2, parseFloat( ' ' +Math.SQRT2+' '));
+new TestCase( SECTION, "parseFloat( ' ' +Math.SQRT1_2+' ')", Math.SQRT1_2, parseFloat( ' ' +Math.SQRT1_2+' '));
-
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.4.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.4.js
index 720bc119eb9..0ee2860dba7 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.4.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,188 +35,169 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.4.js
- ECMA Section: 15.1.2.4 Function properties of the global object
- escape( string )
+ File Name: 15.1.2.4.js
+ ECMA Section: 15.1.2.4 Function properties of the global object
+ escape( string )
- Description:
- The escape function computes a new version of a string value in which
- certain characters have been replaced by a hexadecimal escape sequence.
- The result thus contains no special characters that might have special
- meaning within a URL.
+ Description:
+ The escape function computes a new version of a string value in which
+ certain characters have been replaced by a hexadecimal escape sequence.
+ The result thus contains no special characters that might have special
+ meaning within a URL.
- For characters whose Unicode encoding is 0xFF or less, a two-digit
- escape sequence of the form %xx is used in accordance with RFC1738.
- For characters whose Unicode encoding is greater than 0xFF, a four-
- digit escape sequence of the form %uxxxx is used.
+ For characters whose Unicode encoding is 0xFF or less, a two-digit
+ escape sequence of the form %xx is used in accordance with RFC1738.
+ For characters whose Unicode encoding is greater than 0xFF, a four-
+ digit escape sequence of the form %uxxxx is used.
- When the escape function is called with one argument string, the
- following steps are taken:
+ When the escape function is called with one argument string, the
+ following steps are taken:
- 1. Call ToString(string).
- 2. Compute the number of characters in Result(1).
- 3. Let R be the empty string.
- 4. Let k be 0.
- 5. If k equals Result(2), return R.
- 6. Get the character at position k within Result(1).
- 7. If Result(6) is one of the 69 nonblank ASCII characters
- ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
- 0123456789 @*_+-./, go to step 14.
- 8. Compute the 16-bit unsigned integer that is the Unicode character
- encoding of Result(6).
- 9. If Result(8), is less than 256, go to step 12.
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Get the character at position k within Result(1).
+ 7. If Result(6) is one of the 69 nonblank ASCII characters
+ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
+ 0123456789 @*_+-./, go to step 14.
+ 8. Compute the 16-bit unsigned integer that is the Unicode character
+ encoding of Result(6).
+ 9. If Result(8), is less than 256, go to step 12.
10. Let S be a string containing six characters "%uwxyz" where wxyz are
- four hexadecimal digits encoding the value of Result(8).
+ four hexadecimal digits encoding the value of Result(8).
11. Go to step 15.
12. Let S be a string containing three characters "%xy" where xy are two
- hexadecimal digits encoding the value of Result(8).
+ hexadecimal digits encoding the value of Result(8).
13. Go to step 15.
14. Let S be a string containing the single character Result(6).
15. Let R be a new string value computed by concatenating the previous value
- of R and S.
+ of R and S.
16. Increase k by 1.
17. Go to step 5.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "escape(string)";
+var SECTION = "15.1.2.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "escape(string)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "escape.length", 1, escape.length );
+new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") );
+new TestCase( SECTION, "delete escape.length", false, delete escape.length );
+new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") );
- test();
+new TestCase( SECTION, "escape()", "undefined", escape() );
+new TestCase( SECTION, "escape('')", "", escape('') );
+new TestCase( SECTION, "escape( null )", "null", escape(null) );
+new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) );
+new TestCase( SECTION, "escape( true )", "true", escape( true ) );
+new TestCase( SECTION, "escape( false )", "false", escape( false ) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) );
+new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) );
- array[item++] = new TestCase( SECTION, "escape.length", 1, escape.length );
- array[item++] = new TestCase( SECTION, "escape.length = null; escape.length", 1, eval("escape.length = null; escape.length") );
- array[item++] = new TestCase( SECTION, "delete escape.length", false, delete escape.length );
- array[item++] = new TestCase( SECTION, "delete escape.length; escape.length", 1, eval("delete escape.length; escape.length") );
- array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS", "", eval("var MYPROPS=''; for ( var p in escape ) { MYPROPS+= p}; MYPROPS") );
+new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) );
+new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) );
+new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) );
+new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "escape()", "undefined", escape() );
- array[item++] = new TestCase( SECTION, "escape('')", "", escape('') );
- array[item++] = new TestCase( SECTION, "escape( null )", "null", escape(null) );
- array[item++] = new TestCase( SECTION, "escape( void 0 )", "undefined", escape(void 0) );
- array[item++] = new TestCase( SECTION, "escape( true )", "true", escape( true ) );
- array[item++] = new TestCase( SECTION, "escape( false )", "false", escape( false ) );
+var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
- array[item++] = new TestCase( SECTION, "escape( new Boolean(true) )", "true", escape(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "escape( new Boolean(false) )", "false", escape(new Boolean(false)) );
+new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) );
- array[item++] = new TestCase( SECTION, "escape( Number.NaN )", "NaN", escape(Number.NaN) );
- array[item++] = new TestCase( SECTION, "escape( -0 )", "0", escape( -0 ) );
- array[item++] = new TestCase( SECTION, "escape( 'Infinity' )", "Infinity", escape( "Infinity" ) );
- array[item++] = new TestCase( SECTION, "escape( Number.POSITIVE_INFINITY )", "Infinity", escape( Number.POSITIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "escape( Number.NEGATIVE_INFINITY )", "-Infinity", escape( Number.NEGATIVE_INFINITY ) );
+// ASCII value less than
- var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
-
- array[item++] = new TestCase( SECTION, "escape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, escape( ASCII_TEST_STRING ) );
-
- // ASCII value less than
-
- for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "escape(String.fromCharCode("+CHARCODE+"))",
- "%"+ToHexString(CHARCODE),
- escape(String.fromCharCode(CHARCODE)) );
- }
- for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "escape(String.fromCharCode("+CHARCODE+"))",
- "%"+ToHexString(CHARCODE),
- escape(String.fromCharCode(CHARCODE)) );
- }
-
- for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "escape(String.fromCharCode("+CHARCODE+"))",
- "%u"+ ToUnicodeString(CHARCODE),
- escape(String.fromCharCode(CHARCODE)) );
- }
- for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "escape(String.fromCharCode("+CHARCODE+"))",
- "%u"+ ToUnicodeString(CHARCODE),
- escape(String.fromCharCode(CHARCODE)) );
- }
-
- return ( array );
+for ( var CHARCODE = 0; CHARCODE < 32; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
}
+for ( var CHARCODE = 128; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%"+ToHexString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+
+for ( var CHARCODE = 256; CHARCODE < 1024; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+for ( var CHARCODE = 65500; CHARCODE < 65536; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "escape(String.fromCharCode("+CHARCODE+"))",
+ "%u"+ ToUnicodeString(CHARCODE),
+ escape(String.fromCharCode(CHARCODE)) );
+}
+
+test();
function ToUnicodeString( n ) {
- var string = ToHexString(n);
+ var string = ToHexString(n);
- for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
- string = "0" + string;
- }
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
- return string;
+ return string;
}
function ToHexString( n ) {
- var hex = new Array();
+ var hex = new Array();
- for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
- ;
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
}
+ }
- for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
- hex[index] = Math.floor( n / Math.pow(16,mag) );
- n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
- }
-
- hex[hex.length] = n % 16;
-
- var string ="";
-
- for ( var index = 0 ; index < hex.length ; index++ ) {
- switch ( hex[index] ) {
- case 10:
- string += "A";
- break;
- case 11:
- string += "B";
- break;
- case 12:
- string += "C";
- break;
- case 13:
- string += "D";
- break;
- case 14:
- string += "E";
- break;
- case 15:
- string += "F";
- break;
- default:
- string += hex[index];
- }
- }
-
- if ( string.length == 1 ) {
- string = "0" + string;
- }
- return string;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-1.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-1.js
index 63540c2c1d4..1d0e20a1041 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-1.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,189 +35,170 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.5-1.js
- ECMA Section: 15.1.2.5 Function properties of the global object
- unescape( string )
+ File Name: 15.1.2.5-1.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
- Description:
- The unescape function computes a new version of a string value in which
- each escape sequences of the sort that might be introduced by the escape
- function is replaced with the character that it represents.
+ Description:
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
- When the unescape function is called with one argument string, the
- following steps are taken:
+ When the unescape function is called with one argument string, the
+ following steps are taken:
- 1. Call ToString(string).
- 2. Compute the number of characters in Result(1).
- 3. Let R be the empty string.
- 4. Let k be 0.
- 5. If k equals Result(2), return R.
- 6. Let c be the character at position k within Result(1).
- 7. If c is not %, go to step 18.
- 8. If k is greater than Result(2)-6, go to step 14.
- 9. If the character at position k+1 within result(1) is not u, go to step
- 14.
- 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
- Result(1) are not all hexadecimal digits, go to step 14.
- 11. Let c be the character whose Unicode encoding is the integer represented
- by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
- within Result(1).
- 12. Increase k by 5.
- 13. Go to step 18.
- 14. If k is greater than Result(2)-3, go to step 18.
- 15. If the two characters at positions k+1 and k+2 within Result(1) are not
- both hexadecimal digits, go to step 18.
- 16. Let c be the character whose Unicode encoding is the integer represented
- by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
- within Result(1).
- 17. Increase k by 2.
- 18. Let R be a new string value computed by concatenating the previous value
- of R and c.
- 19. Increase k by 1.
- 20. Go to step 5.
- Author: christine@netscape.com
- Date: 28 october 1997
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "unescape(string)";
+var SECTION = "15.1.2.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "unescape.length", 1, unescape.length );
+new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") );
+new TestCase( SECTION, "delete unescape.length", false, delete unescape.length );
+new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") );
- test();
+new TestCase( SECTION, "unescape()", "undefined", unescape() );
+new TestCase( SECTION, "unescape('')", "", unescape('') );
+new TestCase( SECTION, "unescape( null )", "null", unescape(null) );
+new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) );
+new TestCase( SECTION, "unescape( true )", "true", unescape( true ) );
+new TestCase( SECTION, "unescape( false )", "false", unescape( false ) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) );
+new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) );
- array[item++] = new TestCase( SECTION, "unescape.length", 1, unescape.length );
- array[item++] = new TestCase( SECTION, "unescape.length = null; unescape.length", 1, eval("unescape.length=null; unescape.length") );
- array[item++] = new TestCase( SECTION, "delete unescape.length", false, delete unescape.length );
- array[item++] = new TestCase( SECTION, "delete unescape.length; unescape.length", 1, eval("delete unescape.length; unescape.length") );
- array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in unescape ) { MYPROPS+= p }; MYPROPS") );
+new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) );
+new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) );
+new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) );
+new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "unescape()", "undefined", unescape() );
- array[item++] = new TestCase( SECTION, "unescape('')", "", unescape('') );
- array[item++] = new TestCase( SECTION, "unescape( null )", "null", unescape(null) );
- array[item++] = new TestCase( SECTION, "unescape( void 0 )", "undefined", unescape(void 0) );
- array[item++] = new TestCase( SECTION, "unescape( true )", "true", unescape( true ) );
- array[item++] = new TestCase( SECTION, "unescape( false )", "false", unescape( false ) );
+var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
- array[item++] = new TestCase( SECTION, "unescape( new Boolean(true) )", "true", unescape(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "unescape( new Boolean(false) )", "false", unescape(new Boolean(false)) );
+new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) );
- array[item++] = new TestCase( SECTION, "unescape( Number.NaN )", "NaN", unescape(Number.NaN) );
- array[item++] = new TestCase( SECTION, "unescape( -0 )", "0", unescape( -0 ) );
- array[item++] = new TestCase( SECTION, "unescape( 'Infinity' )", "Infinity", unescape( "Infinity" ) );
- array[item++] = new TestCase( SECTION, "unescape( Number.POSITIVE_INFINITY )", "Infinity", unescape( Number.POSITIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "unescape( Number.NEGATIVE_INFINITY )", "-Infinity", unescape( Number.NEGATIVE_INFINITY ) );
+// escaped chars with ascii values less than 256
- var ASCII_TEST_STRING = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./";
-
- array[item++] = new TestCase( SECTION, "unescape( " +ASCII_TEST_STRING+" )", ASCII_TEST_STRING, unescape( ASCII_TEST_STRING ) );
-
- // escaped chars with ascii values less than 256
-
- for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %"+ ToHexString(CHARCODE)+" )",
- String.fromCharCode(CHARCODE),
- unescape( "%" + ToHexString(CHARCODE) ) );
- }
-
- // unicode chars represented by two hex digits
- for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ ToHexString(CHARCODE)+" )",
- "%u"+ToHexString(CHARCODE),
- unescape( "%u" + ToHexString(CHARCODE) ) );
- }
-/*
- for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
- String.fromCharCode(CHARCODE),
- unescape( "%u" + ToUnicodeString(CHARCODE) ) );
- }
- for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
- String.fromCharCode(CHARCODE),
- unescape( "%u" + ToUnicodeString(CHARCODE) ) );
- }
-*/
- return ( array );
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %"+ ToHexString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%" + ToHexString(CHARCODE) ) );
}
+// unicode chars represented by two hex digits
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToHexString(CHARCODE)+" )",
+ "%u"+ToHexString(CHARCODE),
+ unescape( "%u" + ToHexString(CHARCODE) ) );
+}
+/*
+ for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+ for ( var CHARCODE = 256; CHARCODE < 65536; CHARCODE+= 333 ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ ToUnicodeString(CHARCODE)+" )",
+ String.fromCharCode(CHARCODE),
+ unescape( "%u" + ToUnicodeString(CHARCODE) ) );
+ }
+*/
+
+test();
+
function ToUnicodeString( n ) {
- var string = ToHexString(n);
+ var string = ToHexString(n);
- for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
- string = "0" + string;
- }
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
- return string;
+ return string;
}
function ToHexString( n ) {
- var hex = new Array();
+ var hex = new Array();
- for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
- ;
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
}
+ }
- for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
- hex[index] = Math.floor( n / Math.pow(16,mag) );
- n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
- }
-
- hex[hex.length] = n % 16;
-
- var string ="";
-
- for ( var index = 0 ; index < hex.length ; index++ ) {
- switch ( hex[index] ) {
- case 10:
- string += "A";
- break;
- case 11:
- string += "B";
- break;
- case 12:
- string += "C";
- break;
- case 13:
- string += "D";
- break;
- case 14:
- string += "E";
- break;
- case 15:
- string += "F";
- break;
- default:
- string += hex[index];
- }
- }
-
- if ( string.length == 1 ) {
- string = "0" + string;
- }
- return string;
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-2.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-2.js
index 59510f6ee16..3cdfa78dc51 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-2.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,166 +35,146 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.1.2.5-2.js
- ECMA Section: 15.1.2.5 Function properties of the global object
- unescape( string )
- Description:
-
- This tests the cases where there are fewer than 4 characters following "%u",
- or fewer than 2 characters following "%" or "%u".
-
- The unescape function computes a new version of a string value in which
- each escape sequences of the sort that might be introduced by the escape
- function is replaced with the character that it represents.
-
- When the unescape function is called with one argument string, the
- following steps are taken:
-
- 1. Call ToString(string).
- 2. Compute the number of characters in Result(1).
- 3. Let R be the empty string.
- 4. Let k be 0.
- 5. If k equals Result(2), return R.
- 6. Let c be the character at position k within Result(1).
- 7. If c is not %, go to step 18.
- 8. If k is greater than Result(2)-6, go to step 14.
- 9. If the character at position k+1 within result(1) is not u, go to step
- 14.
- 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
- Result(1) are not all hexadecimal digits, go to step 14.
- 11. Let c be the character whose Unicode encoding is the integer represented
- by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
- within Result(1).
- 12. Increase k by 5.
- 13. Go to step 18.
- 14. If k is greater than Result(2)-3, go to step 18.
- 15. If the two characters at positions k+1 and k+2 within Result(1) are not
- both hexadecimal digits, go to step 18.
- 16. Let c be the character whose Unicode encoding is the integer represented
- by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
- within Result(1).
- 17. Increase k by 2.
- 18. Let R be a new string value computed by concatenating the previous value
- of R and c.
- 19. Increase k by 1.
- 20. Go to step 5.
- Author: christine@netscape.com
- Date: 28 october 1997
-*/
-
- var SECTION = "15.1.2.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "unescape(string)";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
-
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // since there is only one character following "%", no conversion should occur.
-
- for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
- "%"+(ToHexString(CHARCODE)).substring(0,1),
- unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );
- }
-
- // since there is only one character following "%u", no conversion should occur.
-
- for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) {
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
- "%u"+(ToHexString(CHARCODE)).substring(0,1),
- unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) );
- }
-
-
- // three char unicode string. no conversion should occur
-
- for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) {
- array[item++] = new TestCase
- ( SECTION,
- "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )",
-
- "%u"+(ToUnicodeString(CHARCODE)).substring(0,3),
- unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) )
- );
- }
-
- return ( array );
-}
-
-function ToUnicodeString( n ) {
- var string = ToHexString(n);
-
- for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
- string = "0" + string;
- }
-
- return string;
-}
-function ToHexString( n ) {
- var hex = new Array();
-
- for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
- ;
- }
-
- for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
- hex[index] = Math.floor( n / Math.pow(16,mag) );
- n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
- }
-
- hex[hex.length] = n % 16;
-
- var string ="";
-
- for ( var index = 0 ; index < hex.length ; index++ ) {
- switch ( hex[index] ) {
- case 10:
- string += "A";
- break;
- case 11:
- string += "B";
- break;
- case 12:
- string += "C";
- break;
- case 13:
- string += "D";
- break;
- case 14:
- string += "E";
- break;
- case 15:
- string += "F";
- break;
- default:
- string += hex[index];
- }
- }
-
- if ( string.length == 1 ) {
- string = "0" + string;
- }
- return string;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.1.2.5-2.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+ Description:
+
+ This tests the cases where there are fewer than 4 characters following "%u",
+ or fewer than 2 characters following "%" or "%u".
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+var SECTION = "15.1.2.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+// since there is only one character following "%", no conversion should occur.
+
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE += 16 ) {
+ new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1) ) );
+}
+
+// since there is only one character following "%u", no conversion should occur.
+
+for ( var CHARCODE = 0; CHARCODE < 256; CHARCODE +=16 ) {
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +" )",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1) ) );
+}
+
+
+// three char unicode string. no conversion should occur
+
+for ( var CHARCODE = 1024; CHARCODE < 65536; CHARCODE+= 1234 ) {
+ new TestCase
+ ( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3)+ " )",
+
+ "%u"+(ToUnicodeString(CHARCODE)).substring(0,3),
+ unescape( "%u"+(ToUnicodeString(CHARCODE)).substring(0,3) )
+ );
+}
+
+test();
+
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-3.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-3.js
index 5d5389ea219..d19b99ee7d7 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-3.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.5-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,189 +35,170 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.1.2.5-3.js
- ECMA Section: 15.1.2.5 Function properties of the global object
- unescape( string )
-
- Description:
- This tests the cases where one of the four characters following "%u" is
- not a hexidecimal character, or one of the two characters following "%"
- or "%u" is not a hexidecimal character.
-
- The unescape function computes a new version of a string value in which
- each escape sequences of the sort that might be introduced by the escape
- function is replaced with the character that it represents.
-
- When the unescape function is called with one argument string, the
- following steps are taken:
-
- 1. Call ToString(string).
- 2. Compute the number of characters in Result(1).
- 3. Let R be the empty string.
- 4. Let k be 0.
- 5. If k equals Result(2), return R.
- 6. Let c be the character at position k within Result(1).
- 7. If c is not %, go to step 18.
- 8. If k is greater than Result(2)-6, go to step 14.
- 9. If the character at position k+1 within result(1) is not u, go to step
- 14.
- 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
- Result(1) are not all hexadecimal digits, go to step 14.
- 11. Let c be the character whose Unicode encoding is the integer represented
- by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
- within Result(1).
- 12. Increase k by 5.
- 13. Go to step 18.
- 14. If k is greater than Result(2)-3, go to step 18.
- 15. If the two characters at positions k+1 and k+2 within Result(1) are not
- both hexadecimal digits, go to step 18.
- 16. Let c be the character whose Unicode encoding is the integer represented
- by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
- within Result(1).
- 17. Increase k by 2.
- 18. Let R be a new string value computed by concatenating the previous value
- of R and c.
- 19. Increase k by 1.
- 20. Go to step 5.
- Author: christine@netscape.com
- Date: 28 october 1997
-*/
-
-
- var SECTION = "15.1.2.5-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "unescape(string)";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
-
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
- NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
-
- array[item++] = new TestCase( SECTION,
- "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +
- String.fromCharCode( NONHEXCHARCODE ) +" )" +
- "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
- "%"+(ToHexString(CHARCODE)).substring(0,1)+
- String.fromCharCode( NONHEXCHARCODE ),
- unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+
- String.fromCharCode( NONHEXCHARCODE ) ) );
- }
- for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
- NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
-
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +
- String.fromCharCode( NONHEXCHARCODE ) +" )" +
- "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
- "%u"+(ToHexString(CHARCODE)).substring(0,1)+
- String.fromCharCode( NONHEXCHARCODE ),
- unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+
- String.fromCharCode( NONHEXCHARCODE ) ) );
- }
-
- for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) {
- NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
-
- array[item++] = new TestCase( SECTION,
- "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) +
- String.fromCharCode( NONHEXCHARCODE ) +" )" +
- "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
-
- String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) +
- (ToUnicodeString(CHARCODE)).substring(2,3) +
- String.fromCharCode( NONHEXCHARCODE ),
-
- unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+
- String.fromCharCode( NONHEXCHARCODE ) ) );
- }
-
- return ( array );
-}
-function getNextNonHexCharCode( n ) {
- for ( ; n < Math.pow(2,16); n++ ) {
- if ( ( n == 43 || n == 45 || n == 46 || n == 47 ||
- (n >= 71 && n <= 90) || (n >= 103 && n <= 122) ||
- n == 64 || n == 95 ) ) {
- break;
- } else {
- n = ( n > 122 ) ? 0 : n;
- }
- }
- return n;
-}
-function ToUnicodeString( n ) {
- var string = ToHexString(n);
-
- for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
- string = "0" + string;
- }
-
- return string;
-}
-function ToHexString( n ) {
- var hex = new Array();
-
- for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
- ;
- }
-
- for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
- hex[index] = Math.floor( n / Math.pow(16,mag) );
- n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
- }
-
- hex[hex.length] = n % 16;
-
- var string ="";
-
- for ( var index = 0 ; index < hex.length ; index++ ) {
- switch ( hex[index] ) {
- case 10:
- string += "A";
- break;
- case 11:
- string += "B";
- break;
- case 12:
- string += "C";
- break;
- case 13:
- string += "D";
- break;
- case 14:
- string += "E";
- break;
- case 15:
- string += "F";
- break;
- default:
- string += hex[index];
- }
- }
-
- if ( string.length == 1 ) {
- string = "0" + string;
- }
- return string;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.1.2.5-3.js
+ ECMA Section: 15.1.2.5 Function properties of the global object
+ unescape( string )
+
+ Description:
+ This tests the cases where one of the four characters following "%u" is
+ not a hexidecimal character, or one of the two characters following "%"
+ or "%u" is not a hexidecimal character.
+
+ The unescape function computes a new version of a string value in which
+ each escape sequences of the sort that might be introduced by the escape
+ function is replaced with the character that it represents.
+
+ When the unescape function is called with one argument string, the
+ following steps are taken:
+
+ 1. Call ToString(string).
+ 2. Compute the number of characters in Result(1).
+ 3. Let R be the empty string.
+ 4. Let k be 0.
+ 5. If k equals Result(2), return R.
+ 6. Let c be the character at position k within Result(1).
+ 7. If c is not %, go to step 18.
+ 8. If k is greater than Result(2)-6, go to step 14.
+ 9. If the character at position k+1 within result(1) is not u, go to step
+ 14.
+ 10. If the four characters at positions k+2, k+3, k+4, and k+5 within
+ Result(1) are not all hexadecimal digits, go to step 14.
+ 11. Let c be the character whose Unicode encoding is the integer represented
+ by the four hexadecimal digits at positions k+2, k+3, k+4, and k+5
+ within Result(1).
+ 12. Increase k by 5.
+ 13. Go to step 18.
+ 14. If k is greater than Result(2)-3, go to step 18.
+ 15. If the two characters at positions k+1 and k+2 within Result(1) are not
+ both hexadecimal digits, go to step 18.
+ 16. Let c be the character whose Unicode encoding is the integer represented
+ by two zeroes plus the two hexadecimal digits at positions k+1 and k+2
+ within Result(1).
+ 17. Increase k by 2.
+ 18. Let R be a new string value computed by concatenating the previous value
+ of R and c.
+ 19. Increase k by 1.
+ 20. Go to step 5.
+ Author: christine@netscape.com
+ Date: 28 october 1997
+*/
+
+
+var SECTION = "15.1.2.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "unescape(string)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0; CHARCODE < 256; CHARCODE++, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToHexString(CHARCODE)).substring(0,1) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+ "%u"+(ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ),
+ unescape( "%u" + (ToHexString(CHARCODE)).substring(0,1)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+
+for ( var CHARCODE = 0, NONHEXCHARCODE = 0 ; CHARCODE < 65536; CHARCODE+= 54321, NONHEXCHARCODE++ ) {
+ NONHEXCHARCODE = getNextNonHexCharCode( NONHEXCHARCODE );
+
+ new TestCase( SECTION,
+ "unescape( %u"+ (ToUnicodeString(CHARCODE)).substring(0,3) +
+ String.fromCharCode( NONHEXCHARCODE ) +" )" +
+ "[where last character is String.fromCharCode("+NONHEXCHARCODE+")]",
+
+ String.fromCharCode(eval("0x"+ (ToUnicodeString(CHARCODE)).substring(0,2))) +
+ (ToUnicodeString(CHARCODE)).substring(2,3) +
+ String.fromCharCode( NONHEXCHARCODE ),
+
+ unescape( "%" + (ToUnicodeString(CHARCODE)).substring(0,3)+
+ String.fromCharCode( NONHEXCHARCODE ) ) );
+}
+
+test();
+
+function getNextNonHexCharCode( n ) {
+ for ( ; n < Math.pow(2,16); n++ ) {
+ if ( ( n == 43 || n == 45 || n == 46 || n == 47 ||
+ (n >= 71 && n <= 90) || (n >= 103 && n <= 122) ||
+ n == 64 || n == 95 ) ) {
+ break;
+ } else {
+ n = ( n > 122 ) ? 0 : n;
+ }
+ }
+ return n;
+}
+function ToUnicodeString( n ) {
+ var string = ToHexString(n);
+
+ for ( var PAD = (4 - string.length ); PAD > 0; PAD-- ) {
+ string = "0" + string;
+ }
+
+ return string;
+}
+function ToHexString( n ) {
+ var hex = new Array();
+
+ for ( var mag = 1; Math.pow(16,mag) <= n ; mag++ ) {
+ ;
+ }
+
+ for ( index = 0, mag -= 1; mag > 0; index++, mag-- ) {
+ hex[index] = Math.floor( n / Math.pow(16,mag) );
+ n -= Math.pow(16,mag) * Math.floor( n/Math.pow(16,mag) );
+ }
+
+ hex[hex.length] = n % 16;
+
+ var string ="";
+
+ for ( var index = 0 ; index < hex.length ; index++ ) {
+ switch ( hex[index] ) {
+ case 10:
+ string += "A";
+ break;
+ case 11:
+ string += "B";
+ break;
+ case 12:
+ string += "C";
+ break;
+ case 13:
+ string += "D";
+ break;
+ case 14:
+ string += "E";
+ break;
+ case 15:
+ string += "F";
+ break;
+ default:
+ string += hex[index];
+ }
+ }
+
+ if ( string.length == 1 ) {
+ string = "0" + string;
+ }
+ return string;
+}
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.6.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.6.js
index c0935eae354..02357c44c62 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.6.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,109 +35,89 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.6.js
- ECMA Section: 15.1.2.6 isNaN( x )
+ File Name: 15.1.2.6.js
+ ECMA Section: 15.1.2.6 isNaN( x )
- Description: Applies ToNumber to its argument, then returns true if
- the result isNaN and otherwise returns false.
+ Description: Applies ToNumber to its argument, then returns true if
+ the result isNaN and otherwise returns false.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "isNaN( x )";
+var SECTION = "15.1.2.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "isNaN( x )";
- var BUGNUMBER = "77391";
+var BUGNUMBER = "77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "isNaN.length", 1, isNaN.length );
+new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") );
+new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") );
+new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length );
+new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") );
- test();
+// new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ );
+
+new TestCase( SECTION, "isNaN()", true, isNaN() );
+new TestCase( SECTION, "isNaN( null )", false, isNaN(null) );
+new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) );
+new TestCase( SECTION, "isNaN( true )", false, isNaN(true) );
+new TestCase( SECTION, "isNaN( false)", false, isNaN(false) );
+new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) );
+
+new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) );
+new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) );
+new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) );
+new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) );
+new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) );
+new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) );
+new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) );
+new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) );
+new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) );
+new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) );
+
+new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') );
+new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') );
+new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') );
+new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') );
+new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') );
+new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') );
+new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') );
+new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') );
+new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') );
+new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) );
+new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) );
+new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) );
+new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) );
- array[item++] = new TestCase( SECTION, "isNaN.length", 1, isNaN.length );
- array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( var p in isNaN ) { MYPROPS+= p }; MYPROPS") );
- array[item++] = new TestCase( SECTION, "isNaN.length = null; isNaN.length", 1, eval("isNaN.length=null; isNaN.length") );
- array[item++] = new TestCase( SECTION, "delete isNaN.length", false, delete isNaN.length );
- array[item++] = new TestCase( SECTION, "delete isNaN.length; isNaN.length", 1, eval("delete isNaN.length; isNaN.length") );
+new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) );
+new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) );
+new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) );
+new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) );
-// array[item++] = new TestCase( SECTION, "isNaN.__proto__", Function.prototype, isNaN.__proto__ );
-
- array[item++] = new TestCase( SECTION, "isNaN()", true, isNaN() );
- array[item++] = new TestCase( SECTION, "isNaN( null )", false, isNaN(null) );
- array[item++] = new TestCase( SECTION, "isNaN( void 0 )", true, isNaN(void 0) );
- array[item++] = new TestCase( SECTION, "isNaN( true )", false, isNaN(true) );
- array[item++] = new TestCase( SECTION, "isNaN( false)", false, isNaN(false) );
- array[item++] = new TestCase( SECTION, "isNaN( ' ' )", false, isNaN( " " ) );
-
- array[item++] = new TestCase( SECTION, "isNaN( 0 )", false, isNaN(0) );
- array[item++] = new TestCase( SECTION, "isNaN( 1 )", false, isNaN(1) );
- array[item++] = new TestCase( SECTION, "isNaN( 2 )", false, isNaN(2) );
- array[item++] = new TestCase( SECTION, "isNaN( 3 )", false, isNaN(3) );
- array[item++] = new TestCase( SECTION, "isNaN( 4 )", false, isNaN(4) );
- array[item++] = new TestCase( SECTION, "isNaN( 5 )", false, isNaN(5) );
- array[item++] = new TestCase( SECTION, "isNaN( 6 )", false, isNaN(6) );
- array[item++] = new TestCase( SECTION, "isNaN( 7 )", false, isNaN(7) );
- array[item++] = new TestCase( SECTION, "isNaN( 8 )", false, isNaN(8) );
- array[item++] = new TestCase( SECTION, "isNaN( 9 )", false, isNaN(9) );
-
- array[item++] = new TestCase( SECTION, "isNaN( '0' )", false, isNaN('0') );
- array[item++] = new TestCase( SECTION, "isNaN( '1' )", false, isNaN('1') );
- array[item++] = new TestCase( SECTION, "isNaN( '2' )", false, isNaN('2') );
- array[item++] = new TestCase( SECTION, "isNaN( '3' )", false, isNaN('3') );
- array[item++] = new TestCase( SECTION, "isNaN( '4' )", false, isNaN('4') );
- array[item++] = new TestCase( SECTION, "isNaN( '5' )", false, isNaN('5') );
- array[item++] = new TestCase( SECTION, "isNaN( '6' )", false, isNaN('6') );
- array[item++] = new TestCase( SECTION, "isNaN( '7' )", false, isNaN('7') );
- array[item++] = new TestCase( SECTION, "isNaN( '8' )", false, isNaN('8') );
- array[item++] = new TestCase( SECTION, "isNaN( '9' )", false, isNaN('9') );
+new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) );
+new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) );
- array[item++] = new TestCase( SECTION, "isNaN( 0x0a )", false, isNaN( 0x0a ) );
- array[item++] = new TestCase( SECTION, "isNaN( 0xaa )", false, isNaN( 0xaa ) );
- array[item++] = new TestCase( SECTION, "isNaN( 0x0A )", false, isNaN( 0x0A ) );
- array[item++] = new TestCase( SECTION, "isNaN( 0xAA )", false, isNaN( 0xAA ) );
+new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) );
+new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) );
+new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "isNaN( '0x0a' )", false, isNaN( "0x0a" ) );
- array[item++] = new TestCase( SECTION, "isNaN( '0xaa' )", false, isNaN( "0xaa" ) );
- array[item++] = new TestCase( SECTION, "isNaN( '0x0A' )", false, isNaN( "0x0A" ) );
- array[item++] = new TestCase( SECTION, "isNaN( '0xAA' )", false, isNaN( "0xAA" ) );
+new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) );
+new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) );
- array[item++] = new TestCase( SECTION, "isNaN( 077 )", false, isNaN( 077 ) );
- array[item++] = new TestCase( SECTION, "isNaN( '077' )", false, isNaN( "077" ) );
+new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") );
+new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") );
-
- array[item++] = new TestCase( SECTION, "isNaN( Number.NaN )", true, isNaN(Number.NaN) );
- array[item++] = new TestCase( SECTION, "isNaN( Number.POSITIVE_INFINITY )", false, isNaN(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "isNaN( Number.NEGATIVE_INFINITY )", false, isNaN(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "isNaN( Number.MAX_VALUE )", false, isNaN(Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "isNaN( Number.MIN_VALUE )", false, isNaN(Number.MIN_VALUE) );
-
- array[item++] = new TestCase( SECTION, "isNaN( NaN )", true, isNaN(NaN) );
- array[item++] = new TestCase( SECTION, "isNaN( Infinity )", false, isNaN(Infinity) );
-
- array[item++] = new TestCase( SECTION, "isNaN( 'Infinity' )", false, isNaN("Infinity") );
- array[item++] = new TestCase( SECTION, "isNaN( '-Infinity' )", false, isNaN("-Infinity") );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/15.1.2.7.js b/mozilla/js/tests/ecma/GlobalObject/15.1.2.7.js
index 5879d08be6b..724ef29f907 100644
--- a/mozilla/js/tests/ecma/GlobalObject/15.1.2.7.js
+++ b/mozilla/js/tests/ecma/GlobalObject/15.1.2.7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,113 +35,94 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.1.2.7.js
- ECMA Section: 15.1.2.7 isFinite(number)
+ File Name: 15.1.2.7.js
+ ECMA Section: 15.1.2.7 isFinite(number)
- Description: Applies ToNumber to its argument, then returns false if
- the result is NaN, Infinity, or -Infinity, and otherwise
- returns true.
+ Description: Applies ToNumber to its argument, then returns false if
+ the result is NaN, Infinity, or -Infinity, and otherwise
+ returns true.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.1.2.7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "isFinite( x )";
+var SECTION = "15.1.2.7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "isFinite( x )";
- var BUGNUMBER= "77391";
+var BUGNUMBER= "77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "isFinite.length", 1, isFinite.length );
+new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") );
+new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length );
+new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") );
+new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") );
- test();
+new TestCase( SECTION, "isFinite()", false, isFinite() );
+new TestCase( SECTION, "isFinite( null )", true, isFinite(null) );
+new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) );
+new TestCase( SECTION, "isFinite( false )", true, isFinite(false) );
+new TestCase( SECTION, "isFinite( true)", true, isFinite(true) );
+new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) );
+new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) );
- array[item++] = new TestCase( SECTION, "isFinite.length", 1, isFinite.length );
- array[item++] = new TestCase( SECTION, "isFinite.length = null; isFinite.length", 1, eval("isFinite.length=null; isFinite.length") );
- array[item++] = new TestCase( SECTION, "delete isFinite.length", false, delete isFinite.length );
- array[item++] = new TestCase( SECTION, "delete isFinite.length; isFinite.length", 1, eval("delete isFinite.length; isFinite.length") );
- array[item++] = new TestCase( SECTION, "var MYPROPS=''; for ( p in isFinite ) { MYPROPS+= p }; MYPROPS", "", eval("var MYPROPS=''; for ( p in isFinite ) { MYPROPS += p }; MYPROPS") );
+new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) );
+new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) );
+new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) );
+new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) );
+new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) );
+new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) );
+new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) );
+new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) );
+new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) );
+new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) );
- array[item++] = new TestCase( SECTION, "isFinite()", false, isFinite() );
- array[item++] = new TestCase( SECTION, "isFinite( null )", true, isFinite(null) );
- array[item++] = new TestCase( SECTION, "isFinite( void 0 )", false, isFinite(void 0) );
- array[item++] = new TestCase( SECTION, "isFinite( false )", true, isFinite(false) );
- array[item++] = new TestCase( SECTION, "isFinite( true)", true, isFinite(true) );
- array[item++] = new TestCase( SECTION, "isFinite( ' ' )", true, isFinite( " " ) );
+new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') );
+new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') );
+new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') );
+new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') );
+new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') );
+new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') );
+new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') );
+new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') );
+new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') );
+new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') );
- array[item++] = new TestCase( SECTION, "isFinite( new Boolean(true) )", true, isFinite(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "isFinite( new Boolean(false) )", true, isFinite(new Boolean(false)) );
+new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) );
+new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) );
+new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) );
+new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) );
- array[item++] = new TestCase( SECTION, "isFinite( 0 )", true, isFinite(0) );
- array[item++] = new TestCase( SECTION, "isFinite( 1 )", true, isFinite(1) );
- array[item++] = new TestCase( SECTION, "isFinite( 2 )", true, isFinite(2) );
- array[item++] = new TestCase( SECTION, "isFinite( 3 )", true, isFinite(3) );
- array[item++] = new TestCase( SECTION, "isFinite( 4 )", true, isFinite(4) );
- array[item++] = new TestCase( SECTION, "isFinite( 5 )", true, isFinite(5) );
- array[item++] = new TestCase( SECTION, "isFinite( 6 )", true, isFinite(6) );
- array[item++] = new TestCase( SECTION, "isFinite( 7 )", true, isFinite(7) );
- array[item++] = new TestCase( SECTION, "isFinite( 8 )", true, isFinite(8) );
- array[item++] = new TestCase( SECTION, "isFinite( 9 )", true, isFinite(9) );
+new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) );
+new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) );
+new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) );
+new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) );
- array[item++] = new TestCase( SECTION, "isFinite( '0' )", true, isFinite('0') );
- array[item++] = new TestCase( SECTION, "isFinite( '1' )", true, isFinite('1') );
- array[item++] = new TestCase( SECTION, "isFinite( '2' )", true, isFinite('2') );
- array[item++] = new TestCase( SECTION, "isFinite( '3' )", true, isFinite('3') );
- array[item++] = new TestCase( SECTION, "isFinite( '4' )", true, isFinite('4') );
- array[item++] = new TestCase( SECTION, "isFinite( '5' )", true, isFinite('5') );
- array[item++] = new TestCase( SECTION, "isFinite( '6' )", true, isFinite('6') );
- array[item++] = new TestCase( SECTION, "isFinite( '7' )", true, isFinite('7') );
- array[item++] = new TestCase( SECTION, "isFinite( '8' )", true, isFinite('8') );
- array[item++] = new TestCase( SECTION, "isFinite( '9' )", true, isFinite('9') );
+new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) );
+new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) );
- array[item++] = new TestCase( SECTION, "isFinite( 0x0a )", true, isFinite( 0x0a ) );
- array[item++] = new TestCase( SECTION, "isFinite( 0xaa )", true, isFinite( 0xaa ) );
- array[item++] = new TestCase( SECTION, "isFinite( 0x0A )", true, isFinite( 0x0A ) );
- array[item++] = new TestCase( SECTION, "isFinite( 0xAA )", true, isFinite( 0xAA ) );
+new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) );
+new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) );
- array[item++] = new TestCase( SECTION, "isFinite( '0x0a' )", true, isFinite( "0x0a" ) );
- array[item++] = new TestCase( SECTION, "isFinite( '0xaa' )", true, isFinite( "0xaa" ) );
- array[item++] = new TestCase( SECTION, "isFinite( '0x0A' )", true, isFinite( "0x0A" ) );
- array[item++] = new TestCase( SECTION, "isFinite( '0xAA' )", true, isFinite( "0xAA" ) );
+new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") );
+new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") );
+new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) );
- array[item++] = new TestCase( SECTION, "isFinite( 077 )", true, isFinite( 077 ) );
- array[item++] = new TestCase( SECTION, "isFinite( '077' )", true, isFinite( "077" ) );
-
- array[item++] = new TestCase( SECTION, "isFinite( new String('Infinity') )", false, isFinite(new String("Infinity")) );
- array[item++] = new TestCase( SECTION, "isFinite( new String('-Infinity') )", false, isFinite(new String("-Infinity")) );
-
- array[item++] = new TestCase( SECTION, "isFinite( 'Infinity' )", false, isFinite("Infinity") );
- array[item++] = new TestCase( SECTION, "isFinite( '-Infinity' )", false, isFinite("-Infinity") );
- array[item++] = new TestCase( SECTION, "isFinite( Number.POSITIVE_INFINITY )", false, isFinite(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "isFinite( Number.NEGATIVE_INFINITY )", false, isFinite(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "isFinite( Number.NaN )", false, isFinite(Number.NaN) );
-
- array[item++] = new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) );
- array[item++] = new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) );
- array[item++] = new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) );
+new TestCase( SECTION, "isFinite( Infinity )", false, isFinite(Infinity) );
+new TestCase( SECTION, "isFinite( -Infinity )", false, isFinite(-Infinity) );
+new TestCase( SECTION, "isFinite( NaN )", false, isFinite(NaN) );
- array[item++] = new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) );
+new TestCase( SECTION, "isFinite( Number.MAX_VALUE )", true, isFinite(Number.MAX_VALUE) );
+new TestCase( SECTION, "isFinite( Number.MIN_VALUE )", true, isFinite(Number.MIN_VALUE) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/GlobalObject/browser.js b/mozilla/js/tests/ecma/GlobalObject/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/GlobalObject/shell.js b/mozilla/js/tests/ecma/GlobalObject/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.1-1.js b/mozilla/js/tests/ecma/LexicalConventions/7.1-1.js
index 810eb3bb960..14e4d7cb6e1 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.1-1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,46 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.1-1.js
- ECMA Section: 7.1 White Space
- Description: - readability
- - separate tokens
- - otherwise should be insignificant
- - in strings, white space characters are significant
- - cannot appear within any other kind of token
+ File Name: 7.1-1.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
- white space characters are:
- unicode name formal name string representation
- \u0009 tab \t
- \u000B veritical tab \v
- \U000C form feed \f
- \u0020 space " "
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab \t
+ \u000B veritical tab \v
+ \U000C form feed \f
+ \u0020 space " "
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "White Space";
+var SECTION = "7.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// whitespace between var keyword and identifier
+new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// use whitespace between tokens object name, dot operator, and object property
- // whitespace between var keyword and identifier
+new TestCase( SECTION,
+ "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
+ 12345,
+ eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
- array[item++] = new TestCase( SECTION, 'var'+'\t'+'MYVAR1=10;MYVAR1', 10, eval('var'+'\t'+'MYVAR1=10;MYVAR1') );
- array[item++] = new TestCase( SECTION, 'var'+'\f'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\f'+'MYVAR2=10;MYVAR2') );
- array[item++] = new TestCase( SECTION, 'var'+'\v'+'MYVAR2=10;MYVAR2', 10, eval('var'+'\v'+'MYVAR2=10;MYVAR2') );
- array[item++] = new TestCase( SECTION, 'var'+'\ '+'MYVAR2=10;MYVAR2', 10, eval('var'+'\ '+'MYVAR2=10;MYVAR2') );
-
- // use whitespace between tokens object name, dot operator, and object property
-
- array[item++] = new TestCase( SECTION,
- "var a = new Array(12345); a\t\v\f .\\u0009\\000B\\u000C\\u0020length",
- 12345,
- eval("var a = new Array(12345); a\t\v\f .\u0009\u0020\u000C\u000Blength") );
-
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.1-2.js b/mozilla/js/tests/ecma/LexicalConventions/7.1-2.js
index 9b6de77c196..03a1c0253cd 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.1-2.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.1-2.js
- ECMA Section: 7.1 White Space
- Description: - readability
- - separate tokens
- - otherwise should be insignificant
- - in strings, white space characters are significant
- - cannot appear within any other kind of token
+ File Name: 7.1-2.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
- white space characters are:
- unicode name formal name string representation
- \u0009 tab \t
- \u000B veritical tab ??
- \U000C form feed \f
- \u0020 space " "
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab \t
+ \u000B veritical tab ??
+ \U000C form feed \f
+ \u0020 space " "
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "White Space";
+var SECTION = "7.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
- array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
- array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
- array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.1-3.js b/mozilla/js/tests/ecma/LexicalConventions/7.1-3.js
index 70c784ff94a..07825fcc96a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.1-3.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,74 +35,53 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.1-3.js
- ECMA Section: 7.1 White Space
- Description: - readability
- - separate tokens
- - otherwise should be insignificant
- - in strings, white space characters are significant
- - cannot appear within any other kind of token
+ File Name: 7.1-3.js
+ ECMA Section: 7.1 White Space
+ Description: - readability
+ - separate tokens
+ - otherwise should be insignificant
+ - in strings, white space characters are significant
+ - cannot appear within any other kind of token
- white space characters are:
- unicode name formal name string representation
- \u0009 tab \t
- \u000B veritical tab ??
- \U000C form feed \f
- \u0020 space " "
+ white space characters are:
+ unicode name formal name string representation
+ \u0009 tab \t
+ \u000B veritical tab ??
+ \U000C form feed \f
+ \u0020 space " "
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "White Space";
+var SECTION = "7.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "White Space";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
+new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
+new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
+new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+// ++ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "'var'+'\u000B'+'MYVAR1=10;MYVAR1'", 10, eval('var'+'\u000B'+'MYVAR1=10;MYVAR1') );
- array[item++] = new TestCase( SECTION, "'var'+'\u0009'+'MYVAR2=10;MYVAR2'", 10, eval('var'+'\u0009'+'MYVAR2=10;MYVAR2') );
- array[item++] = new TestCase( SECTION, "'var'+'\u000C'+'MYVAR3=10;MYVAR3'", 10, eval('var'+'\u000C'+'MYVAR3=10;MYVAR3') );
- array[item++] = new TestCase( SECTION, "'var'+'\u0020'+'MYVAR4=10;MYVAR4'", 10, eval('var'+'\u0020'+'MYVAR4=10;MYVAR4') );
+new TestCase( SECTION,
+ "var VAR = 12345; + + VAR",
+ 12345,
+ eval("var VAR = 12345; + + VAR") );
- // ++ should be interpreted as the unary + operator twice, not as a post or prefix increment operator
+new TestCase( SECTION,
+ "var VAR = 12345;VAR+ + VAR",
+ 24690,
+ eval("var VAR = 12345;VAR+ +VAR") );
+new TestCase( SECTION,
+ "var VAR = 12345;VAR - - VAR",
+ 24690,
+ eval("var VAR = 12345;VAR- -VAR") );
- array[item++] = new TestCase( SECTION,
- "var VAR = 12345; + + VAR",
- 12345,
- eval("var VAR = 12345; + + VAR") );
-
- array[item++] = new TestCase( SECTION,
- "var VAR = 12345;VAR+ + VAR",
- 24690,
- eval("var VAR = 12345;VAR+ +VAR") );
- array[item++] = new TestCase( SECTION,
- "var VAR = 12345;VAR - - VAR",
- 24690,
- eval("var VAR = 12345;VAR- -VAR") );
-
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-1.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-1.js
index 7d17abeed58..ba28c4493b6 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.2-1.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2-1.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
+new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") );
+new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") );
- array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
- array[item++] = new TestCase( SECTION, "var a\nb = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
- array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;ab;", 10, eval("var a\rb = 5; ab=10;ab") );
- array[item++] = new TestCase( SECTION, "var a\rb = 5; ab=10;b;", 5, eval("var a\rb = 5; ab=10;b") );
- array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;ab;", 10, eval("var a\r\nb = 5; ab=10;ab") );
- array[item++] = new TestCase( SECTION, "var a\r\nb = 5; ab=10;b;", 5, eval("var a\r\nb = 5; ab=10;b") );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-2-n.js
index d284d77ea48..a318c0e2cac 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.2.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "\r\r\r\nb";
+EXPECTED = "error"
-function test() {
- // this is line 29
- a = "\r\r\r\nb";
- eval( a );
+new TestCase( SECTION, DESCRIPTION, "error", eval("\r\r\r\nb"));
- // if we get this far, the test failed.
- testcases[tc].passed = writeTestCaseResult(
- "failure on line" + testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+test();
- testcases[0].passed = false;
-
- testcases[tc].reason = "test should have caused runtime error ";
-
- stopTest();
-
- return ( testcases );
-}
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[0] = new TestCase( "7.2", "a", "error", "");
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-3-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-3-n.js
index b2337d5c00d..fa559940ca4 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-3-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-3-n.js
@@ -35,64 +35,36 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.2-3.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2-3.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function test() {
-
- // this is line 27
-
- a = "\r\nb";
- eval( a );
-
- // if we get this far, the test failed.
- testcases[tc].passed = writeTestCaseResult(
- "failure on line" + testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[0].passed = false;
-
- testcases[tc].reason = "test should have caused runtime error ";
-
- stopTest();
- return ( testcases );
-}
+writeHeaderToLog( SECTION + " "+ TITLE);
+DESCRIPTION = "\r\nb";
+EXPECTED = "error"
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[0] = new TestCase( "7.2", "a", "error", "");
-
- return ( array );
-}
+new TestCase( SECTION, "a", "error", eval("\r\nb"));
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-4-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-4-n.js
index 8967ff4761f..7bd8772ff85 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-4-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,64 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.2.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "\nb";
+EXPECTED = "error";
-function test() {
- // this is line 33
+new TestCase( SECTION, "\nb", "error", eval("\nb"));
- a = "\nb";
- eval( a );
-
- // if we get this far, the test failed.
- testcases[tc].passed = writeTestCaseResult(
- "failure on line" + testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[0].passed = false;
-
- testcases[tc].reason = "test should have caused runtime error ";
-
- stopTest();
-
- return ( testcases );
-}
-
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[0] = new TestCase( "7.2", "a = \\nb", "error", "");
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-5-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-5-n.js
index a9fe62a61c4..67ef820349d 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-5-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,67 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.2.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION =
+EXPECTED = "error";
-
-function test() {
- // this is line 27
-
- a = "\rb";
- eval( a );
-
- // if we get this far, the test failed.
- testcases[tc].passed = writeTestCaseResult(
- "failure on line" + testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].passed = false;
-
- testcases[tc].reason = "test should have caused runtime error ";
-
- passed = false;
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
-}
-
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[0] = new TestCase( "7.2", "a", "error", "");
-
- return ( array );
-}
+new TestCase( SECTION, "\rb", "error", eval("\rb"));
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.2-6.js b/mozilla/js/tests/ecma/LexicalConventions/7.2-6.js
index c2bc0fcc31a..314acaa73f2 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.2-6.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.2-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.2-6.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: 7.2-6.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.2-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Line Terminators";
+var SECTION = "7.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Line Terminators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
+new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "var a\u000Ab = 5; ab=10;ab;", 10, eval("var a\nb = 5; ab=10;ab") );
- array[item++] = new TestCase( SECTION, "var a\u000Db = 5; ab=10;b;", 5, eval("var a\nb = 5; ab=10;b") );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-1.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-1.js
index acce31f59d4..2dfe6f0dc06 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,61 +35,56 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-1.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-1.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+var testcase;
- test();
+testcase = new TestCase( SECTION,
+ "a comment with a line terminator string, and text following",
+ "pass",
+ "pass");
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item] = new TestCase( SECTION,
- "a comment with a line terminator string, and text following",
- "pass",
- "pass");
+// "\u000A" testcase.actual = "fail";
- // "\u000A" array[item].actual = "fail";
- item++;
+testcase = new TestCase( SECTION,
+ "// test \\n testcase.actual = \"pass\"",
+ "pass",
+ "" );
- array[item] = new TestCase( SECTION,
- "// test \\n array[item].actual = \"pass\"",
- "pass",
- "" );
+var x = "// test \n testcase.actual = 'pass'"
- var x = "// test \n array[item].actual = 'pass'"
+testcase.actual = eval(x);
- array[0].actual = eval(x);
-
- return ( array );
-}
+test();
+// XXX bc replace test()
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +": "+
+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
+ }
+ stopTest();
+ return ( testcases );
}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-10.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-10.js
index 0a2b92e3abb..ef7d9efe0c6 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-10.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-10.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-10.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+/*//*/testcase.actual="pass";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "code following multiline comment",
- "pass",
- "fail");
- return ( array );
-}
-function test() {
-
- /*//*/testcases[tc].actual="pass";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-11.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-11.js
index c3320df5311..10f0b3066d7 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-11.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-11.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-11.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "code following multiline comment",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
- ////testcases[tc].actual="fail";
+////testcase.actual="fail";
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-12.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-12.js
index 0d9c619c494..8b39207f347 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-12.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-12.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-12.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-12.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "pass");
+/*testcase.actual="fail";**/
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "code following multiline comment",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
-
- /*testcases[tc].actual="fail";**/
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-13-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-13-n.js
index 36e1430582a..9985499afc3 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-13-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-13-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-13-n.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-13-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "nested comment";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "nested comment",
- "error",
- "pass");
- return ( array );
-}
-function test() {
+var testcase = new TestCase( SECTION,
+ "nested comment",
+ "error",
+ eval("/*/*\"fail\";*/*/"));
- /*/*testcases[tc].actual="fail";*/*/
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-2.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-2.js
index c82f219e92b..f33ab3c42c3 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-2.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-2.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-2.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
+// "\u000D" testcase.actual = "fail";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "a comment with a carriage return, and text following",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
-
- // "\u000D" testcases[tc].actual = "fail";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-3.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-3.js
index 4bf1f218fa8..e5459d0827a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-3.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-3.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-3.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "source text directly following a single-line comment",
+ "pass",
+ "fail");
+// a comment string
+testcase.actual = "pass";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "source text directly following a single-line comment",
- "pass",
- "fail");
- return ( array );
-}
-function test() {
-
- // a comment string
- testcases[tc].actual = "pass";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-4.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-4.js
index 9ff4478695f..1b459f4ce6e 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-4.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-4.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-4.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "multiline comment ",
+ "pass",
+ "pass");
+/*testcase.actual = "fail";*/
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "multiline comment ",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
-
- /*testcases[tc].actual = "fail";*/
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-5.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-5.js
index d09c4883072..eb16d8fb337 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-5.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-5.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-5.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "a comment with a carriage return, and text following",
+ "pass",
+ "pass");
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "a comment with a carriage return, and text following",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
+// "\u000A" testcase.actual = "fail";
- // "\u000A" testcases[tc].actual = "fail";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-6.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-6.js
index 0087a24a15b..302e26f0952 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-6.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-6.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-6.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+var testcase = new TestCase( SECTION,
+ "comment with multiple asterisks",
+ "pass",
+ "fail");
- var testcases = getTestCases();
- test();
+/*
+***/testcase.actual="pass";
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "comment with multiple asterisks",
- "pass",
- "fail");
- return ( array );
-}
-function test() {
-
- /*
- ***/testcases[tc].actual="pass";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-7.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-7.js
index 31fc332c1e1..b9aa637d42b 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-7.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-7.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "single line comment following multiline comment",
+ "pass",
+ "pass");
+/*
+***///testcase.actual="fail";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "single line comment following multiline comment",
- "pass",
- "pass");
- return ( array );
-}
-function test() {
-
- /*
- ***///testcases[tc].actual="fail";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-8.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-8.js
index 64ecd4a1b4d..d1b7cc5192a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-8.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-7.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-7.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
+/**/testcase.actual="pass";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "code following multiline comment",
- "pass",
- "fail");
- return ( array );
-}
-function test() {
-
- /**/testcases[tc].actual="pass";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.3-9.js b/mozilla/js/tests/ecma/LexicalConventions/7.3-9.js
index c2fc3e272ec..413c2e106e0 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.3-9.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.3-9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.3-9.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: 7.3-9.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.3-9";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Comments";
+var SECTION = "7.3-9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Comments";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var testcase = new TestCase( SECTION,
+ "code following multiline comment",
+ "pass",
+ "fail");
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "code following multiline comment",
- "pass",
- "fail");
- return ( array );
-}
-function test() {
+/*/*/testcase.actual="pass";
- /*/*/testcases[tc].actual="pass";
-
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-1-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-1-n.js
index c3ea25f9219..a249f60b56e 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-1-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.1-1-n.js
- ECMA Section: 7.4.1
+ File Name: 7.4.1-1-n.js
+ ECMA Section: 7.4.1
- Description:
+ Description:
- Reserved words cannot be used as identifiers.
+ Reserved words cannot be used as identifiers.
- ReservedWord ::
- Keyword
- FutureReservedWord
- NullLiteral
- BooleanLiteral
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var null = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var null = true", "error", eval("var null = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var null = true", "error", "var null = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-2-n.js
index f635f5c6640..eb872686eba 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.1-2.js
- ECMA Section: 7.4.1
+ File Name: 7.4.1-2.js
+ ECMA Section: 7.4.1
- Description:
+ Description:
- Reserved words cannot be used as identifiers.
+ Reserved words cannot be used as identifiers.
- ReservedWord ::
- Keyword
- FutureReservedWord
- NullLiteral
- BooleanLiteral
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var true = false";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var true = false", "error", "var true = false" );
- return ( array );
-}
+new TestCase( SECTION, "var true = false", "error", eval("var true = false") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-3-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-3-n.js
index 6fadb7de080..ddf75071794 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.1-3-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.1-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 7.4.1-3-n.js
ECMA Section: 7.4.1
@@ -57,29 +59,9 @@
startTest();
var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+DESCRIPTION = "var false = true";
+EXPECTED = "error";
- var testcases = getTestCases();
- test();
+ new TestCase( SECTION, "var false = true", "error", eval("var false = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var false = true", "error", "var false = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-1-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-1-n.js
index 414920d2f85..98ca168cf02 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-1-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-1.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-1.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.2-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var break = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var break = true", "error", "var break = true" );
- return ( array );
-}
+new TestCase( SECTION, "var break = true", "error", eval("var break = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-10-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-10-n.js
index cb43ad75cd3..e35ae715363 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-10-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-10-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-10.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-10.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-10-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-10-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var if = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var if = true", "error", "var if = true" );
- return ( array );
-}
+new TestCase( SECTION, "var if = true", "error", eval("var if = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-11-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-11-n.js
index a9d1ae4eef8..a9506d7ef9a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-11-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-11-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-11-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-11-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-11-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var this = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var this = true", "error", "var this = true" );
- return ( array );
-}
+new TestCase( SECTION, "var this = true", "error", eval("var this = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-12-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-12-n.js
index fecf33fa9f8..26862d9cc77 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-12-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-12-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,59 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-12-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-12-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-12-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var while = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var while = true", "error", eval("var while = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var while = true", "error", "var while = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-13-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-13-n.js
index d41d0a05886..22fefa46f95 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-13-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-13-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-13-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-13-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var else = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var else = true", "error", "var else = true" );
- return ( array );
-}
+new TestCase( SECTION, "var else = true", "error", eval("var else = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-14-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-14-n.js
index da10c5a8193..cd5e7dfa44a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-14-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-14-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-14-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-14-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-14-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var in = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var in = true", "error", "var in = true" );
- return ( array );
-}
+new TestCase( SECTION, "var in = true", "error", eval("var in = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-15-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-15-n.js
index 4e0584bb25e..0899e088d87 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-15-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-15-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,59 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-15-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-15-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-15-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
- test();
+DESCRIPTION = "var typeof = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var typeof = true", "error", "var typeof = true" );
- return ( array );
-}
+new TestCase( SECTION, "var typeof = true", "error", eval("var typeof = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-16-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-16-n.js
index 0284f3e4df2..5a102c6e985 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-16-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-16-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-16-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-16-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-16-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-16-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var with = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var with = true", "error", "var with = true" );
- return ( array );
-}
+new TestCase( SECTION, "var with = true", "error", eval("var with = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-2-n.js
index e3df20bb6eb..86f30ac14b8 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-2-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-2-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var for = true", "error", "var for = true" );
- return ( array );
-}
+DESCRIPTION = "var for = true";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "var for = true", "error", eval("var for = true") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-3-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-3-n.js
index 44637d1fecc..321dae68aee 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-3-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-3-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var new = true", "error", "var new = true" );
- return ( array );
-}
+DESCRIPTION = "var new = true";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "var new = true", "error", eval("var new = true") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-4-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-4-n.js
index 56983aaf389..c336de8b7c0 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-4-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-4-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.2-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var var = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var var = true", "error", "var var = true" );
- return ( array );
-}
+TestCase( SECTION, "var var = true", "error", eval("var var = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-5-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-5-n.js
index 40db3205fa5..ccfdbcc5ac1 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-5-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-5-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-5-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.2-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var continue = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var continue = true", "error", "var continue = true" );
- return ( array );
-}
+new TestCase( SECTION, "var continue = true", "error", eval("var continue = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-6-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-6-n.js
index 3c05b6d6ab7..87c5faea86f 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-6-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-6-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-6.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-6.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-6-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.2-6-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var function = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var function = true", "error", "var function = true" );
- return ( array );
-}
+new TestCase( SECTION, "var function = true", "error", eval("var function = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-7-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-7-n.js
index 1ffb24c3177..6bf4d2c547e 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-7-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-7-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,55 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-7-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.2-7";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
- writeHeaderToLog( SECTION + " Keywords");
- test();
+var SECTION = "7.4.2-7";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Keywords");
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var return = true", "error", "var return = true" );
- return ( array );
-}
+DESCRIPTION = "var return = true";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "var return = true", "error", eval("var return = true") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-8-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-8-n.js
index 97ac520a97d..ca57de785c8 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-8-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-8-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 7.4.2-8-n.js
ECMA Section: 7.4.2
@@ -61,28 +63,12 @@
var SECTION = "7.4.2-8";
var VERSION = "ECMA_1";
startTest();
- var testcases = getTestCases();
+
writeHeaderToLog( SECTION + " Keywords");
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var void = true", "error", "var void = true" );
- return ( array );
-}
+DESCRIPTION = "var void = true";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "var void = true", "error", eval("var void = true") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-9-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-9-n.js
index 882de2d0b49..ce561f12d11 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.2-9-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.2-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,41 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.2-9-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.1-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Keywords";
+var SECTION = "7.4.1-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Keywords";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var delete = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var delete = true", "error", "var delete = true" );
- return ( array );
-}
+new TestCase( SECTION, "var delete = true", "error", eval("var delete = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-1-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-1-n.js
index 3d00e0cf735..8c89c38a6f3 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-1-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-1-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var case = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var case = true", "error", eval("var case = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var case = true", "error", "var case = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-10-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-10-n.js
index abd13eeff01..b87bce7293a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-10-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-10-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-10-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-10-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-10-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var do = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var do = true", "error", eval("var do = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var do = true", "error", "var do = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-11-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-11-n.js
index a965f554780..0f0b92fd4be 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-11-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-11-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-11-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-11-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-11-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var finally = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var finally = true", "error", "var finally = true" );
- return ( array );
-}
+new TestCase( SECTION, "var finally = true", "error", eval("var finally = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-12-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-12-n.js
index 1f63fb15d0e..b213cc5b3cc 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-12-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-12-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-12-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-12-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-12-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var throw = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var throw = true", "error", eval("var throw = true") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var throw = true", "error", "var throw = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-13-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-13-n.js
index a7057af12e8..bbc53908174 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-13-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-13-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-13-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-13-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-13-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-13-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var const = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var const = true", "error", eval("var const = true") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var const = true", "error", "var const = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-14-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-14-n.js
index 976c69cf27c..092bd5663a7 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-14-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-14-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,51 +36,32 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.4.3-14-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-14-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-14-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-14-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var enum = true", "error", "var enum = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "var enum = true",
+ "error",
+ eval("var enum = true") );
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-15-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-15-n.js
index 1dc50ac7c0a..1aa58fecc79 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-15-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-15-n.js
@@ -1,4 +1,5 @@
-/* ***** BEGIN LICENSE BLOCK *****
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+ ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
@@ -34,54 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-15-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-15-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-15-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-15-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var import = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var import = true", "error", eval("var import = true") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var import = true", "error", "var import = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-16-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-16-n.js
index 87371491c1d..9e255e8b1ee 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-16-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-16-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: lexical-023.js
- Corresponds To: 7.4.3-16-n.js
- ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-023.js";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-023.js";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+/*
+ try {
+ try = true;
+ } catch ( e ) {
+ result = expect;
+ exception = e.toString();
+ }
+*/
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
-
- try {
- try = true;
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "try = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+DESCRIPTION = "try = true";
+EXPECTED = "error";
+new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ "error",
+ eval("try = true") );
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-2-n.js
index 8e1e4414df5..e1b9d5fed07 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-2-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var debugger = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var debugger = true", "error", eval("var debugger = true") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var debugger = true", "error", "var debugger = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-3-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-3-n.js
index 5158a4aecbd..076d3ea550b 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-3-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-3-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var export = true";
+EXPECTED = "error";
+new TestCase( SECTION, "var export = true", "error", eval("var export = true") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var export = true", "error", "var export = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-4-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-4-n.js
index 52a15da320a..462b9d7bf84 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-4-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,53 +36,32 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.4.3-4-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-4-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var super = true", "error", "var super = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "var super = true",
+ "error",
+ eval("var super = true") );
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-5-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-5-n.js
index db0cfbf8ca6..b9f63f06227 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-5-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-5-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-5-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "var catch = true";
+EXPECTED = "error";
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "var catch = true", "error", eval("var catch = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var catch = true", "error", "var catch = true" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-6-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-6-n.js
index 154236181c1..1695142787a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-6-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-6-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-6-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-6-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-6-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var default = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var default = true", "error", "var default = true" );
- return ( array );
-}
+new TestCase( SECTION, "var default = true", "error", eval("var default = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-7-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-7-n.js
index cecf2e1a391..189b7d76173 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-7-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-7-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,51 +36,35 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.4.3-7-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-7-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-7-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-7-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var extends = true", "error", "var extends = true" );
- return ( array );
-}
+new TestCase( SECTION,
+ "var extends = true",
+ "error",
+ eval("var extends = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-8-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-8-n.js
index 5868746f4ab..9ddb672fefc 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-8-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-8-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.4.3-8-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var switch = true";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var switch = true", "error", "var switch = true" );
- return ( array );
-}
+new TestCase( SECTION, "var switch = true", "error", eval("var switch = true") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-9-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-9-n.js
index 87090b10455..5faca192758 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.4.3-9-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.4.3-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,51 +36,34 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.4.3-9-n.js
- ECMA Section: 7.4.3
+ File Name: 7.4.3-9-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.4.3-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Future Reserved Words";
+var SECTION = "7.4.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Future Reserved Words";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "var class = true",
+ "error",
+ eval("var class = true") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var class = true", "error", "var class = true" );
- return ( array );
-}
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-1.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-1.js
index b444f0aa651..e385fee5d76 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-1.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-1.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") );
+new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") );
- array[item++] = new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-10-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-10-n.js
index cdeb90f5578..185f12e97c0 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-10-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-10-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-9-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 123=\"hi\"";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 123=\"hi\"", "error", eval("123 = \"hi\"; array[item] = 123;") );
- array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" );
-
- 123 = "hi";
-
- array[item] = 123;
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-2-n.js
index b7e8339cf73..811734a6930 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-2-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 0abc";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 0abc", "error", eval("var 0abc") );
- array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 0abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-3-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-3-n.js
index 1ca79d7b997..ed441bfa583 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-3-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-2.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 1abc";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 1abc", "error", eval("var 1abc") );
- array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 1abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-4-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-4-n.js
index f07f8b84f89..98886b086eb 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-4-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-4-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-4-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-4-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-4-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-4-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 2abc";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 2abc", "error", eval("var 2abc") );
- array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 2abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-5-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-5-n.js
index d717933f9f5..ce1ef7d0997 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-5-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-5-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-5-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-5-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-5-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 3abc";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 3abc", "error", eval("var 3abc") );
- array[item++] = new TestCase( SECTION, "var 0abc", "error", "var 3abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-6.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-6.js
index c3b81a16a4c..511dadd28da 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-6.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,25 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-6.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-6.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "var _0abc = 5", 5, eval("var _0abc = 5; _0abc") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "var _0abc = 5", 5, "var _0abc = 5; _0abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-7.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-7.js
index e39ee721102..5e6eab4a56a 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-7.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,25 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-7.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-7.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "var $0abc = 5", 5, eval("var $0abc = 5; $0abc") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "var $0abc = 5", 5, "var $0abc = 5; $0abc" );
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-8-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-8-n.js
index 66d749192b3..78d7a630644 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-8-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-8-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.5-8-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "7.5-8-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Identifiers";
+var SECTION = "7.5-8-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Identifiers";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var @0abc = 5; @0abc";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var @0abc = 5; @0abc", "error", eval("var @0abc = 5; @0abc") );
- array[item++] = new TestCase( SECTION, "var @0abc = 5", "error", "var @0abc = 5; @0abc" );
- return ( array );
-}
-
-function test() {s
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.5-9-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.5-9-n.js
index 9fa1b067753..719b48cfd99 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.5-9-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.5-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 7.5-9-n.js
ECMA Section: 7.5 Identifiers
@@ -52,34 +54,9 @@
writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var 123=\"hi\"";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var 123=\"hi\"", "error", eval("var 123 = \"hi\";array[item] = 123;") );
- array[item] = new TestCase( SECTION, "var 123=\"hi\"", "error", "" );
-
- var 123 = "hi";
-
- array[item] = 123;
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +": "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : " ignored chars after line terminator of single-line comment";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.6.js b/mozilla/js/tests/ecma/LexicalConventions/7.6.js
index 5ebaaf2c8fb..d19445a6fba 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.6.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,290 +36,275 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.6.js
- ECMA Section: Punctuators
- Description:
+ File Name: 7.6.js
+ ECMA Section: Punctuators
+ Description:
- This tests verifies that all ECMA punctutors are recognized as a
- token separator, but does not attempt to verify the functionality
- of any punctuator.
+ This tests verifies that all ECMA punctutors are recognized as a
+ token separator, but does not attempt to verify the functionality
+ of any punctuator.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "7.6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Punctuators";
+var SECTION = "7.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Punctuators";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// ==
+new TestCase( SECTION,
+ "var c,d;c==d",
+ true,
+ eval("var c,d;c==d") );
- // ==
- testcases[tc++] = new TestCase( SECTION,
- "var c,d;c==d",
- true,
- eval("var c,d;c==d") );
+// =
- // =
+new TestCase( SECTION,
+ "var a=true;a",
+ true,
+ eval("var a=true;a") );
- testcases[tc++] = new TestCase( SECTION,
- "var a=true;a",
- true,
- eval("var a=true;a") );
+// >
+new TestCase( SECTION,
+ "var a=true,b=false;a>b",
+ true,
+ eval("var a=true,b=false;a>b") );
- // >
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=false;a>b",
- true,
- eval("var a=true,b=false;a>b") );
+// <
+new TestCase( SECTION,
+ "var a=true,b=false;a=
+new TestCase( SECTION,
+ "var a=0xFFFF,b=0XFFFE;a>=b",
+ true,
+ eval("var a=0xFFFF,b=0XFFFE;a>=b") );
- // >=
- testcases[tc++] = new TestCase( SECTION,
- "var a=0xFFFF,b=0XFFFE;a>=b",
- true,
- eval("var a=0xFFFF,b=0XFFFE;a>=b") );
+// !=
+new TestCase( SECTION,
+ "var a=true,b=false;a!=b",
+ true,
+ eval("var a=true,b=false;a!=b") );
- // !=
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=false;a!=b",
- true,
- eval("var a=true,b=false;a!=b") );
+new TestCase( SECTION,
+ "var a=false,b=false;a!=b",
+ false,
+ eval("var a=false,b=false;a!=b") );
+// ,
+new TestCase( SECTION,
+ "var a=true,b=false;a,b",
+ false,
+ eval("var a=true,b=false;a,b") );
+// !
+new TestCase( SECTION,
+ "var a=true,b=false;!a",
+ false,
+ eval("var a=true,b=false;!a") );
- testcases[tc++] = new TestCase( SECTION,
- "var a=false,b=false;a!=b",
- false,
- eval("var a=false,b=false;a!=b") );
- // ,
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=false;a,b",
- false,
- eval("var a=true,b=false;a,b") );
- // !
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=false;!a",
- false,
- eval("var a=true,b=false;!a") );
+// ~
+new TestCase( SECTION,
+ "var a=true;~a",
+ -2,
+ eval("var a=true;~a") );
+// ?
+new TestCase( SECTION,
+ "var a=true; (a ? 'PASS' : '')",
+ "PASS",
+ eval("var a=true; (a ? 'PASS' : '')") );
- // ~
- testcases[tc++] = new TestCase( SECTION,
- "var a=true;~a",
- -2,
- eval("var a=true;~a") );
- // ?
- testcases[tc++] = new TestCase( SECTION,
- "var a=true; (a ? 'PASS' : '')",
- "PASS",
- eval("var a=true; (a ? 'PASS' : '')") );
+// :
- // :
+new TestCase( SECTION,
+ "var a=false; (a ? 'FAIL' : 'PASS')",
+ "PASS",
+ eval("var a=false; (a ? 'FAIL' : 'PASS')") );
+// .
- testcases[tc++] = new TestCase( SECTION,
- "var a=false; (a ? 'FAIL' : 'PASS')",
- "PASS",
- eval("var a=false; (a ? 'FAIL' : 'PASS')") );
- // .
+new TestCase( SECTION,
+ "var a=Number;a.NaN",
+ NaN,
+ eval("var a=Number;a.NaN") );
- testcases[tc++] = new TestCase( SECTION,
- "var a=Number;a.NaN",
- NaN,
- eval("var a=Number;a.NaN") );
+// &&
+new TestCase( SECTION,
+ "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
+ "PASS",
+ eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
- // &&
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=true;if(a&&b)'PASS';else'FAIL'",
- "PASS",
- eval("var a=true,b=true;if(a&&b)'PASS';else'FAIL'") );
+// ||
+new TestCase( SECTION,
+ "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
+ "PASS",
+ eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
+// ++
+new TestCase( SECTION,
+ "var a=false,b=false;++a",
+ 1,
+ eval("var a=false,b=false;++a") );
+// --
+new TestCase( SECTION,
+ "var a=true,b=false--a",
+ 0,
+ eval("var a=true,b=false;--a") );
+// +
- // ||
- testcases[tc++] = new TestCase( SECTION,
- "var a=false,b=false;if(a||b)'FAIL';else'PASS'",
- "PASS",
- eval("var a=false,b=false;if(a||b)'FAIL';else'PASS'") );
- // ++
- testcases[tc++] = new TestCase( SECTION,
- "var a=false,b=false;++a",
- 1,
- eval("var a=false,b=false;++a") );
- // --
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=false--a",
- 0,
- eval("var a=true,b=false;--a") );
- // +
+new TestCase( SECTION,
+ "var a=true,b=true;a+b",
+ 2,
+ eval("var a=true,b=true;a+b") );
+// -
+new TestCase( SECTION,
+ "var a=true,b=true;a-b",
+ 0,
+ eval("var a=true,b=true;a-b") );
+// *
+new TestCase( SECTION,
+ "var a=true,b=true;a*b",
+ 1,
+ eval("var a=true,b=true;a*b") );
+// /
+new TestCase( SECTION,
+ "var a=true,b=true;a/b",
+ 1,
+ eval("var a=true,b=true;a/b") );
+// &
+new TestCase( SECTION,
+ "var a=3,b=2;a&b",
+ 2,
+ eval("var a=3,b=2;a&b") );
+// |
+new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 7,
+ eval("var a=4,b=3;a|b") );
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=true;a+b",
- 2,
- eval("var a=true,b=true;a+b") );
- // -
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=true;a-b",
- 0,
- eval("var a=true,b=true;a-b") );
- // *
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=true;a*b",
- 1,
- eval("var a=true,b=true;a*b") );
- // /
- testcases[tc++] = new TestCase( SECTION,
- "var a=true,b=true;a/b",
- 1,
- eval("var a=true,b=true;a/b") );
- // &
- testcases[tc++] = new TestCase( SECTION,
- "var a=3,b=2;a&b",
- 2,
- eval("var a=3,b=2;a&b") );
- // |
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a|b",
- 7,
- eval("var a=4,b=3;a|b") );
+// |
+new TestCase( SECTION,
+ "var a=4,b=3;a^b",
+ 7,
+ eval("var a=4,b=3;a^b") );
- // |
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a^b",
- 7,
- eval("var a=4,b=3;a^b") );
+// %
+new TestCase( SECTION,
+ "var a=4,b=3;a|b",
+ 1,
+ eval("var a=4,b=3;a%b") );
- // %
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a|b",
- 1,
- eval("var a=4,b=3;a%b") );
+// <<
+new TestCase( SECTION,
+ "var a=4,b=3;a<>
+new TestCase( SECTION,
+ "var a=4,b=1;a>>b",
+ 2,
+ eval("var a=4,b=1;a>>b") );
- // >>
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=1;a>>b",
- 2,
- eval("var a=4,b=1;a>>b") );
+// >>>
+new TestCase( SECTION,
+ "var a=1,b=1;a>>>b",
+ 0,
+ eval("var a=1,b=1;a>>>b") );
+// +=
+new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
- // >>>
- testcases[tc++] = new TestCase( SECTION,
- "var a=1,b=1;a>>>b",
- 0,
- eval("var a=1,b=1;a>>>b") );
- // +=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a+=b;a",
- 7,
- eval("var a=4,b=3;a+=b;a") );
+// -=
+new TestCase( SECTION,
+ "var a=4,b=3;a-=b;a",
+ 1,
+ eval("var a=4,b=3;a-=b;a") );
+// *=
+new TestCase( SECTION,
+ "var a=4,b=3;a*=b;a",
+ 12,
+ eval("var a=4,b=3;a*=b;a") );
+// +=
+new TestCase( SECTION,
+ "var a=4,b=3;a+=b;a",
+ 7,
+ eval("var a=4,b=3;a+=b;a") );
+// /=
+new TestCase( SECTION,
+ "var a=12,b=3;a/=b;a",
+ 4,
+ eval("var a=12,b=3;a/=b;a") );
- // -=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a-=b;a",
- 1,
- eval("var a=4,b=3;a-=b;a") );
- // *=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a*=b;a",
- 12,
- eval("var a=4,b=3;a*=b;a") );
- // +=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a+=b;a",
- 7,
- eval("var a=4,b=3;a+=b;a") );
- // /=
- testcases[tc++] = new TestCase( SECTION,
- "var a=12,b=3;a/=b;a",
- 4,
- eval("var a=12,b=3;a/=b;a") );
+// &=
+new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 4,
+ eval("var a=4,b=5;a&=b;a") );
- // &=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=5;a&=b;a",
- 4,
- eval("var a=4,b=5;a&=b;a") );
+// |=
+new TestCase( SECTION,
+ "var a=4,b=5;a&=b;a",
+ 5,
+ eval("var a=4,b=5;a|=b;a") );
+// ^=
+new TestCase( SECTION,
+ "var a=4,b=5;a^=b;a",
+ 1,
+ eval("var a=4,b=5;a^=b;a") );
+// %=
+new TestCase( SECTION,
+ "var a=12,b=5;a%=b;a",
+ 2,
+ eval("var a=12,b=5;a%=b;a") );
+// <<=
+new TestCase( SECTION,
+ "var a=4,b=3;a<<=b;a",
+ 32,
+ eval("var a=4,b=3;a<<=b;a") );
- // |=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=5;a&=b;a",
- 5,
- eval("var a=4,b=5;a|=b;a") );
- // ^=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=5;a^=b;a",
- 1,
- eval("var a=4,b=5;a^=b;a") );
- // %=
- testcases[tc++] = new TestCase( SECTION,
- "var a=12,b=5;a%=b;a",
- 2,
- eval("var a=12,b=5;a%=b;a") );
- // <<=
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;a<<=b;a",
- 32,
- eval("var a=4,b=3;a<<=b;a") );
+// >>
+new TestCase( SECTION,
+ "var a=4,b=1;a>>=b;a",
+ 2,
+ eval("var a=4,b=1;a>>=b;a") );
- // >>
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=1;a>>=b;a",
- 2,
- eval("var a=4,b=1;a>>=b;a") );
+// >>>
+new TestCase( SECTION,
+ "var a=1,b=1;a>>>=b;a",
+ 0,
+ eval("var a=1,b=1;a>>>=b;a") );
- // >>>
- testcases[tc++] = new TestCase( SECTION,
- "var a=1,b=1;a>>>=b;a",
- 0,
- eval("var a=1,b=1;a>>>=b;a") );
+// ()
+new TestCase( SECTION,
+ "var a=4,b=3;(a)",
+ 4,
+ eval("var a=4,b=3;(a)") );
+// {}
+new TestCase( SECTION,
+ "var a=4,b=3;{b}",
+ 3,
+ eval("var a=4,b=3;{b}") );
- // ()
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;(a)",
- 4,
- eval("var a=4,b=3;(a)") );
- // {}
- testcases[tc++] = new TestCase( SECTION,
- "var a=4,b=3;{b}",
- 3,
- eval("var a=4,b=3;{b}") );
+// []
+new TestCase( SECTION,
+ "var a=new Array('hi');a[0]",
+ "hi",
+ eval("var a=new Array('hi');a[0]") );
+// []
+new TestCase( SECTION,
+ ";",
+ void 0,
+ eval(";") );
+test();
- // []
- testcases[tc++] = new TestCase( SECTION,
- "var a=new Array('hi');a[0]",
- "hi",
- eval("var a=new Array('hi');a[0]") );
- // []
- testcases[tc++] = new TestCase( SECTION,
- ";",
- void 0,
- eval(";") );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.1.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.1.js
index 81b5134dbde..cf17a8393d4 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.7.1.js
- ECMA Section: 7.7.1 Null Literals
+ File Name: 7.7.1.js
+ ECMA Section: 7.7.1 Null Literals
- Description: NullLiteral::
- null
+ Description: NullLiteral::
+ null
- The value of the null literal null is the sole value
- of the Null type, namely null.
+ The value of the null literal null is the sole value
+ of the Null type, namely null.
- Author: christine@netscape.com
- Date: 21 october 1997
+ Author: christine@netscape.com
+ Date: 21 october 1997
*/
- var SECTION = "7.7.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Null Literals";
+var SECTION = "7.7.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Null Literals";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "null", null, null);
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "null", null, null);
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
-
- // all tests must return the test array
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.2.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.2.js
index 196c291e344..c24951e0996 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.2.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.7.2.js
- ECMA Section: 7.7.2 Boolean Literals
+ File Name: 7.7.2.js
+ ECMA Section: 7.7.2 Boolean Literals
- Description: BooleanLiteral::
- true
- false
+ Description: BooleanLiteral::
+ true
+ false
- The value of the Boolean literal true is a value of the
- Boolean type, namely true.
+ The value of the Boolean literal true is a value of the
+ Boolean type, namely true.
- The value of the Boolean literal false is a value of the
- Boolean type, namely false.
+ The value of the Boolean literal false is a value of the
+ Boolean type, namely false.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "7.7.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Boolean Literals";
+var SECTION = "7.7.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Boolean Literals";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// StringLiteral:: "" and ''
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "true", Boolean(true), true );
+new TestCase( SECTION, "false", Boolean(false), false );
- // StringLiteral:: "" and ''
-
- array[item++] = new TestCase( SECTION, "true", Boolean(true), true );
- array[item++] = new TestCase( SECTION, "false", Boolean(false), false );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- stopTest();
- }
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.3-1.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.3-1.js
index 8f3772b3137..66521abff35 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.3-1.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,179 +35,161 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.7.3-1.js
- ECMA Section: 7.7.3 Numeric Literals
+ File Name: 7.7.3-1.js
+ ECMA Section: 7.7.3 Numeric Literals
- Description: A numeric literal stands for a value of the Number type
- This value is determined in two steps: first a
- mathematical value (MV) is derived from the literal;
- second, this mathematical value is rounded, ideally
- using IEEE 754 round-to-nearest mode, to a reprentable
- value of of the number type.
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
- These test cases came from Waldemar.
+ These test cases came from Waldemar.
- Author: christine@netscape.com
- Date: 12 June 1998
+ Author: christine@netscape.com
+ Date: 12 June 1998
*/
var SECTION = "7.7.3-1";
var VERSION = "ECMA_1";
- startTest();
+startTest();
var TITLE = "Numeric Literals";
var BUGNUMBER="122877";
writeHeaderToLog( SECTION + " "+ TITLE);
-var testcases = new Array();
+new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
+new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
-testcases[tc++] = new TestCase( SECTION,
- "0x12345678",
- 305419896,
- 0x12345678 );
+new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
-testcases[tc++] = new TestCase( SECTION,
- "0x80000000",
- 2147483648,
- 0x80000000 );
+new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
-testcases[tc++] = new TestCase( SECTION,
- "0xffffffff",
- 4294967295,
- 0xffffffff );
+new TestCase( SECTION,
+ "077777777777777777",
+ 2251799813685247,
+ 077777777777777777 );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000",
- 4294967296,
- 0x100000000 );
+new TestCase( SECTION,
+ "077777777777777776",
+ 2251799813685246,
+ 077777777777777776 );
-testcases[tc++] = new TestCase( SECTION,
- "077777777777777777",
- 2251799813685247,
- 077777777777777777 );
+new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
-testcases[tc++] = new TestCase( SECTION,
- "077777777777777776",
- 2251799813685246,
- 077777777777777776 );
+new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1fffffffffffff",
- 9007199254740991,
- 0x1fffffffffffff );
+new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
-testcases[tc++] = new TestCase( SECTION,
- "0x20000000000000",
- 9007199254740992,
- 0x20000000000000 );
+new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abc",
- 9027215253084860,
- 0x20123456789abc );
+new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abd",
- 9027215253084860,
- 0x20123456789abd );
+new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abe",
- 9027215253084862,
- 0x20123456789abe );
+new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abf",
- 9027215253084864,
- 0x20123456789abf );
+new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000080",
- 1152921504606847000,
- 0x1000000000000080 );
+new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000081",
- 1152921504606847200,
- 0x1000000000000081 );
+new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000100",
- 1152921504606847200,
- 0x1000000000000100 );
+new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000000017f",
- 1152921504606847200,
- 0x100000000000017f );
+new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000180",
- 1152921504606847500,
- 0x1000000000000180 );
+new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000181",
- 1152921504606847500,
- 0x1000000000000181 );
+new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000001f0",
- 1152921504606847500,
- 0x10000000000001f0 );
+new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000200",
- 1152921504606847500,
- 0x1000000000000200 );
+new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000000027f",
- 1152921504606847500,
- 0x100000000000027f );
+new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000280",
- 1152921504606847500,
- 0x1000000000000280 );
+new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000281",
- 1152921504606847700,
- 0x1000000000000281 );
+new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000002ff",
- 1152921504606847700,
- 0x10000000000002ff );
-
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000300",
- 1152921504606847700,
- 0x1000000000000300 );
-
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000000000",
- 18446744073709552000,
- 0x10000000000000000 );
+new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.3-2.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.3-2.js
index 504eaeafbe8..8fd820edf85 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.3-2.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,75 +35,56 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 7.7.3-2.js
- ECMA Section: 7.7.3 Numeric Literals
+ File Name: 7.7.3-2.js
+ ECMA Section: 7.7.3 Numeric Literals
- Description:
+ Description:
- This is a regression test for
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884
+ This is a regression test for
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884
- Waldemar's comments:
+ Waldemar's comments:
- A numeric literal that starts with either '08' or '09' is interpreted as a
- decimal literal; it should be an error instead. (Strictly speaking, according
- to ECMA v1 such literals should be interpreted as two integers -- a zero
- followed by a decimal number whose first digit is 8 or 9, but this is a bug in
- ECMA that will be fixed in v2. In any case, there is no place in the grammar
- where two consecutive numbers would be legal.)
+ A numeric literal that starts with either '08' or '09' is interpreted as a
+ decimal literal; it should be an error instead. (Strictly speaking, according
+ to ECMA v1 such literals should be interpreted as two integers -- a zero
+ followed by a decimal number whose first digit is 8 or 9, but this is a bug in
+ ECMA that will be fixed in v2. In any case, there is no place in the grammar
+ where two consecutive numbers would be legal.)
- Author: christine@netscape.com
- Date: 15 june 1998
+ Author: christine@netscape.com
+ Date: 15 june 1998
*/
- var SECTION = "7.7.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Numeric Literals";
- var BUGNUMBER="122884";
+var SECTION = "7.7.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Numeric Literals";
+var BUGNUMBER="122884";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "9",
+ 9,
+ 9 );
- testcases[tc++] = new TestCase( SECTION,
- "9",
- 9,
- 9 );
+new TestCase( SECTION,
+ "09",
+ 9,
+ 09 );
- testcases[tc++] = new TestCase( SECTION,
- "09",
- 9,
- 09 );
-
- testcases[tc++] = new TestCase( SECTION,
- "099",
- 99,
- 099 );
+new TestCase( SECTION,
+ "099",
+ 99,
+ 099 );
- testcases[tc++] = new TestCase( SECTION,
- "077",
- 63,
- 077 );
+new TestCase( SECTION,
+ "077",
+ 63,
+ 077 );
- test();
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.3.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.3.js
index fb8686e0a66..9f480eff754 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.3.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,318 +36,293 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.7.3.js
- ECMA Section: 7.7.3 Numeric Literals
+ File Name: 7.7.3.js
+ ECMA Section: 7.7.3 Numeric Literals
- Description: A numeric literal stands for a value of the Number type
- This value is determined in two steps: first a
- mathematical value (MV) is derived from the literal;
- second, this mathematical value is rounded, ideally
- using IEEE 754 round-to-nearest mode, to a reprentable
- value of of the number type.
+ Description: A numeric literal stands for a value of the Number type
+ This value is determined in two steps: first a
+ mathematical value (MV) is derived from the literal;
+ second, this mathematical value is rounded, ideally
+ using IEEE 754 round-to-nearest mode, to a reprentable
+ value of of the number type.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "7.7.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Numeric Literals";
+var SECTION = "7.7.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Numeric Literals";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "0", 0, 0 );
+new TestCase( SECTION, "1", 1, 1 );
+new TestCase( SECTION, "2", 2, 2 );
+new TestCase( SECTION, "3", 3, 3 );
+new TestCase( SECTION, "4", 4, 4 );
+new TestCase( SECTION, "5", 5, 5 );
+new TestCase( SECTION, "6", 6, 6 );
+new TestCase( SECTION, "7", 7, 7 );
+new TestCase( SECTION, "8", 8, 8 );
+new TestCase( SECTION, "9", 9, 9 );
+
+new TestCase( SECTION, "0.", 0, 0. );
+new TestCase( SECTION, "1.", 1, 1. );
+new TestCase( SECTION, "2.", 2, 2. );
+new TestCase( SECTION, "3.", 3, 3. );
+new TestCase( SECTION, "4.", 4, 4. );
+
+new TestCase( SECTION, "0.e0", 0, 0.e0 );
+new TestCase( SECTION, "1.e1", 10, 1.e1 );
+new TestCase( SECTION, "2.e2", 200, 2.e2 );
+new TestCase( SECTION, "3.e3", 3000, 3.e3 );
+new TestCase( SECTION, "4.e4", 40000, 4.e4 );
+
+new TestCase( SECTION, "0.1e0", .1, 0.1e0 );
+new TestCase( SECTION, "1.1e1", 11, 1.1e1 );
+new TestCase( SECTION, "2.2e2", 220, 2.2e2 );
+new TestCase( SECTION, "3.3e3", 3300, 3.3e3 );
+new TestCase( SECTION, "4.4e4", 44000, 4.4e4 );
+
+new TestCase( SECTION, ".1e0", .1, .1e0 );
+new TestCase( SECTION, ".1e1", 1, .1e1 );
+new TestCase( SECTION, ".2e2", 20, .2e2 );
+new TestCase( SECTION, ".3e3", 300, .3e3 );
+new TestCase( SECTION, ".4e4", 4000, .4e4 );
+
+new TestCase( SECTION, "0e0", 0, 0e0 );
+new TestCase( SECTION, "1e1", 10, 1e1 );
+new TestCase( SECTION, "2e2", 200, 2e2 );
+new TestCase( SECTION, "3e3", 3000, 3e3 );
+new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+new TestCase( SECTION, "0e0", 0, 0e0 );
+new TestCase( SECTION, "1e1", 10, 1e1 );
+new TestCase( SECTION, "2e2", 200, 2e2 );
+new TestCase( SECTION, "3e3", 3000, 3e3 );
+new TestCase( SECTION, "4e4", 40000, 4e4 );
+
+new TestCase( SECTION, "0E0", 0, 0E0 );
+new TestCase( SECTION, "1E1", 10, 1E1 );
+new TestCase( SECTION, "2E2", 200, 2E2 );
+new TestCase( SECTION, "3E3", 3000, 3E3 );
+new TestCase( SECTION, "4E4", 40000, 4E4 );
+
+new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 );
+new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 );
+new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 );
+new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 );
+
+new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 );
+new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 );
+new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 );
+new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 );
+new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 );
+
+new TestCase( SECTION, ".1e-0", .1, .1e-0 );
+new TestCase( SECTION, ".1e-1", .01, .1e-1 );
+new TestCase( SECTION, ".2e-2", .002, .2e-2 );
+new TestCase( SECTION, ".3e-3", .0003, .3e-3 );
+new TestCase( SECTION, ".4e-4", .00004, .4e-4 );
+
+new TestCase( SECTION, "1.e+1", 10, 1.e+1 );
+new TestCase( SECTION, "2.e+2", 200, 2.e+2 );
+new TestCase( SECTION, "3.e+3", 3000, 3.e+3 );
+new TestCase( SECTION, "4.e+4", 40000, 4.e+4 );
+
+new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 );
+new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 );
+new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 );
+new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 );
+new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 );
+
+new TestCase( SECTION, ".1e+0", .1, .1e+0 );
+new TestCase( SECTION, ".1e+1", 1, .1e+1 );
+new TestCase( SECTION, ".2e+2", 20, .2e+2 );
+new TestCase( SECTION, ".3e+3", 300, .3e+3 );
+new TestCase( SECTION, ".4e+4", 4000, .4e+4 );
+
+new TestCase( SECTION, "0x0", 0, 0x0 );
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x2", 2, 0x2 );
+new TestCase( SECTION, "0x3", 3, 0x3 );
+new TestCase( SECTION, "0x4", 4, 0x4 );
+new TestCase( SECTION, "0x5", 5, 0x5 );
+new TestCase( SECTION, "0x6", 6, 0x6 );
+new TestCase( SECTION, "0x7", 7, 0x7 );
+new TestCase( SECTION, "0x8", 8, 0x8 );
+new TestCase( SECTION, "0x9", 9, 0x9 );
+new TestCase( SECTION, "0xa", 10, 0xa );
+new TestCase( SECTION, "0xb", 11, 0xb );
+new TestCase( SECTION, "0xc", 12, 0xc );
+new TestCase( SECTION, "0xd", 13, 0xd );
+new TestCase( SECTION, "0xe", 14, 0xe );
+new TestCase( SECTION, "0xf", 15, 0xf );
+
+new TestCase( SECTION, "0X0", 0, 0X0 );
+new TestCase( SECTION, "0X1", 1, 0X1 );
+new TestCase( SECTION, "0X2", 2, 0X2 );
+new TestCase( SECTION, "0X3", 3, 0X3 );
+new TestCase( SECTION, "0X4", 4, 0X4 );
+new TestCase( SECTION, "0X5", 5, 0X5 );
+new TestCase( SECTION, "0X6", 6, 0X6 );
+new TestCase( SECTION, "0X7", 7, 0X7 );
+new TestCase( SECTION, "0X8", 8, 0X8 );
+new TestCase( SECTION, "0X9", 9, 0X9 );
+new TestCase( SECTION, "0Xa", 10, 0Xa );
+new TestCase( SECTION, "0Xb", 11, 0Xb );
+new TestCase( SECTION, "0Xc", 12, 0Xc );
+new TestCase( SECTION, "0Xd", 13, 0Xd );
+new TestCase( SECTION, "0Xe", 14, 0Xe );
+new TestCase( SECTION, "0Xf", 15, 0Xf );
+
+new TestCase( SECTION, "0x0", 0, 0x0 );
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x2", 2, 0x2 );
+new TestCase( SECTION, "0x3", 3, 0x3 );
+new TestCase( SECTION, "0x4", 4, 0x4 );
+new TestCase( SECTION, "0x5", 5, 0x5 );
+new TestCase( SECTION, "0x6", 6, 0x6 );
+new TestCase( SECTION, "0x7", 7, 0x7 );
+new TestCase( SECTION, "0x8", 8, 0x8 );
+new TestCase( SECTION, "0x9", 9, 0x9 );
+new TestCase( SECTION, "0xA", 10, 0xA );
+new TestCase( SECTION, "0xB", 11, 0xB );
+new TestCase( SECTION, "0xC", 12, 0xC );
+new TestCase( SECTION, "0xD", 13, 0xD );
+new TestCase( SECTION, "0xE", 14, 0xE );
+new TestCase( SECTION, "0xF", 15, 0xF );
+
+new TestCase( SECTION, "0X0", 0, 0X0 );
+new TestCase( SECTION, "0X1", 1, 0X1 );
+new TestCase( SECTION, "0X2", 2, 0X2 );
+new TestCase( SECTION, "0X3", 3, 0X3 );
+new TestCase( SECTION, "0X4", 4, 0X4 );
+new TestCase( SECTION, "0X5", 5, 0X5 );
+new TestCase( SECTION, "0X6", 6, 0X6 );
+new TestCase( SECTION, "0X7", 7, 0X7 );
+new TestCase( SECTION, "0X8", 8, 0X8 );
+new TestCase( SECTION, "0X9", 9, 0X9 );
+new TestCase( SECTION, "0XA", 10, 0XA );
+new TestCase( SECTION, "0XB", 11, 0XB );
+new TestCase( SECTION, "0XC", 12, 0XC );
+new TestCase( SECTION, "0XD", 13, 0XD );
+new TestCase( SECTION, "0XE", 14, 0XE );
+new TestCase( SECTION, "0XF", 15, 0XF );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "00", 0, 00 );
+new TestCase( SECTION, "01", 1, 01 );
+new TestCase( SECTION, "02", 2, 02 );
+new TestCase( SECTION, "03", 3, 03 );
+new TestCase( SECTION, "04", 4, 04 );
+new TestCase( SECTION, "05", 5, 05 );
+new TestCase( SECTION, "06", 6, 06 );
+new TestCase( SECTION, "07", 7, 07 );
- array[item++] = new TestCase( SECTION, "0", 0, 0 );
- array[item++] = new TestCase( SECTION, "1", 1, 1 );
- array[item++] = new TestCase( SECTION, "2", 2, 2 );
- array[item++] = new TestCase( SECTION, "3", 3, 3 );
- array[item++] = new TestCase( SECTION, "4", 4, 4 );
- array[item++] = new TestCase( SECTION, "5", 5, 5 );
- array[item++] = new TestCase( SECTION, "6", 6, 6 );
- array[item++] = new TestCase( SECTION, "7", 7, 7 );
- array[item++] = new TestCase( SECTION, "8", 8, 8 );
- array[item++] = new TestCase( SECTION, "9", 9, 9 );
+new TestCase( SECTION, "000", 0, 000 );
+new TestCase( SECTION, "011", 9, 011 );
+new TestCase( SECTION, "022", 18, 022 );
+new TestCase( SECTION, "033", 27, 033 );
+new TestCase( SECTION, "044", 36, 044 );
+new TestCase( SECTION, "055", 45, 055 );
+new TestCase( SECTION, "066", 54, 066 );
+new TestCase( SECTION, "077", 63, 077 );
- array[item++] = new TestCase( SECTION, "0.", 0, 0. );
- array[item++] = new TestCase( SECTION, "1.", 1, 1. );
- array[item++] = new TestCase( SECTION, "2.", 2, 2. );
- array[item++] = new TestCase( SECTION, "3.", 3, 3. );
- array[item++] = new TestCase( SECTION, "4.", 4, 4. );
-
- array[item++] = new TestCase( SECTION, "0.e0", 0, 0.e0 );
- array[item++] = new TestCase( SECTION, "1.e1", 10, 1.e1 );
- array[item++] = new TestCase( SECTION, "2.e2", 200, 2.e2 );
- array[item++] = new TestCase( SECTION, "3.e3", 3000, 3.e3 );
- array[item++] = new TestCase( SECTION, "4.e4", 40000, 4.e4 );
-
- array[item++] = new TestCase( SECTION, "0.1e0", .1, 0.1e0 );
- array[item++] = new TestCase( SECTION, "1.1e1", 11, 1.1e1 );
- array[item++] = new TestCase( SECTION, "2.2e2", 220, 2.2e2 );
- array[item++] = new TestCase( SECTION, "3.3e3", 3300, 3.3e3 );
- array[item++] = new TestCase( SECTION, "4.4e4", 44000, 4.4e4 );
-
- array[item++] = new TestCase( SECTION, ".1e0", .1, .1e0 );
- array[item++] = new TestCase( SECTION, ".1e1", 1, .1e1 );
- array[item++] = new TestCase( SECTION, ".2e2", 20, .2e2 );
- array[item++] = new TestCase( SECTION, ".3e3", 300, .3e3 );
- array[item++] = new TestCase( SECTION, ".4e4", 4000, .4e4 );
-
- array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 );
- array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 );
- array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 );
- array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 );
- array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 );
-
- array[item++] = new TestCase( SECTION, "0e0", 0, 0e0 );
- array[item++] = new TestCase( SECTION, "1e1", 10, 1e1 );
- array[item++] = new TestCase( SECTION, "2e2", 200, 2e2 );
- array[item++] = new TestCase( SECTION, "3e3", 3000, 3e3 );
- array[item++] = new TestCase( SECTION, "4e4", 40000, 4e4 );
-
- array[item++] = new TestCase( SECTION, "0E0", 0, 0E0 );
- array[item++] = new TestCase( SECTION, "1E1", 10, 1E1 );
- array[item++] = new TestCase( SECTION, "2E2", 200, 2E2 );
- array[item++] = new TestCase( SECTION, "3E3", 3000, 3E3 );
- array[item++] = new TestCase( SECTION, "4E4", 40000, 4E4 );
-
- array[item++] = new TestCase( SECTION, "1.e-1", 0.1, 1.e-1 );
- array[item++] = new TestCase( SECTION, "2.e-2", 0.02, 2.e-2 );
- array[item++] = new TestCase( SECTION, "3.e-3", 0.003, 3.e-3 );
- array[item++] = new TestCase( SECTION, "4.e-4", 0.0004, 4.e-4 );
-
- array[item++] = new TestCase( SECTION, "0.1e-0", .1, 0.1e-0 );
- array[item++] = new TestCase( SECTION, "1.1e-1", 0.11, 1.1e-1 );
- array[item++] = new TestCase( SECTION, "2.2e-2", .022, 2.2e-2 );
- array[item++] = new TestCase( SECTION, "3.3e-3", .0033, 3.3e-3 );
- array[item++] = new TestCase( SECTION, "4.4e-4", .00044, 4.4e-4 );
-
- array[item++] = new TestCase( SECTION, ".1e-0", .1, .1e-0 );
- array[item++] = new TestCase( SECTION, ".1e-1", .01, .1e-1 );
- array[item++] = new TestCase( SECTION, ".2e-2", .002, .2e-2 );
- array[item++] = new TestCase( SECTION, ".3e-3", .0003, .3e-3 );
- array[item++] = new TestCase( SECTION, ".4e-4", .00004, .4e-4 );
-
- array[item++] = new TestCase( SECTION, "1.e+1", 10, 1.e+1 );
- array[item++] = new TestCase( SECTION, "2.e+2", 200, 2.e+2 );
- array[item++] = new TestCase( SECTION, "3.e+3", 3000, 3.e+3 );
- array[item++] = new TestCase( SECTION, "4.e+4", 40000, 4.e+4 );
-
- array[item++] = new TestCase( SECTION, "0.1e+0", .1, 0.1e+0 );
- array[item++] = new TestCase( SECTION, "1.1e+1", 11, 1.1e+1 );
- array[item++] = new TestCase( SECTION, "2.2e+2", 220, 2.2e+2 );
- array[item++] = new TestCase( SECTION, "3.3e+3", 3300, 3.3e+3 );
- array[item++] = new TestCase( SECTION, "4.4e+4", 44000, 4.4e+4 );
-
- array[item++] = new TestCase( SECTION, ".1e+0", .1, .1e+0 );
- array[item++] = new TestCase( SECTION, ".1e+1", 1, .1e+1 );
- array[item++] = new TestCase( SECTION, ".2e+2", 20, .2e+2 );
- array[item++] = new TestCase( SECTION, ".3e+3", 300, .3e+3 );
- array[item++] = new TestCase( SECTION, ".4e+4", 4000, .4e+4 );
-
- array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 );
- array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
- array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 );
- array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 );
- array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 );
- array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 );
- array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 );
- array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 );
- array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 );
- array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 );
- array[item++] = new TestCase( SECTION, "0xa", 10, 0xa );
- array[item++] = new TestCase( SECTION, "0xb", 11, 0xb );
- array[item++] = new TestCase( SECTION, "0xc", 12, 0xc );
- array[item++] = new TestCase( SECTION, "0xd", 13, 0xd );
- array[item++] = new TestCase( SECTION, "0xe", 14, 0xe );
- array[item++] = new TestCase( SECTION, "0xf", 15, 0xf );
-
- array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 );
- array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 );
- array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 );
- array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 );
- array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 );
- array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 );
- array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 );
- array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 );
- array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 );
- array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 );
- array[item++] = new TestCase( SECTION, "0Xa", 10, 0Xa );
- array[item++] = new TestCase( SECTION, "0Xb", 11, 0Xb );
- array[item++] = new TestCase( SECTION, "0Xc", 12, 0Xc );
- array[item++] = new TestCase( SECTION, "0Xd", 13, 0Xd );
- array[item++] = new TestCase( SECTION, "0Xe", 14, 0Xe );
- array[item++] = new TestCase( SECTION, "0Xf", 15, 0Xf );
-
- array[item++] = new TestCase( SECTION, "0x0", 0, 0x0 );
- array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
- array[item++] = new TestCase( SECTION, "0x2", 2, 0x2 );
- array[item++] = new TestCase( SECTION, "0x3", 3, 0x3 );
- array[item++] = new TestCase( SECTION, "0x4", 4, 0x4 );
- array[item++] = new TestCase( SECTION, "0x5", 5, 0x5 );
- array[item++] = new TestCase( SECTION, "0x6", 6, 0x6 );
- array[item++] = new TestCase( SECTION, "0x7", 7, 0x7 );
- array[item++] = new TestCase( SECTION, "0x8", 8, 0x8 );
- array[item++] = new TestCase( SECTION, "0x9", 9, 0x9 );
- array[item++] = new TestCase( SECTION, "0xA", 10, 0xA );
- array[item++] = new TestCase( SECTION, "0xB", 11, 0xB );
- array[item++] = new TestCase( SECTION, "0xC", 12, 0xC );
- array[item++] = new TestCase( SECTION, "0xD", 13, 0xD );
- array[item++] = new TestCase( SECTION, "0xE", 14, 0xE );
- array[item++] = new TestCase( SECTION, "0xF", 15, 0xF );
-
- array[item++] = new TestCase( SECTION, "0X0", 0, 0X0 );
- array[item++] = new TestCase( SECTION, "0X1", 1, 0X1 );
- array[item++] = new TestCase( SECTION, "0X2", 2, 0X2 );
- array[item++] = new TestCase( SECTION, "0X3", 3, 0X3 );
- array[item++] = new TestCase( SECTION, "0X4", 4, 0X4 );
- array[item++] = new TestCase( SECTION, "0X5", 5, 0X5 );
- array[item++] = new TestCase( SECTION, "0X6", 6, 0X6 );
- array[item++] = new TestCase( SECTION, "0X7", 7, 0X7 );
- array[item++] = new TestCase( SECTION, "0X8", 8, 0X8 );
- array[item++] = new TestCase( SECTION, "0X9", 9, 0X9 );
- array[item++] = new TestCase( SECTION, "0XA", 10, 0XA );
- array[item++] = new TestCase( SECTION, "0XB", 11, 0XB );
- array[item++] = new TestCase( SECTION, "0XC", 12, 0XC );
- array[item++] = new TestCase( SECTION, "0XD", 13, 0XD );
- array[item++] = new TestCase( SECTION, "0XE", 14, 0XE );
- array[item++] = new TestCase( SECTION, "0XF", 15, 0XF );
+new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 );
+new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 );
- array[item++] = new TestCase( SECTION, "00", 0, 00 );
- array[item++] = new TestCase( SECTION, "01", 1, 01 );
- array[item++] = new TestCase( SECTION, "02", 2, 02 );
- array[item++] = new TestCase( SECTION, "03", 3, 03 );
- array[item++] = new TestCase( SECTION, "04", 4, 04 );
- array[item++] = new TestCase( SECTION, "05", 5, 05 );
- array[item++] = new TestCase( SECTION, "06", 6, 06 );
- array[item++] = new TestCase( SECTION, "07", 7, 07 );
+new TestCase( SECTION,
+ "123456789012345671.9999",
+ "123456789012345660",
+ 123456789012345671.9999 +"");
+new TestCase( SECTION,
+ "123456789012345672",
+ "123456789012345660",
+ 123456789012345672 +"");
- array[item++] = new TestCase( SECTION, "000", 0, 000 );
- array[item++] = new TestCase( SECTION, "011", 9, 011 );
- array[item++] = new TestCase( SECTION, "022", 18, 022 );
- array[item++] = new TestCase( SECTION, "033", 27, 033 );
- array[item++] = new TestCase( SECTION, "044", 36, 044 );
- array[item++] = new TestCase( SECTION, "055", 45, 055 );
- array[item++] = new TestCase( SECTION, "066", 54, 066 );
- array[item++] = new TestCase( SECTION, "077", 63, 077 );
+new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000000",
+ "123456789012345660",
+ 123456789012345672.000000000000000000000000000 +"");
- array[item++] = new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 );
- array[item++] = new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 );
+new TestCase( SECTION,
+ "123456789012345672.01",
+ "123456789012345680",
+ 123456789012345672.01 +"");
+new TestCase( SECTION,
+ "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660",
+ true,
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 )
+ ||
+ ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) );
- array[item++] = new TestCase( SECTION,
- "123456789012345671.9999",
- "123456789012345660",
- 123456789012345671.9999 +"");
- array[item++] = new TestCase( SECTION,
- "123456789012345672",
- "123456789012345660",
- 123456789012345672 +"");
+new TestCase( SECTION,
+ "123456789012345673",
+ "123456789012345680",
+ 123456789012345673 +"" );
- array[item++] = new TestCase( SECTION,
- "123456789012345672.000000000000000000000000000",
- "123456789012345660",
- 123456789012345672.000000000000000000000000000 +"");
+new TestCase( SECTION,
+ "-123456789012345671.9999",
+ "-123456789012345660",
+ -123456789012345671.9999 +"" );
- array[item++] = new TestCase( SECTION,
- "123456789012345672.01",
- "123456789012345680",
- 123456789012345672.01 +"");
+new TestCase( SECTION,
+ "-123456789012345672",
+ "-123456789012345660",
+ -123456789012345672+"");
- array[item++] = new TestCase( SECTION,
- "123456789012345672.000000000000000000000000001+'' == 123456789012345680 || 123456789012345660",
- true,
- ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345680 )
- ||
- ( 123456789012345672.00000000000000000000000000 +"" == 1234567890 * 100000000 + 12345660) );
+new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000000",
+ "-123456789012345660",
+ -123456789012345672.000000000000000000000000000 +"");
- array[item++] = new TestCase( SECTION,
- "123456789012345673",
- "123456789012345680",
- 123456789012345673 +"" );
+new TestCase( SECTION,
+ "-123456789012345672.01",
+ "-123456789012345680",
+ -123456789012345672.01 +"" );
- array[item++] = new TestCase( SECTION,
- "-123456789012345671.9999",
- "-123456789012345660",
- -123456789012345671.9999 +"" );
+new TestCase( SECTION,
+ "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660",
+ true,
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680)
+ ||
+ (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660));
- array[item++] = new TestCase( SECTION,
- "-123456789012345672",
- "-123456789012345660",
- -123456789012345672+"");
+new TestCase( SECTION,
+ -123456789012345673,
+ "-123456789012345680",
+ -123456789012345673 +"");
- array[item++] = new TestCase( SECTION,
- "-123456789012345672.000000000000000000000000000",
- "-123456789012345660",
- -123456789012345672.000000000000000000000000000 +"");
-
- array[item++] = new TestCase( SECTION,
- "-123456789012345672.01",
- "-123456789012345680",
- -123456789012345672.01 +"" );
-
- array[item++] = new TestCase( SECTION,
- "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660",
- true,
- (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680)
- ||
- (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660));
-
- array[item++] = new TestCase( SECTION,
- -123456789012345673,
- "-123456789012345680",
- -123456789012345673 +"");
-
- array[item++] = new TestCase( SECTION,
- "12345678901234567890",
- "12345678901234567000",
- 12345678901234567890 +"" );
+new TestCase( SECTION,
+ "12345678901234567890",
+ "12345678901234567000",
+ 12345678901234567890 +"" );
/*
- array[item++] = new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" );
- array[item++] = new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" );
- array[item++] = new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" );
- array[item++] = new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" );
- array[item++] = new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" );
- array[item++] = new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" );
+ new TestCase( SECTION, "12345678901234567", "12345678901234567", 12345678901234567+"" );
+ new TestCase( SECTION, "123456789012345678", "123456789012345678", 123456789012345678+"" );
+ new TestCase( SECTION, "1234567890123456789", "1234567890123456789", 1234567890123456789+"" );
+ new TestCase( SECTION, "12345678901234567890", "12345678901234567890", 12345678901234567890+"" );
+ new TestCase( SECTION, "123456789012345678900", "123456789012345678900", 123456789012345678900+"" );
+ new TestCase( SECTION, "1234567890123456789000", "1234567890123456789000", 1234567890123456789000+"" );
*/
- array[item++] = new TestCase( SECTION, "0x1", 1, 0x1 );
- array[item++] = new TestCase( SECTION, "0x10", 16, 0x10 );
- array[item++] = new TestCase( SECTION, "0x100", 256, 0x100 );
- array[item++] = new TestCase( SECTION, "0x1000", 4096, 0x1000 );
- array[item++] = new TestCase( SECTION, "0x10000", 65536, 0x10000 );
- array[item++] = new TestCase( SECTION, "0x100000", 1048576, 0x100000 );
- array[item++] = new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 );
- array[item++] = new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 );
+new TestCase( SECTION, "0x1", 1, 0x1 );
+new TestCase( SECTION, "0x10", 16, 0x10 );
+new TestCase( SECTION, "0x100", 256, 0x100 );
+new TestCase( SECTION, "0x1000", 4096, 0x1000 );
+new TestCase( SECTION, "0x10000", 65536, 0x10000 );
+new TestCase( SECTION, "0x100000", 1048576, 0x100000 );
+new TestCase( SECTION, "0x1000000", 16777216, 0x1000000 );
+new TestCase( SECTION, "0x10000000", 268435456, 0x10000000 );
/*
- array[item++] = new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 );
- array[item++] = new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 );
- array[item++] = new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 );
+ new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 );
+ new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 );
+ new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 );
*/
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.7.4.js b/mozilla/js/tests/ecma/LexicalConventions/7.7.4.js
index 375fe4b7cd1..7a5ca56b859 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.7.4.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.7.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,256 +36,231 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.7.4.js
- ECMA Section: 7.7.4 String Literals
+ File Name: 7.7.4.js
+ ECMA Section: 7.7.4 String Literals
- Description: A string literal is zero or more characters enclosed in
- single or double quotes. Each character may be
- represented by an escape sequence.
+ Description: A string literal is zero or more characters enclosed in
+ single or double quotes. Each character may be
+ represented by an escape sequence.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "7.7.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String Literals";
+var SECTION = "7.7.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String Literals";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// StringLiteral:: "" and ''
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "\"\"", "", "" );
+new TestCase( SECTION, "\'\'", "", '' );
- // StringLiteral:: "" and ''
+// DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence
+new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" );
+new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" );
+new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" );
+new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" );
+new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" );
+new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" );
+new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" );
+new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" );
+new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" );
- array[item++] = new TestCase( SECTION, "\"\"", "", "" );
- array[item++] = new TestCase( SECTION, "\'\'", "", '' );
+// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence
- // DoubleStringCharacters:: DoubleStringCharacter :: EscapeSequence :: CharacterEscapeSequence
- array[item++] = new TestCase( SECTION, "\\\"", String.fromCharCode(0x0022), "\"" );
- array[item++] = new TestCase( SECTION, "\\\'", String.fromCharCode(0x0027), "\'" );
- array[item++] = new TestCase( SECTION, "\\", String.fromCharCode(0x005C), "\\" );
- array[item++] = new TestCase( SECTION, "\\b", String.fromCharCode(0x0008), "\b" );
- array[item++] = new TestCase( SECTION, "\\f", String.fromCharCode(0x000C), "\f" );
- array[item++] = new TestCase( SECTION, "\\n", String.fromCharCode(0x000A), "\n" );
- array[item++] = new TestCase( SECTION, "\\r", String.fromCharCode(0x000D), "\r" );
- array[item++] = new TestCase( SECTION, "\\t", String.fromCharCode(0x0009), "\t" );
- array[item++] = new TestCase( SECTION, "\\v", String.fromCharCode(0x000B), "\v" );
+new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" );
+new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" );
+new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" );
+new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" );
+new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" );
+new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" );
+new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" );
+new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" );
- // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence
+new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" );
+new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" );
+new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" );
+new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" );
+new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" );
+new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" );
+new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" );
+new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" );
+new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" );
+new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" );
- array[item++] = new TestCase( SECTION, "\\00", String.fromCharCode(0x0000), "\00" );
- array[item++] = new TestCase( SECTION, "\\01", String.fromCharCode(0x0001), "\01" );
- array[item++] = new TestCase( SECTION, "\\02", String.fromCharCode(0x0002), "\02" );
- array[item++] = new TestCase( SECTION, "\\03", String.fromCharCode(0x0003), "\03" );
- array[item++] = new TestCase( SECTION, "\\04", String.fromCharCode(0x0004), "\04" );
- array[item++] = new TestCase( SECTION, "\\05", String.fromCharCode(0x0005), "\05" );
- array[item++] = new TestCase( SECTION, "\\06", String.fromCharCode(0x0006), "\06" );
- array[item++] = new TestCase( SECTION, "\\07", String.fromCharCode(0x0007), "\07" );
+new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" );
+new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" );
+new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" );
+new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" );
+new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" );
+new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" );
+new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" );
+new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" );
- array[item++] = new TestCase( SECTION, "\\010", String.fromCharCode(0x0008), "\010" );
- array[item++] = new TestCase( SECTION, "\\011", String.fromCharCode(0x0009), "\011" );
- array[item++] = new TestCase( SECTION, "\\012", String.fromCharCode(0x000A), "\012" );
- array[item++] = new TestCase( SECTION, "\\013", String.fromCharCode(0x000B), "\013" );
- array[item++] = new TestCase( SECTION, "\\014", String.fromCharCode(0x000C), "\014" );
- array[item++] = new TestCase( SECTION, "\\015", String.fromCharCode(0x000D), "\015" );
- array[item++] = new TestCase( SECTION, "\\016", String.fromCharCode(0x000E), "\016" );
- array[item++] = new TestCase( SECTION, "\\017", String.fromCharCode(0x000F), "\017" );
- array[item++] = new TestCase( SECTION, "\\020", String.fromCharCode(0x0010), "\020" );
- array[item++] = new TestCase( SECTION, "\\042", String.fromCharCode(0x0022), "\042" );
+new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" );
+new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" );
+new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" );
+new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" );
+new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" );
+new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" );
+new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" );
+new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" );
+new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" );
+new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" );
- array[item++] = new TestCase( SECTION, "\\0", String.fromCharCode(0x0000), "\0" );
- array[item++] = new TestCase( SECTION, "\\1", String.fromCharCode(0x0001), "\1" );
- array[item++] = new TestCase( SECTION, "\\2", String.fromCharCode(0x0002), "\2" );
- array[item++] = new TestCase( SECTION, "\\3", String.fromCharCode(0x0003), "\3" );
- array[item++] = new TestCase( SECTION, "\\4", String.fromCharCode(0x0004), "\4" );
- array[item++] = new TestCase( SECTION, "\\5", String.fromCharCode(0x0005), "\5" );
- array[item++] = new TestCase( SECTION, "\\6", String.fromCharCode(0x0006), "\6" );
- array[item++] = new TestCase( SECTION, "\\7", String.fromCharCode(0x0007), "\7" );
-
- array[item++] = new TestCase( SECTION, "\\10", String.fromCharCode(0x0008), "\10" );
- array[item++] = new TestCase( SECTION, "\\11", String.fromCharCode(0x0009), "\11" );
- array[item++] = new TestCase( SECTION, "\\12", String.fromCharCode(0x000A), "\12" );
- array[item++] = new TestCase( SECTION, "\\13", String.fromCharCode(0x000B), "\13" );
- array[item++] = new TestCase( SECTION, "\\14", String.fromCharCode(0x000C), "\14" );
- array[item++] = new TestCase( SECTION, "\\15", String.fromCharCode(0x000D), "\15" );
- array[item++] = new TestCase( SECTION, "\\16", String.fromCharCode(0x000E), "\16" );
- array[item++] = new TestCase( SECTION, "\\17", String.fromCharCode(0x000F), "\17" );
- array[item++] = new TestCase( SECTION, "\\20", String.fromCharCode(0x0010), "\20" );
- array[item++] = new TestCase( SECTION, "\\42", String.fromCharCode(0x0022), "\42" );
-
- array[item++] = new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" );
- array[item++] = new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" );
- array[item++] = new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" );
- array[item++] = new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" );
+new TestCase( SECTION, "\\000", String.fromCharCode(0), "\000" );
+new TestCase( SECTION, "\\111", String.fromCharCode(73), "\111" );
+new TestCase( SECTION, "\\222", String.fromCharCode(146), "\222" );
+new TestCase( SECTION, "\\333", String.fromCharCode(219), "\333" );
// following line commented out as it causes a compile time error
-// array[item++] = new TestCase( SECTION, "\\444", "444", "\444" );
+// new TestCase( SECTION, "\\444", "444", "\444" );
- // DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence
+// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence
/*
- array[item++] = new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" );
- array[item++] = new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" );
- array[item++] = new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" );
- array[item++] = new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" );
- array[item++] = new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" );
- array[item++] = new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" );
- array[item++] = new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" );
- array[item++] = new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" );
- array[item++] = new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" );
- array[item++] = new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" );
- array[item++] = new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" );
- array[item++] = new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" );
- array[item++] = new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" );
- array[item++] = new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" );
- array[item++] = new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" );
- array[item++] = new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" );
+ new TestCase( SECTION, "\\x0", String.fromCharCode(0), "\x0" );
+ new TestCase( SECTION, "\\x1", String.fromCharCode(1), "\x1" );
+ new TestCase( SECTION, "\\x2", String.fromCharCode(2), "\x2" );
+ new TestCase( SECTION, "\\x3", String.fromCharCode(3), "\x3" );
+ new TestCase( SECTION, "\\x4", String.fromCharCode(4), "\x4" );
+ new TestCase( SECTION, "\\x5", String.fromCharCode(5), "\x5" );
+ new TestCase( SECTION, "\\x6", String.fromCharCode(6), "\x6" );
+ new TestCase( SECTION, "\\x7", String.fromCharCode(7), "\x7" );
+ new TestCase( SECTION, "\\x8", String.fromCharCode(8), "\x8" );
+ new TestCase( SECTION, "\\x9", String.fromCharCode(9), "\x9" );
+ new TestCase( SECTION, "\\xA", String.fromCharCode(10), "\xA" );
+ new TestCase( SECTION, "\\xB", String.fromCharCode(11), "\xB" );
+ new TestCase( SECTION, "\\xC", String.fromCharCode(12), "\xC" );
+ new TestCase( SECTION, "\\xD", String.fromCharCode(13), "\xD" );
+ new TestCase( SECTION, "\\xE", String.fromCharCode(14), "\xE" );
+ new TestCase( SECTION, "\\xF", String.fromCharCode(15), "\xF" );
*/
- array[item++] = new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" );
- array[item++] = new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" );
- array[item++] = new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" );
- array[item++] = new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" );
- array[item++] = new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" );
- array[item++] = new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" );
- array[item++] = new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" );
- array[item++] = new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" );
- array[item++] = new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" );
- array[item++] = new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" );
- array[item++] = new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" );
- array[item++] = new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" );
- array[item++] = new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" );
- array[item++] = new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" );
- array[item++] = new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" );
- array[item++] = new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" );
+new TestCase( SECTION, "\\xF0", String.fromCharCode(240), "\xF0" );
+new TestCase( SECTION, "\\xE1", String.fromCharCode(225), "\xE1" );
+new TestCase( SECTION, "\\xD2", String.fromCharCode(210), "\xD2" );
+new TestCase( SECTION, "\\xC3", String.fromCharCode(195), "\xC3" );
+new TestCase( SECTION, "\\xB4", String.fromCharCode(180), "\xB4" );
+new TestCase( SECTION, "\\xA5", String.fromCharCode(165), "\xA5" );
+new TestCase( SECTION, "\\x96", String.fromCharCode(150), "\x96" );
+new TestCase( SECTION, "\\x87", String.fromCharCode(135), "\x87" );
+new TestCase( SECTION, "\\x78", String.fromCharCode(120), "\x78" );
+new TestCase( SECTION, "\\x69", String.fromCharCode(105), "\x69" );
+new TestCase( SECTION, "\\x5A", String.fromCharCode(90), "\x5A" );
+new TestCase( SECTION, "\\x4B", String.fromCharCode(75), "\x4B" );
+new TestCase( SECTION, "\\x3C", String.fromCharCode(60), "\x3C" );
+new TestCase( SECTION, "\\x2D", String.fromCharCode(45), "\x2D" );
+new TestCase( SECTION, "\\x1E", String.fromCharCode(30), "\x1E" );
+new TestCase( SECTION, "\\x0F", String.fromCharCode(15), "\x0F" );
- // string literals only take up to two hext digits. therefore, the third character in this string
- // should be interpreted as a StringCharacter and not part of the HextEscapeSequence
+// string literals only take up to two hext digits. therefore, the third character in this string
+// should be interpreted as a StringCharacter and not part of the HextEscapeSequence
- array[item++] = new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" );
- array[item++] = new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" );
- array[item++] = new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" );
- array[item++] = new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" );
- array[item++] = new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" );
- array[item++] = new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" );
- array[item++] = new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" );
- array[item++] = new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" );
- array[item++] = new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" );
- array[item++] = new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" );
- array[item++] = new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" );
- array[item++] = new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" );
- array[item++] = new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" );
- array[item++] = new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" );
- array[item++] = new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" );
- array[item++] = new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" );
+new TestCase( SECTION, "\\xF0F", String.fromCharCode(240)+"F", "\xF0F" );
+new TestCase( SECTION, "\\xE1E", String.fromCharCode(225)+"E", "\xE1E" );
+new TestCase( SECTION, "\\xD2D", String.fromCharCode(210)+"D", "\xD2D" );
+new TestCase( SECTION, "\\xC3C", String.fromCharCode(195)+"C", "\xC3C" );
+new TestCase( SECTION, "\\xB4B", String.fromCharCode(180)+"B", "\xB4B" );
+new TestCase( SECTION, "\\xA5A", String.fromCharCode(165)+"A", "\xA5A" );
+new TestCase( SECTION, "\\x969", String.fromCharCode(150)+"9", "\x969" );
+new TestCase( SECTION, "\\x878", String.fromCharCode(135)+"8", "\x878" );
+new TestCase( SECTION, "\\x787", String.fromCharCode(120)+"7", "\x787" );
+new TestCase( SECTION, "\\x696", String.fromCharCode(105)+"6", "\x696" );
+new TestCase( SECTION, "\\x5A5", String.fromCharCode(90)+"5", "\x5A5" );
+new TestCase( SECTION, "\\x4B4", String.fromCharCode(75)+"4", "\x4B4" );
+new TestCase( SECTION, "\\x3C3", String.fromCharCode(60)+"3", "\x3C3" );
+new TestCase( SECTION, "\\x2D2", String.fromCharCode(45)+"2", "\x2D2" );
+new TestCase( SECTION, "\\x1E1", String.fromCharCode(30)+"1", "\x1E1" );
+new TestCase( SECTION, "\\x0F0", String.fromCharCode(15)+"0", "\x0F0" );
- // G is out of hex range
+// G is out of hex range
- array[item++] = new TestCase( SECTION, "\\xG", "xG", "\xG" );
- array[item++] = new TestCase( SECTION, "\\xCG", "xCG", "\xCG" );
+new TestCase( SECTION, "\\xG", "xG", "\xG" );
+new TestCase( SECTION, "\\xCG", "xCG", "\xCG" );
- // DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter
- array[item++] = new TestCase( SECTION, "\\a", "a", "\a" );
- array[item++] = new TestCase( SECTION, "\\c", "c", "\c" );
- array[item++] = new TestCase( SECTION, "\\d", "d", "\d" );
- array[item++] = new TestCase( SECTION, "\\e", "e", "\e" );
- array[item++] = new TestCase( SECTION, "\\g", "g", "\g" );
- array[item++] = new TestCase( SECTION, "\\h", "h", "\h" );
- array[item++] = new TestCase( SECTION, "\\i", "i", "\i" );
- array[item++] = new TestCase( SECTION, "\\j", "j", "\j" );
- array[item++] = new TestCase( SECTION, "\\k", "k", "\k" );
- array[item++] = new TestCase( SECTION, "\\l", "l", "\l" );
- array[item++] = new TestCase( SECTION, "\\m", "m", "\m" );
- array[item++] = new TestCase( SECTION, "\\o", "o", "\o" );
- array[item++] = new TestCase( SECTION, "\\p", "p", "\p" );
- array[item++] = new TestCase( SECTION, "\\q", "q", "\q" );
- array[item++] = new TestCase( SECTION, "\\s", "s", "\s" );
- array[item++] = new TestCase( SECTION, "\\u", "u", "\u" );
+// DoubleStringCharacter::EscapeSequence::CharacterEscapeSequence::\ NonEscapeCharacter
+new TestCase( SECTION, "\\a", "a", "\a" );
+new TestCase( SECTION, "\\c", "c", "\c" );
+new TestCase( SECTION, "\\d", "d", "\d" );
+new TestCase( SECTION, "\\e", "e", "\e" );
+new TestCase( SECTION, "\\g", "g", "\g" );
+new TestCase( SECTION, "\\h", "h", "\h" );
+new TestCase( SECTION, "\\i", "i", "\i" );
+new TestCase( SECTION, "\\j", "j", "\j" );
+new TestCase( SECTION, "\\k", "k", "\k" );
+new TestCase( SECTION, "\\l", "l", "\l" );
+new TestCase( SECTION, "\\m", "m", "\m" );
+new TestCase( SECTION, "\\o", "o", "\o" );
+new TestCase( SECTION, "\\p", "p", "\p" );
+new TestCase( SECTION, "\\q", "q", "\q" );
+new TestCase( SECTION, "\\s", "s", "\s" );
+new TestCase( SECTION, "\\u", "u", "\u" );
- array[item++] = new TestCase( SECTION, "\\w", "w", "\w" );
- array[item++] = new TestCase( SECTION, "\\x", "x", "\x" );
- array[item++] = new TestCase( SECTION, "\\y", "y", "\y" );
- array[item++] = new TestCase( SECTION, "\\z", "z", "\z" );
- array[item++] = new TestCase( SECTION, "\\9", "9", "\9" );
+new TestCase( SECTION, "\\w", "w", "\w" );
+new TestCase( SECTION, "\\x", "x", "\x" );
+new TestCase( SECTION, "\\y", "y", "\y" );
+new TestCase( SECTION, "\\z", "z", "\z" );
+new TestCase( SECTION, "\\9", "9", "\9" );
- array[item++] = new TestCase( SECTION, "\\A", "A", "\A" );
- array[item++] = new TestCase( SECTION, "\\B", "B", "\B" );
- array[item++] = new TestCase( SECTION, "\\C", "C", "\C" );
- array[item++] = new TestCase( SECTION, "\\D", "D", "\D" );
- array[item++] = new TestCase( SECTION, "\\E", "E", "\E" );
- array[item++] = new TestCase( SECTION, "\\F", "F", "\F" );
- array[item++] = new TestCase( SECTION, "\\G", "G", "\G" );
- array[item++] = new TestCase( SECTION, "\\H", "H", "\H" );
- array[item++] = new TestCase( SECTION, "\\I", "I", "\I" );
- array[item++] = new TestCase( SECTION, "\\J", "J", "\J" );
- array[item++] = new TestCase( SECTION, "\\K", "K", "\K" );
- array[item++] = new TestCase( SECTION, "\\L", "L", "\L" );
- array[item++] = new TestCase( SECTION, "\\M", "M", "\M" );
- array[item++] = new TestCase( SECTION, "\\N", "N", "\N" );
- array[item++] = new TestCase( SECTION, "\\O", "O", "\O" );
- array[item++] = new TestCase( SECTION, "\\P", "P", "\P" );
- array[item++] = new TestCase( SECTION, "\\Q", "Q", "\Q" );
- array[item++] = new TestCase( SECTION, "\\R", "R", "\R" );
- array[item++] = new TestCase( SECTION, "\\S", "S", "\S" );
- array[item++] = new TestCase( SECTION, "\\T", "T", "\T" );
- array[item++] = new TestCase( SECTION, "\\U", "U", "\U" );
- array[item++] = new TestCase( SECTION, "\\V", "V", "\V" );
- array[item++] = new TestCase( SECTION, "\\W", "W", "\W" );
- array[item++] = new TestCase( SECTION, "\\X", "X", "\X" );
- array[item++] = new TestCase( SECTION, "\\Y", "Y", "\Y" );
- array[item++] = new TestCase( SECTION, "\\Z", "Z", "\Z" );
+new TestCase( SECTION, "\\A", "A", "\A" );
+new TestCase( SECTION, "\\B", "B", "\B" );
+new TestCase( SECTION, "\\C", "C", "\C" );
+new TestCase( SECTION, "\\D", "D", "\D" );
+new TestCase( SECTION, "\\E", "E", "\E" );
+new TestCase( SECTION, "\\F", "F", "\F" );
+new TestCase( SECTION, "\\G", "G", "\G" );
+new TestCase( SECTION, "\\H", "H", "\H" );
+new TestCase( SECTION, "\\I", "I", "\I" );
+new TestCase( SECTION, "\\J", "J", "\J" );
+new TestCase( SECTION, "\\K", "K", "\K" );
+new TestCase( SECTION, "\\L", "L", "\L" );
+new TestCase( SECTION, "\\M", "M", "\M" );
+new TestCase( SECTION, "\\N", "N", "\N" );
+new TestCase( SECTION, "\\O", "O", "\O" );
+new TestCase( SECTION, "\\P", "P", "\P" );
+new TestCase( SECTION, "\\Q", "Q", "\Q" );
+new TestCase( SECTION, "\\R", "R", "\R" );
+new TestCase( SECTION, "\\S", "S", "\S" );
+new TestCase( SECTION, "\\T", "T", "\T" );
+new TestCase( SECTION, "\\U", "U", "\U" );
+new TestCase( SECTION, "\\V", "V", "\V" );
+new TestCase( SECTION, "\\W", "W", "\W" );
+new TestCase( SECTION, "\\X", "X", "\X" );
+new TestCase( SECTION, "\\Y", "Y", "\Y" );
+new TestCase( SECTION, "\\Z", "Z", "\Z" );
- // DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence
+// DoubleStringCharacter::EscapeSequence::UnicodeEscapeSequence
- array[item++] = new TestCase( SECTION, "\\u0020", " ", "\u0020" );
- array[item++] = new TestCase( SECTION, "\\u0021", "!", "\u0021" );
- array[item++] = new TestCase( SECTION, "\\u0022", "\"", "\u0022" );
- array[item++] = new TestCase( SECTION, "\\u0023", "#", "\u0023" );
- array[item++] = new TestCase( SECTION, "\\u0024", "$", "\u0024" );
- array[item++] = new TestCase( SECTION, "\\u0025", "%", "\u0025" );
- array[item++] = new TestCase( SECTION, "\\u0026", "&", "\u0026" );
- array[item++] = new TestCase( SECTION, "\\u0027", "'", "\u0027" );
- array[item++] = new TestCase( SECTION, "\\u0028", "(", "\u0028" );
- array[item++] = new TestCase( SECTION, "\\u0029", ")", "\u0029" );
- array[item++] = new TestCase( SECTION, "\\u002A", "*", "\u002A" );
- array[item++] = new TestCase( SECTION, "\\u002B", "+", "\u002B" );
- array[item++] = new TestCase( SECTION, "\\u002C", ",", "\u002C" );
- array[item++] = new TestCase( SECTION, "\\u002D", "-", "\u002D" );
- array[item++] = new TestCase( SECTION, "\\u002E", ".", "\u002E" );
- array[item++] = new TestCase( SECTION, "\\u002F", "/", "\u002F" );
- array[item++] = new TestCase( SECTION, "\\u0030", "0", "\u0030" );
- array[item++] = new TestCase( SECTION, "\\u0031", "1", "\u0031" );
- array[item++] = new TestCase( SECTION, "\\u0032", "2", "\u0032" );
- array[item++] = new TestCase( SECTION, "\\u0033", "3", "\u0033" );
- array[item++] = new TestCase( SECTION, "\\u0034", "4", "\u0034" );
- array[item++] = new TestCase( SECTION, "\\u0035", "5", "\u0035" );
- array[item++] = new TestCase( SECTION, "\\u0036", "6", "\u0036" );
- array[item++] = new TestCase( SECTION, "\\u0037", "7", "\u0037" );
- array[item++] = new TestCase( SECTION, "\\u0038", "8", "\u0038" );
- array[item++] = new TestCase( SECTION, "\\u0039", "9", "\u0039" );
+new TestCase( SECTION, "\\u0020", " ", "\u0020" );
+new TestCase( SECTION, "\\u0021", "!", "\u0021" );
+new TestCase( SECTION, "\\u0022", "\"", "\u0022" );
+new TestCase( SECTION, "\\u0023", "#", "\u0023" );
+new TestCase( SECTION, "\\u0024", "$", "\u0024" );
+new TestCase( SECTION, "\\u0025", "%", "\u0025" );
+new TestCase( SECTION, "\\u0026", "&", "\u0026" );
+new TestCase( SECTION, "\\u0027", "'", "\u0027" );
+new TestCase( SECTION, "\\u0028", "(", "\u0028" );
+new TestCase( SECTION, "\\u0029", ")", "\u0029" );
+new TestCase( SECTION, "\\u002A", "*", "\u002A" );
+new TestCase( SECTION, "\\u002B", "+", "\u002B" );
+new TestCase( SECTION, "\\u002C", ",", "\u002C" );
+new TestCase( SECTION, "\\u002D", "-", "\u002D" );
+new TestCase( SECTION, "\\u002E", ".", "\u002E" );
+new TestCase( SECTION, "\\u002F", "/", "\u002F" );
+new TestCase( SECTION, "\\u0030", "0", "\u0030" );
+new TestCase( SECTION, "\\u0031", "1", "\u0031" );
+new TestCase( SECTION, "\\u0032", "2", "\u0032" );
+new TestCase( SECTION, "\\u0033", "3", "\u0033" );
+new TestCase( SECTION, "\\u0034", "4", "\u0034" );
+new TestCase( SECTION, "\\u0035", "5", "\u0035" );
+new TestCase( SECTION, "\\u0036", "6", "\u0036" );
+new TestCase( SECTION, "\\u0037", "7", "\u0037" );
+new TestCase( SECTION, "\\u0038", "8", "\u0038" );
+new TestCase( SECTION, "\\u0039", "9", "\u0039" );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = testcases[tc].actual;
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/7.8.2-n.js b/mozilla/js/tests/ecma/LexicalConventions/7.8.2-n.js
index a7ef5757ea1..b2239b0f68f 100644
--- a/mozilla/js/tests/ecma/LexicalConventions/7.8.2-n.js
+++ b/mozilla/js/tests/ecma/LexicalConventions/7.8.2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,29 +36,25 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 7.8.2.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: 7.8.2.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION="7.8.2";
- var VERSION="ECMA_1"
- startTest();
- writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion");
+var SECTION="7.8.2";
+var VERSION="ECMA_1"
+startTest();
+writeHeaderToLog(SECTION+" "+"Examples of Semicolon Insertion");
- testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, eval("{ 1 \n 2 } 3") );
-// array[item++] = new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, "{ 1 \n 2 } 3" );
- array[item++] = new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") );
+DESCRIPTION = "{ 1 2 } 3";
+EXPECTED = "error";
- return ( array );
-}
+new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") );
+test();
diff --git a/mozilla/js/tests/ecma/LexicalConventions/browser.js b/mozilla/js/tests/ecma/LexicalConventions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/LexicalConventions/shell.js b/mozilla/js/tests/ecma/LexicalConventions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Math/15.8-1.js b/mozilla/js/tests/ecma/Math/15.8-1.js
index 8e132c8c5ed..646fc548494 100644
--- a/mozilla/js/tests/ecma/Math/15.8-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,66 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8-1.js
- ECMA Section: 15.8 The Math Object
-
- Description:
-
- The Math object is merely a single object that has some named properties,
- some of which are functions.
-
- The value of the internal [[Prototype]] property of the Math object is the
- Object prototype object (15.2.3.1).
-
- The Math object does not have a [[Construct]] property; it is not possible
- to use the Math object as a constructor with the new operator.
-
- The Math object does not have a [[Call]] property; it is not possible to
- invoke the Math object as a function.
-
- Recall that, in this specification, the phrase "the number value for x" has
- a technical meaning defined in section 8.5.
-
- Author: christine@netscape.com
- Date: 12 november 1997
-
-*/
-
- var SECTION = "15.8-1";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "The Math Object";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "Math.__proto__ == Object.prototype",
- true,
- Math.__proto__ == Object.prototype );
-
- array[item++] = new TestCase( SECTION,
- "Math.__proto__",
- Object.prototype,
- Math.__proto__ );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8-1.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+var SECTION = "15.8-1";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "The Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.__proto__ == Object.prototype",
+ true,
+ Math.__proto__ == Object.prototype );
+
+new TestCase( SECTION,
+ "Math.__proto__",
+ Object.prototype,
+ Math.__proto__ );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8-2-n.js b/mozilla/js/tests/ecma/Math/15.8-2-n.js
index b0af8149fec..2aec243ecb6 100644
--- a/mozilla/js/tests/ecma/Math/15.8-2-n.js
+++ b/mozilla/js/tests/ecma/Math/15.8-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,45 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8-2.js
- ECMA Section: 15.8 The Math Object
-
- Description:
-
- The Math object is merely a single object that has some named properties,
- some of which are functions.
-
- The value of the internal [[Prototype]] property of the Math object is the
- Object prototype object (15.2.3.1).
-
- The Math object does not have a [[Construct]] property; it is not possible
- to use the Math object as a constructor with the new operator.
-
- The Math object does not have a [[Call]] property; it is not possible to
- invoke the Math object as a function.
-
- Recall that, in this specification, the phrase "the number value for x" has
- a technical meaning defined in section 8.5.
-
- Author: christine@netscape.com
- Date: 12 november 1997
-
-*/
-
- var SECTION = "15.8-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Math Object";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "MYMATH = new Math()",
- "error",
- "MYMATH = new Math()" );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "Math does not have the [Construct] property";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8-2.js
+ ECMA Section: 15.8 The Math Object
+
+ Description:
+
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
+
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
+
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
+
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
+
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+
+*/
+
+var SECTION = "15.8-2-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Math Object";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "MYMATH = new Math()";
+EXPECTED = "error";
+
+new TestCase( SECTION,
+ "MYMATH = new Math()",
+ "error",
+ eval("MYMATH = new Math()") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8-3-n.js b/mozilla/js/tests/ecma/Math/15.8-3-n.js
index a532bc26088..8efdcae6f43 100644
--- a/mozilla/js/tests/ecma/Math/15.8-3-n.js
+++ b/mozilla/js/tests/ecma/Math/15.8-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,45 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8-3.js
- ECMA Section: 15.8 The Math Object
+ File Name: 15.8-3.js
+ ECMA Section: 15.8 The Math Object
- Description:
+ Description:
- The Math object is merely a single object that has some named properties,
- some of which are functions.
+ The Math object is merely a single object that has some named properties,
+ some of which are functions.
- The value of the internal [[Prototype]] property of the Math object is the
- Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Math object is the
+ Object prototype object (15.2.3.1).
- The Math object does not have a [[Construct]] property; it is not possible
- to use the Math object as a constructor with the new operator.
+ The Math object does not have a [[Construct]] property; it is not possible
+ to use the Math object as a constructor with the new operator.
- The Math object does not have a [[Call]] property; it is not possible to
- invoke the Math object as a function.
+ The Math object does not have a [[Call]] property; it is not possible to
+ invoke the Math object as a function.
- Recall that, in this specification, the phrase "the number value for x" has
- a technical meaning defined in section 8.5.
+ Recall that, in this specification, the phrase "the number value for x" has
+ a technical meaning defined in section 8.5.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.8-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Math Object";
+var SECTION = "15.8-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Math Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "MYMATH = Math()";
+EXPECTED = "error";
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "MYMATH = Math()",
- "error",
- "MYMATH = Math()" );
+new TestCase( SECTION,
+ "MYMATH = Math()",
+ "error",
+ eval("MYMATH = Math()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "Math does not have the [Call] property";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.1-1.js b/mozilla/js/tests/ecma/Math/15.8.1.1-1.js
index 1df7a75cead..b59d5da183a 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.1-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,44 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.1-1.js
- ECMA Section: 15.8.1.1.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.E
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
- var SECTION = "15.8.1.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.E";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.E = 0; Math.E", 2.7182818284590452354, ("Math.E=0;Math.E") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "Math.E should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.1-1.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.E = 0; Math.E",
+ 2.7182818284590452354,
+ eval("Math.E=0;Math.E") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.1-2.js b/mozilla/js/tests/ecma/Math/15.8.1.1-2.js
index 7714bed39a1..c0ea39e5889 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.1-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.1-2.js
- ECMA Section: 15.8.1.1.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.8.1.1-2.js
+ ECMA Section: 15.8.1.1.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Math.E
+ this test checks the DontDelete attribute of Math.E
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.8.1.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.E";
+var SECTION = "15.8.1.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.E";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var MATH_E = 2.7182818284590452354
+new TestCase( SECTION,
+ "delete(Math.E)",
+ false,
+ eval("delete Math.E") );
+new TestCase( SECTION,
+ "delete(Math.E); Math.E",
+ MATH_E,
+ eval("delete Math.E; Math.E") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var MATH_E = 2.7182818284590452354
- array[item++] = new TestCase( SECTION, "delete(Math.E)", false, "delete Math.E" );
- array[item++] = new TestCase( SECTION, "delete(Math.E); Math.E", MATH_E, "delete Math.E; Math.E" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "should not be able to delete property";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.2-1.js b/mozilla/js/tests/ecma/Math/15.8.1.2-1.js
index 4469312b74c..5b882c2aaaf 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.2-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,44 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.2-1.js
- ECMA Section: 15.8.2.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.LN10
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
- var SECTION = "15.8.1.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LN10";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.LN10=0; Math.LN10", 2.302585092994046, "Math.LN10=0; Math.LN10" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN10
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN10";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LN10=0; Math.LN10",
+ 2.302585092994046,
+ eval("Math.LN10=0; Math.LN10") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.2-2.js b/mozilla/js/tests/ecma/Math/15.8.1.2-2.js
index ff2e5be6986..5ce67a21e3c 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.2-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.2-1.js
- ECMA Section: 15.8.2.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.8.1.2-1.js
+ ECMA Section: 15.8.2.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Math.LN10
+ this test checks the DontDelete attribute of Math.LN10
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.8.1.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LN10";
+var SECTION = "15.8.1.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN10";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); Math.LN10", 2.302585092994046, "delete(Math.LN10); Math.LN10" );
- array[item++] = new TestCase( SECTION, "delete( Math.LN10 ); ", false, "delete(Math.LN10)" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "delete( Math.LN10 ); Math.LN10",
+ 2.302585092994046,
+ eval("delete(Math.LN10); Math.LN10") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "delete( Math.LN10 ); ",
+ false,
+ eval("delete(Math.LN10)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.3-1.js b/mozilla/js/tests/ecma/Math/15.8.1.3-1.js
index 7cc718c323a..61f30736c59 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.3-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.3-1.js
- ECMA Section: 15.8.1.3.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.LN2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LN2";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.LN2=0; Math.LN2", 0.6931471805599453, ("Math.LN2=0; Math.LN2") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.3-1.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LN2=0; Math.LN2",
+ 0.6931471805599453,
+ eval("Math.LN2=0; Math.LN2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.3-2.js b/mozilla/js/tests/ecma/Math/15.8.1.3-2.js
index 23673a112b3..ac4154bb24d 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.3-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.3-3.js
- ECMA Section: 15.8.1.3.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the DontDelete attribute of Math.LN2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LN2";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var MATH_LN2 = 0.6931471805599453;
-
- array[item++] = new TestCase( SECTION, "delete(Math.LN2)", false, "delete(Math.LN2)" );
- array[item++] = new TestCase( SECTION, "delete(Math.LN2); Math.LN2", MATH_LN2, "delete(Math.LN2); Math.LN2" );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.3-3.js
+ ECMA Section: 15.8.1.3.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LN2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LN2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var MATH_LN2 = 0.6931471805599453;
+
+new TestCase( SECTION,
+ "delete(Math.LN2)",
+ false,
+ eval("delete(Math.LN2)") );
+
+new TestCase( SECTION,
+ "delete(Math.LN2); Math.LN2",
+ MATH_LN2,
+ eval("delete(Math.LN2); Math.LN2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.4-1.js b/mozilla/js/tests/ecma/Math/15.8.1.4-1.js
index de9a24d76f2..04286a27192 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.4-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 15.8.1.4-1.js
ECMA Section: 15.8.1.4.js
@@ -53,27 +55,9 @@
writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.L0G2E=0; Math.LOG2E", 1.4426950408889634, ("Math.LOG2E=0; Math.LOG2E") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.L0G2E=0; Math.LOG2E",
+ 1.4426950408889634,
+ eval("Math.LOG2E=0; Math.LOG2E") );
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.4-2.js b/mozilla/js/tests/ecma/Math/15.8.1.4-2.js
index ce23b02e328..001077fc1d1 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.4-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.4-2.js
- ECMA Section: 15.8.1.4.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the DontDelete attribute of Math.LOG2E
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.4-2";
- var VERSION = "ECMA_1";
+/**
+ File Name: 15.8.1.4-2.js
+ ECMA Section: 15.8.1.4.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.LOG2E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+ var SECTION = "15.8.1.4-2";
+ var VERSION = "ECMA_1";
startTest();
- var TITLE = "Math.LOG2E";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete(Math.L0G2E);Math.LOG2E", 1.4426950408889634, "delete(Math.LOG2E);Math.LOG2E" );
- array[item++] = new TestCase( SECTION, "delete(Math.L0G2E)", false, "delete(Math.LOG2E)" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
-
+ var TITLE = "Math.LOG2E";
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete(Math.L0G2E);Math.LOG2E",
+ 1.4426950408889634,
+ eval("delete(Math.LOG2E);Math.LOG2E") );
+new TestCase( SECTION,
+ "delete(Math.L0G2E)",
+ false,
+ eval("delete(Math.LOG2E)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.5-1.js b/mozilla/js/tests/ecma/Math/15.8.1.5-1.js
index 5d7379c3f4a..e138e81b031 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.5-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.5-1.js
- ECMA Section: 15.8.1.5.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.LOG10E
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
-
- var SECTION = "15.8.1.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LOG10E";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.LOG10E=0; Math.LOG10E", 0.4342944819032518, ("Math.LOG10E=0; Math.LOG10E") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
-
+/**
+ File Name: 15.8.1.5-1.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.LOG10E
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+
+var SECTION = "15.8.1.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG10E";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.LOG10E=0; Math.LOG10E",
+ 0.4342944819032518,
+ eval("Math.LOG10E=0; Math.LOG10E") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.5-2.js b/mozilla/js/tests/ecma/Math/15.8.1.5-2.js
index d36a386eda3..d719c033997 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.5-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.5-2.js
- ECMA Section: 15.8.1.5.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.8.1.5-2.js
+ ECMA Section: 15.8.1.5.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Math.LOG10E
+ this test checks the DontDelete attribute of Math.LOG10E
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.8.1.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.LOG10E";
+var SECTION = "15.8.1.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.LOG10E";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "delete Math.LOG10E; Math.LOG10E",
+ 0.4342944819032518,
+ eval("delete Math.LOG10E; Math.LOG10E") );
+new TestCase( SECTION,
+ "delete Math.LOG10E",
+ false,
+ eval("delete Math.LOG10E") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete Math.LOG10E; Math.LOG10E", 0.4342944819032518, "delete Math.LOG10E; Math.LOG10E" );
- array[item++] = new TestCase( SECTION, "delete Math.LOG10E", false, "delete Math.LOG10E" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
-
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.6-1.js b/mozilla/js/tests/ecma/Math/15.8.1.6-1.js
index 21b9690d3f9..1da0f911bc9 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.6-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.6-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.6-1.js
- ECMA Section: 15.8.1.6.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.PI
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.6-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.PI";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.PI=0; Math.PI", 3.1415926535897923846, "Math.PI=0; Math.PI" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.6-1.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.PI
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.PI";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.PI=0; Math.PI",
+ 3.1415926535897923846,
+ eval("Math.PI=0; Math.PI") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.6-2.js b/mozilla/js/tests/ecma/Math/15.8.1.6-2.js
index 36066de6045..9eb9a5eb1d8 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.6-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.6-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.6-2.js
- ECMA Section: 15.8.1.6.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.8.1.6-2.js
+ ECMA Section: 15.8.1.6.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Math.PI
+ this test checks the DontDelete attribute of Math.PI
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.8.1.6-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.PI";
+var SECTION = "15.8.1.6-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.PI";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "delete Math.PI; Math.PI",
+ 3.1415926535897923846,
+ eval("delete Math.PI; Math.PI") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", 3.1415926535897923846, "delete Math.PI; Math.PI" );
- array[item++] = new TestCase( SECTION, "delete Math.PI; Math.PI", false, "delete Math.PI" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "delete Math.PI; Math.PI",
+ false,
+ eval("delete Math.PI") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.7-1.js b/mozilla/js/tests/ecma/Math/15.8.1.7-1.js
index da42bfa1379..0fb244969dc 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.7-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.7-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.7-1.js
- ECMA Section: 15.8.1.7.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the ReadOnly attribute of Math.SQRT1_2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.7-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.SQRT1_2";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.SQRT1_2=0; Math.SQRT1_2", 0.7071067811865476, "Math.SQRT1_2=0; Math.SQRT1_2" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
-
+/**
+ File Name: 15.8.1.7-1.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the ReadOnly attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.7-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT1_2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.SQRT1_2=0; Math.SQRT1_2",
+ 0.7071067811865476,
+ eval("Math.SQRT1_2=0; Math.SQRT1_2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.7-2.js b/mozilla/js/tests/ecma/Math/15.8.1.7-2.js
index b376065a2f9..1645afe6442 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.7-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.7-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.7-2.js
- ECMA Section: 15.8.1.7.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the DontDelete attribute of Math.SQRT1_2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.1.7-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.SQRT1_2";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2; Math.SQRT1_2", 0.7071067811865476, "delete Math.SQRT1_2; Math.SQRT1_2" );
- array[item++] = new TestCase( SECTION, "delete Math.SQRT1_2", false, "delete Math.SQRT1_2" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.7-2.js
+ ECMA Section: 15.8.1.7.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT1_2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.1.7-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT1_2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.SQRT1_2; Math.SQRT1_2",
+ 0.7071067811865476,
+ eval("delete Math.SQRT1_2; Math.SQRT1_2") );
+
+new TestCase( SECTION,
+ "delete Math.SQRT1_2",
+ false,
+ eval("delete Math.SQRT1_2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.8-1.js b/mozilla/js/tests/ecma/Math/15.8.1.8-1.js
index 13f75b75f17..e741b06f5e1 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.8-1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.8-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.8-1.js
- ECMA Section: 15.8.1.8.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.8.1.8-1.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Math.SQRT2
+ this test checks the ReadOnly attribute of Math.SQRT2
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.8.1.8-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.SQRT2";
+var SECTION = "15.8.1.8-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT2";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Math.SQRT2=0; Math.SQRT2", 1.4142135623730951, ("Math.SQRT2=0; Math.SQRT2") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.SQRT2=0; Math.SQRT2",
+ 1.4142135623730951,
+ eval("Math.SQRT2=0; Math.SQRT2") );
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.8-2.js b/mozilla/js/tests/ecma/Math/15.8.1.8-2.js
index 92d2618da1b..96d56ac69c7 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.8-2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.8-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.8-2.js
- ECMA Section: 15.8.1.8.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the DontDelete attribute of Math.SQRT2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
- var SECTION = "15.8.1.8-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.SQRT2";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete Math.SQRT2; Math.SQRT2", 1.4142135623730951, "delete Math.SQRT2; Math.SQRT2" );
- array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, "delete Math.SQRT2" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.1.8-2.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.SQRT2";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "delete Math.SQRT2; Math.SQRT2",
+ 1.4142135623730951,
+ eval("delete Math.SQRT2; Math.SQRT2") );
+
+new TestCase( SECTION,
+ "delete Math.SQRT2",
+ false,
+ eval("delete Math.SQRT2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.8-3.js b/mozilla/js/tests/ecma/Math/15.8.1.8-3.js
index 1765c9dcc97..0ccf2390cda 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.8-3.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.8-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,43 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.1.8-3.js
- ECMA Section: 15.8.1.8.js
- Description: All value properties of the Math object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
-
- this test checks the DontDelete attribute of Math.SQRT2
-
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
- var SECTION = "15.8.1.8-3";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
-
- writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete");
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete Math.SQRT2", false, ("delete Math.SQRT2") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "property should be read-only ";
- }
- stopTest();
- return ( testcases );
-}
-
+/**
+ File Name: 15.8.1.8-3.js
+ ECMA Section: 15.8.1.8.js
+ Description: All value properties of the Math object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
+
+ this test checks the DontDelete attribute of Math.SQRT2
+
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+var SECTION = "15.8.1.8-3";
+var VERSION = "ECMA_1";
+startTest();
+
+writeHeaderToLog( SECTION + " Math.SQRT2: DontDelete");
+
+new TestCase( SECTION,
+ "delete Math.SQRT2",
+ false,
+ eval("delete Math.SQRT2") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.1.js b/mozilla/js/tests/ecma/Math/15.8.1.js
index 064cc2e23f6..4947eefd0ec 100644
--- a/mozilla/js/tests/ecma/Math/15.8.1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,113 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.1.js
- ECMA Section: 15.8.1.js Value Properties of the Math Object
- 15.8.1.1 E
- 15.8.1.2 LN10
- 15.8.1.3 LN2
- 15.8.1.4 LOG2E
- 15.8.1.5 LOG10E
- 15.8.1.6 PI
- 15.8.1.7 SQRT1_2
- 15.8.1.8 SQRT2
- Description: verify the values of some math constants
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.1.js
+ ECMA Section: 15.8.1.js Value Properties of the Math Object
+ 15.8.1.1 E
+ 15.8.1.2 LN10
+ 15.8.1.3 LN2
+ 15.8.1.4 LOG2E
+ 15.8.1.5 LOG10E
+ 15.8.1.6 PI
+ 15.8.1.7 SQRT1_2
+ 15.8.1.8 SQRT2
+ Description: verify the values of some math constants
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.1"
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Value Properties of the Math Object";
+var SECTION = "15.8.1"
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Value Properties of the Math Object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( "15.8.1.1", "Math.E",
+ 2.7182818284590452354,
+ Math.E );
- array[item++] = new TestCase( "15.8.1.1", "Math.E", 2.7182818284590452354, Math.E );
- array[item++] = new TestCase( "15.8.1.1", "typeof Math.E", "number", typeof Math.E );
- array[item++] = new TestCase( "15.8.1.2", "Math.LN10", 2.302585092994046, Math.LN10 );
- array[item++] = new TestCase( "15.8.1.2", "typeof Math.LN10", "number", typeof Math.LN10 );
- array[item++] = new TestCase( "15.8.1.3", "Math.LN2", 0.6931471805599453, Math.LN2 );
- array[item++] = new TestCase( "15.8.1.3", "typeof Math.LN2", "number", typeof Math.LN2 );
- array[item++] = new TestCase( "15.8.1.4", "Math.LOG2E", 1.4426950408889634, Math.LOG2E );
- array[item++] = new TestCase( "15.8.1.4", "typeof Math.LOG2E", "number", typeof Math.LOG2E );
- array[item++] = new TestCase( "15.8.1.5", "Math.LOG10E", 0.4342944819032518, Math.LOG10E);
- array[item++] = new TestCase( "15.8.1.5", "typeof Math.LOG10E", "number", typeof Math.LOG10E);
- array[item++] = new TestCase( "15.8.1.6", "Math.PI", 3.14159265358979323846, Math.PI );
- array[item++] = new TestCase( "15.8.1.6", "typeof Math.PI", "number", typeof Math.PI );
- array[item++] = new TestCase( "15.8.1.7", "Math.SQRT1_2", 0.7071067811865476, Math.SQRT1_2);
- array[item++] = new TestCase( "15.8.1.7", "typeof Math.SQRT1_2", "number", typeof Math.SQRT1_2);
- array[item++] = new TestCase( "15.8.1.8", "Math.SQRT2", 1.4142135623730951, Math.SQRT2 );
- array[item++] = new TestCase( "15.8.1.8", "typeof Math.SQRT2", "number", typeof Math.SQRT2 );
+new TestCase( "15.8.1.1",
+ "typeof Math.E",
+ "number",
+ typeof Math.E );
- array[item++] = new TestCase( SECTION, "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
- "",
- eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
+new TestCase( "15.8.1.2",
+ "Math.LN10",
+ 2.302585092994046,
+ Math.LN10 );
- return ( array );
-}
+new TestCase( "15.8.1.2",
+ "typeof Math.LN10",
+ "number",
+ typeof Math.LN10 );
-function test() {
- for ( i = 0; i < testcases.length; i++ ) {
- testcases[i].passed = writeTestCaseResult(
- testcases[i].expect,
- testcases[i].actual,
- testcases[i].description +" = "+ testcases[i].actual );
- testcases[i].reason += ( testcases[i].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( "15.8.1.3",
+ "Math.LN2",
+ 0.6931471805599453,
+ Math.LN2 );
+
+new TestCase( "15.8.1.3",
+ "typeof Math.LN2",
+ "number",
+ typeof Math.LN2 );
+
+new TestCase( "15.8.1.4",
+ "Math.LOG2E",
+ 1.4426950408889634,
+ Math.LOG2E );
+
+new TestCase( "15.8.1.4",
+ "typeof Math.LOG2E",
+ "number",
+ typeof Math.LOG2E );
+
+new TestCase( "15.8.1.5",
+ "Math.LOG10E",
+ 0.4342944819032518,
+ Math.LOG10E);
+
+new TestCase( "15.8.1.5",
+ "typeof Math.LOG10E",
+ "number",
+ typeof Math.LOG10E);
+
+new TestCase( "15.8.1.6",
+ "Math.PI",
+ 3.14159265358979323846,
+ Math.PI );
+
+new TestCase( "15.8.1.6",
+ "typeof Math.PI",
+ "number",
+ typeof Math.PI );
+
+new TestCase( "15.8.1.7",
+ "Math.SQRT1_2",
+ 0.7071067811865476,
+ Math.SQRT1_2);
+
+new TestCase( "15.8.1.7",
+ "typeof Math.SQRT1_2",
+ "number",
+ typeof Math.SQRT1_2);
+
+new TestCase( "15.8.1.8",
+ "Math.SQRT2",
+ 1.4142135623730951,
+ Math.SQRT2 );
+
+new TestCase( "15.8.1.8",
+ "typeof Math.SQRT2",
+ "number",
+ typeof Math.SQRT2 );
+
+new TestCase( SECTION,
+ "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
+ "",
+ eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.1.js b/mozilla/js/tests/ecma/Math/15.8.2.1.js
index eb03ff72370..9011e62b331 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.1.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,85 +35,190 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.1.js
- ECMA Section: 15.8.2.1 abs( x )
- Description: return the absolute value of the argument,
- which should be the magnitude of the argument
- with a positive sign.
- - if x is NaN, return NaN
- - if x is -0, result is +0
- - if x is -Infinity, result is +Infinity
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.1.js
+ ECMA Section: 15.8.2.1 abs( x )
+ Description: return the absolute value of the argument,
+ which should be the magnitude of the argument
+ with a positive sign.
+ - if x is NaN, return NaN
+ - if x is -0, result is +0
+ - if x is -Infinity, result is +Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.abs()";
- var BUGNUMBER = "77391";
+var SECTION = "15.8.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.abs()";
+var BUGNUMBER = "77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.abs.length",
+ 1,
+ Math.abs.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.abs()",
+ Number.NaN,
+ Math.abs() );
- array[item++] = new TestCase( SECTION, "Math.abs.length", 1, Math.abs.length );
+new TestCase( SECTION,
+ "Math.abs( void 0 )",
+ Number.NaN,
+ Math.abs(void 0) );
- array[item++] = new TestCase( SECTION, "Math.abs()", Number.NaN, Math.abs() );
- array[item++] = new TestCase( SECTION, "Math.abs( void 0 )", Number.NaN, Math.abs(void 0) );
- array[item++] = new TestCase( SECTION, "Math.abs( null )", 0, Math.abs(null) );
- array[item++] = new TestCase( SECTION, "Math.abs( true )", 1, Math.abs(true) );
- array[item++] = new TestCase( SECTION, "Math.abs( false )", 0, Math.abs(false) );
- array[item++] = new TestCase( SECTION, "Math.abs( string primitive)", Number.NaN, Math.abs("a string primitive") );
- array[item++] = new TestCase( SECTION, "Math.abs( string object )", Number.NaN, Math.abs(new String( 'a String object' )) );
- array[item++] = new TestCase( SECTION, "Math.abs( Number.NaN )", Number.NaN, Math.abs(Number.NaN) );
+new TestCase( SECTION,
+ "Math.abs( null )",
+ 0,
+ Math.abs(null) );
- array[item++] = new TestCase( SECTION, "Math.abs(0)", 0, Math.abs( 0 ) );
- array[item++] = new TestCase( SECTION, "Math.abs( -0 )", 0, Math.abs(-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.abs(-0)", Infinity, Infinity/Math.abs(-0) );
+new TestCase( SECTION,
+ "Math.abs( true )",
+ 1,
+ Math.abs(true) );
- array[item++] = new TestCase( SECTION, "Math.abs( -Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.NEGATIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "Math.abs( Infinity )", Number.POSITIVE_INFINITY, Math.abs( Number.POSITIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "Math.abs( - MAX_VALUE )", Number.MAX_VALUE, Math.abs( - Number.MAX_VALUE ) );
- array[item++] = new TestCase( SECTION, "Math.abs( - MIN_VALUE )", Number.MIN_VALUE, Math.abs( -Number.MIN_VALUE ) );
- array[item++] = new TestCase( SECTION, "Math.abs( MAX_VALUE )", Number.MAX_VALUE, Math.abs( Number.MAX_VALUE ) );
- array[item++] = new TestCase( SECTION, "Math.abs( MIN_VALUE )", Number.MIN_VALUE, Math.abs( Number.MIN_VALUE ) );
+new TestCase( SECTION,
+ "Math.abs( false )",
+ 0,
+ Math.abs(false) );
- array[item++] = new TestCase( SECTION, "Math.abs( -1 )", 1, Math.abs( -1 ) );
- array[item++] = new TestCase( SECTION, "Math.abs( new Number( -1 ) )", 1, Math.abs( new Number(-1) ) );
- array[item++] = new TestCase( SECTION, "Math.abs( 1 )", 1, Math.abs( 1 ) );
- array[item++] = new TestCase( SECTION, "Math.abs( Math.PI )", Math.PI, Math.abs( Math.PI ) );
- array[item++] = new TestCase( SECTION, "Math.abs( -Math.PI )", Math.PI, Math.abs( -Math.PI ) );
- array[item++] = new TestCase( SECTION, "Math.abs(-1/100000000)", 1/100000000, Math.abs(-1/100000000) );
- array[item++] = new TestCase( SECTION, "Math.abs(-Math.pow(2,32))", Math.pow(2,32), Math.abs(-Math.pow(2,32)) );
- array[item++] = new TestCase( SECTION, "Math.abs(Math.pow(2,32))", Math.pow(2,32), Math.abs(Math.pow(2,32)) );
- array[item++] = new TestCase( SECTION, "Math.abs( -0xfff )", 4095, Math.abs( -0xfff ) );
- array[item++] = new TestCase( SECTION, "Math.abs( -0777 )", 511, Math.abs(-0777 ) );
+new TestCase( SECTION,
+ "Math.abs( string primitive)",
+ Number.NaN,
+ Math.abs("a string primitive") );
- array[item++] = new TestCase( SECTION, "Math.abs('-1e-1')", 0.1, Math.abs('-1e-1') );
- array[item++] = new TestCase( SECTION, "Math.abs('0xff')", 255, Math.abs('0xff') );
- array[item++] = new TestCase( SECTION, "Math.abs('077')", 77, Math.abs('077') );
- array[item++] = new TestCase( SECTION, "Math.abs( 'Infinity' )", Infinity, Math.abs('Infinity') );
- array[item++] = new TestCase( SECTION, "Math.abs( '-Infinity' )", Infinity, Math.abs('-Infinity') );
+new TestCase( SECTION,
+ "Math.abs( string object )",
+ Number.NaN,
+ Math.abs(new String( 'a String object' )) );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.abs( Number.NaN )",
+ Number.NaN,
+ Math.abs(Number.NaN) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.abs(0)",
+ 0,
+ Math.abs( 0 ) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.abs( -0 )",
+ 0,
+ Math.abs(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.abs(-0)",
+ Infinity,
+ Infinity/Math.abs(-0) );
+
+new TestCase( SECTION,
+ "Math.abs( -Infinity )",
+ Number.POSITIVE_INFINITY,
+ Math.abs( Number.NEGATIVE_INFINITY ) );
+
+new TestCase( SECTION,
+ "Math.abs( Infinity )",
+ Number.POSITIVE_INFINITY,
+ Math.abs( Number.POSITIVE_INFINITY ) );
+
+new TestCase( SECTION,
+ "Math.abs( - MAX_VALUE )",
+ Number.MAX_VALUE,
+ Math.abs( - Number.MAX_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( - MIN_VALUE )",
+ Number.MIN_VALUE,
+ Math.abs( -Number.MIN_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( MAX_VALUE )",
+ Number.MAX_VALUE,
+ Math.abs( Number.MAX_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( MIN_VALUE )",
+ Number.MIN_VALUE,
+ Math.abs( Number.MIN_VALUE ) );
+
+new TestCase( SECTION,
+ "Math.abs( -1 )",
+ 1,
+ Math.abs( -1 ) );
+
+new TestCase( SECTION,
+ "Math.abs( new Number( -1 ) )",
+ 1,
+ Math.abs( new Number(-1) ) );
+
+new TestCase( SECTION,
+ "Math.abs( 1 )",
+ 1,
+ Math.abs( 1 ) );
+
+new TestCase( SECTION,
+ "Math.abs( Math.PI )",
+ Math.PI,
+ Math.abs( Math.PI ) );
+
+new TestCase( SECTION,
+ "Math.abs( -Math.PI )",
+ Math.PI,
+ Math.abs( -Math.PI ) );
+
+new TestCase( SECTION,
+ "Math.abs(-1/100000000)",
+ 1/100000000,
+ Math.abs(-1/100000000) );
+
+new TestCase( SECTION,
+ "Math.abs(-Math.pow(2,32))",
+ Math.pow(2,32),
+ Math.abs(-Math.pow(2,32)) );
+
+new TestCase( SECTION,
+ "Math.abs(Math.pow(2,32))",
+ Math.pow(2,32),
+ Math.abs(Math.pow(2,32)) );
+
+new TestCase( SECTION,
+ "Math.abs( -0xfff )",
+ 4095,
+ Math.abs( -0xfff ) );
+
+new TestCase( SECTION,
+ "Math.abs( -0777 )",
+ 511,
+ Math.abs(-0777 ) );
+
+new TestCase( SECTION,
+ "Math.abs('-1e-1')",
+ 0.1,
+ Math.abs('-1e-1') );
+
+new TestCase( SECTION,
+ "Math.abs('0xff')",
+ 255,
+ Math.abs('0xff') );
+
+new TestCase( SECTION,
+ "Math.abs('077')",
+ 77,
+ Math.abs('077') );
+
+new TestCase( SECTION,
+ "Math.abs( 'Infinity' )",
+ Infinity,
+ Math.abs('Infinity') );
+
+new TestCase( SECTION,
+ "Math.abs( '-Infinity' )",
+ Infinity,
+ Math.abs('-Infinity') );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.10.js b/mozilla/js/tests/ecma/Math/15.8.2.10.js
index a21b7480c3c..7d9e46449b9 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.10.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,116 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.10.js
- ECMA Section: 15.8.2.10 Math.log(x)
- Description: return an approximiation to the natural logarithm of
- the argument.
- special cases:
- - if arg is NaN result is NaN
- - if arg is <0 result is NaN
- - if arg is 0 or -0 result is -Infinity
- - if arg is 1 result is 0
- - if arg is Infinity result is Infinity
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.10.js
+ ECMA Section: 15.8.2.10 Math.log(x)
+ Description: return an approximiation to the natural logarithm of
+ the argument.
+ special cases:
+ - if arg is NaN result is NaN
+ - if arg is <0 result is NaN
+ - if arg is 0 or -0 result is -Infinity
+ - if arg is 1 result is 0
+ - if arg is Infinity result is Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.log(x)";
- var BUGNUMBER = "77391";
+var SECTION = "15.8.2.10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.log(x)";
+var BUGNUMBER = "77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.log.length",
+ 1,
+ Math.log.length );
- array[item++] = new TestCase( SECTION, "Math.log.length", 1, Math.log.length );
- array[item++] = new TestCase( SECTION, "Math.log()", Number.NaN, Math.log() );
- array[item++] = new TestCase( SECTION, "Math.log(void 0)", Number.NaN, Math.log(void 0) );
- array[item++] = new TestCase( SECTION, "Math.log(null)", Number.NEGATIVE_INFINITY, Math.log(null) );
- array[item++] = new TestCase( SECTION, "Math.log(true)", 0, Math.log(true) );
- array[item++] = new TestCase( SECTION, "Math.log(false)", -Infinity, Math.log(false) );
- array[item++] = new TestCase( SECTION, "Math.log('0')", -Infinity, Math.log('0') );
- array[item++] = new TestCase( SECTION, "Math.log('1')", 0, Math.log('1') );
- array[item++] = new TestCase( SECTION, "Math.log('Infinity')", Infinity, Math.log("Infinity") );
+new TestCase( SECTION,
+ "Math.log()",
+ Number.NaN,
+ Math.log() );
- array[item++] = new TestCase( SECTION, "Math.log(NaN)", Number.NaN, Math.log(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.log(-0.0000001)", Number.NaN, Math.log(-0.000001) );
- array[item++] = new TestCase( SECTION, "Math.log(-1)", Number.NaN, Math.log(-1) );
- array[item++] = new TestCase( SECTION, "Math.log(0)", Number.NEGATIVE_INFINITY, Math.log(0) );
- array[item++] = new TestCase( SECTION, "Math.log(-0)", Number.NEGATIVE_INFINITY, Math.log(-0));
- array[item++] = new TestCase( SECTION, "Math.log(1)", 0, Math.log(1) );
- array[item++] = new TestCase( SECTION, "Math.log(Infinity)", Number.POSITIVE_INFINITY, Math.log(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.log(-Infinity)", Number.NaN, Math.log(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.log(void 0)",
+ Number.NaN,
+ Math.log(void 0) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.log(null)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(null) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.log(true)",
+ 0,
+ Math.log(true) );
+
+new TestCase( SECTION,
+ "Math.log(false)",
+ -Infinity,
+ Math.log(false) );
+
+new TestCase( SECTION,
+ "Math.log('0')",
+ -Infinity,
+ Math.log('0') );
+
+new TestCase( SECTION,
+ "Math.log('1')",
+ 0,
+ Math.log('1') );
+
+new TestCase( SECTION,
+ "Math.log('Infinity')",
+ Infinity,
+ Math.log("Infinity") );
+
+
+new TestCase( SECTION,
+ "Math.log(NaN)",
+ Number.NaN,
+ Math.log(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.log(-0.0000001)",
+ Number.NaN,
+ Math.log(-0.000001) );
+
+new TestCase( SECTION,
+ "Math.log(-1)",
+ Number.NaN,
+ Math.log(-1) );
+
+new TestCase( SECTION,
+ "Math.log(0)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(0) );
+
+new TestCase( SECTION,
+ "Math.log(-0)",
+ Number.NEGATIVE_INFINITY,
+ Math.log(-0));
+
+new TestCase( SECTION,
+ "Math.log(1)",
+ 0,
+ Math.log(1) );
+
+new TestCase( SECTION,
+ "Math.log(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.log(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.log(-Infinity)",
+ Number.NaN,
+ Math.log(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.11.js b/mozilla/js/tests/ecma/Math/15.8.2.11.js
index e1d41f91c78..d624757ad9a 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.11.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,163 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.11.js
- ECMA Section: 15.8.2.11 Math.max(x, y)
- Description: return the smaller of the two arguments.
- special cases:
- - if x is NaN or y is NaN return NaN
- - if x < y return x
- - if y > x return y
- - if x is +0 and y is +0 return +0
- - if x is +0 and y is -0 return -0
- - if x is -0 and y is +0 return -0
- - if x is -0 and y is -0 return -0
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.11.js
+ ECMA Section: 15.8.2.11 Math.max(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.max(x, y)";
- var BUGNUMBER="76439";
+var SECTION = "15.8.2.11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.max(x, y)";
+var BUGNUMBER="76439";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.max.length",
+ 2,
+ Math.max.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.max()",
+ -Infinity,
+ Math.max() );
- array[item++] = new TestCase( SECTION, "Math.max.length", 2, Math.max.length );
+new TestCase( SECTION,
+ "Math.max(void 0, 1)",
+ Number.NaN,
+ Math.max( void 0, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.max()", -Infinity, Math.max() );
- array[item++] = new TestCase( SECTION, "Math.max(void 0, 1)", Number.NaN, Math.max( void 0, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.max(void 0, void 0)", Number.NaN, Math.max( void 0, void 0 ) );
- array[item++] = new TestCase( SECTION, "Math.max(null, 1)", 1, Math.max( null, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.max(-1, null)", 0, Math.max( -1, null ) );
- array[item++] = new TestCase( SECTION, "Math.max(true, false)", 1, Math.max(true,false) );
+new TestCase( SECTION,
+ "Math.max(void 0, void 0)",
+ Number.NaN,
+ Math.max( void 0, void 0 ) );
- array[item++] = new TestCase( SECTION, "Math.max('-99','99')", 99, Math.max( "-99","99") );
+new TestCase( SECTION,
+ "Math.max(null, 1)",
+ 1,
+ Math.max( null, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.max(NaN, Infinity)", Number.NaN, Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.max(NaN, 0)", Number.NaN, Math.max(Number.NaN, 0) );
- array[item++] = new TestCase( SECTION, "Math.max('a string', 0)", Number.NaN, Math.max("a string", 0) );
- array[item++] = new TestCase( SECTION, "Math.max(NaN, 1)", Number.NaN, Math.max(Number.NaN,1) );
- array[item++] = new TestCase( SECTION, "Math.max('a string',Infinity)", Number.NaN, Math.max("a string", Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.max(Infinity, NaN)", Number.NaN, Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.max(NaN, NaN)", Number.NaN, Math.max(Number.NaN, Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.max(0,NaN)", Number.NaN, Math.max(0,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.max(1, NaN)", Number.NaN, Math.max(1, Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.max(0,0)", 0, Math.max(0,0) );
- array[item++] = new TestCase( SECTION, "Math.max(0,-0)", 0, Math.max(0,-0) );
- array[item++] = new TestCase( SECTION, "Math.max(-0,0)", 0, Math.max(-0,0) );
- array[item++] = new TestCase( SECTION, "Math.max(-0,-0)", -0, Math.max(-0,-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.max(-0,-0)", -Infinity, Infinity/Math.max(-0,-0) );
- array[item++] = new TestCase( SECTION, "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "Math.max(Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.max(-Infinity,-Infinity)", Number.NEGATIVE_INFINITY, Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.max(1,.99999999999999)", 1, Math.max(1,.99999999999999) );
- array[item++] = new TestCase( SECTION, "Math.max(-1,-.99999999999999)", -.99999999999999, Math.max(-1,-.99999999999999) );
+new TestCase( SECTION,
+ "Math.max(-1, null)",
+ 0,
+ Math.max( -1, null ) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.max(true, false)",
+ 1,
+ Math.max(true,false) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.max('-99','99')",
+ 99,
+ Math.max( "-99","99") );
+
+new TestCase( SECTION,
+ "Math.max(NaN, Infinity)",
+ Number.NaN,
+ Math.max(Number.NaN,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, 0)",
+ Number.NaN,
+ Math.max(Number.NaN, 0) );
+
+new TestCase( SECTION,
+ "Math.max('a string', 0)",
+ Number.NaN,
+ Math.max("a string", 0) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, 1)",
+ Number.NaN,
+ Math.max(Number.NaN,1) );
+
+new TestCase( SECTION,
+ "Math.max('a string',Infinity)",
+ Number.NaN,
+ Math.max("a string", Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, NaN)",
+ Number.NaN,
+ Math.max( Number.POSITIVE_INFINITY, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(NaN, NaN)",
+ Number.NaN,
+ Math.max(Number.NaN, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(0,NaN)",
+ Number.NaN,
+ Math.max(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(1, NaN)",
+ Number.NaN,
+ Math.max(1, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.max(0,0)",
+ 0,
+ Math.max(0,0) );
+
+new TestCase( SECTION,
+ "Math.max(0,-0)",
+ 0,
+ Math.max(0,-0) );
+
+new TestCase( SECTION,
+ "Math.max(-0,0)",
+ 0,
+ Math.max(-0,0) );
+
+new TestCase( SECTION,
+ "Math.max(-0,-0)",
+ -0,
+ Math.max(-0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.max(-0,-0)",
+ -Infinity,
+ Infinity/Math.max(-0,-0) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, Number.MAX_VALUE)", Number.POSITIVE_INFINITY,
+ Math.max(Number.POSITIVE_INFINITY, Number.MAX_VALUE) );
+
+new TestCase( SECTION,
+ "Math.max(Infinity, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.max(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(-Infinity,-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.max(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.max(1,.99999999999999)",
+ 1,
+ Math.max(1,.99999999999999) );
+
+new TestCase( SECTION,
+ "Math.max(-1,-.99999999999999)",
+ -.99999999999999,
+ Math.max(-1,-.99999999999999) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.12.js b/mozilla/js/tests/ecma/Math/15.8.2.12.js
index 1fa3091b878..b92706bce91 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.12.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.12.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,140 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.12.js
- ECMA Section: 15.8.2.12 Math.min(x, y)
- Description: return the smaller of the two arguments.
- special cases:
- - if x is NaN or y is NaN return NaN
- - if x < y return x
- - if y > x return y
- - if x is +0 and y is +0 return +0
- - if x is +0 and y is -0 return -0
- - if x is -0 and y is +0 return -0
- - if x is -0 and y is -0 return -0
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.12.js
+ ECMA Section: 15.8.2.12 Math.min(x, y)
+ Description: return the smaller of the two arguments.
+ special cases:
+ - if x is NaN or y is NaN return NaN
+ - if x < y return x
+ - if y > x return y
+ - if x is +0 and y is +0 return +0
+ - if x is +0 and y is -0 return -0
+ - if x is -0 and y is +0 return -0
+ - if x is -0 and y is -0 return -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.min(x, y)";
- var BUGNUMBER="76439";
+var SECTION = "15.8.2.12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.min(x, y)";
+var BUGNUMBER="76439";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.min.length",
+ 2,
+ Math.min.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.min()",
+ Infinity,
+ Math.min() );
- array[item++] = new TestCase( SECTION, "Math.min.length", 2, Math.min.length );
+new TestCase( SECTION,
+ "Math.min(void 0, 1)",
+ Number.NaN,
+ Math.min( void 0, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.min()", Infinity, Math.min() );
- array[item++] = new TestCase( SECTION, "Math.min(void 0, 1)", Number.NaN, Math.min( void 0, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.min(void 0, void 0)", Number.NaN, Math.min( void 0, void 0 ) );
- array[item++] = new TestCase( SECTION, "Math.min(null, 1)", 0, Math.min( null, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.min(-1, null)", -1, Math.min( -1, null ) );
- array[item++] = new TestCase( SECTION, "Math.min(true, false)", 0, Math.min(true,false) );
+new TestCase( SECTION,
+ "Math.min(void 0, void 0)",
+ Number.NaN,
+ Math.min( void 0, void 0 ) );
- array[item++] = new TestCase( SECTION, "Math.min('-99','99')", -99, Math.min( "-99","99") );
+new TestCase( SECTION,
+ "Math.min(null, 1)",
+ 0,
+ Math.min( null, 1 ) );
- array[item++] = new TestCase( SECTION, "Math.min(NaN,0)", Number.NaN, Math.min(Number.NaN,0) );
- array[item++] = new TestCase( SECTION, "Math.min(NaN,1)", Number.NaN, Math.min(Number.NaN,1) );
- array[item++] = new TestCase( SECTION, "Math.min(NaN,-1)", Number.NaN, Math.min(Number.NaN,-1) );
- array[item++] = new TestCase( SECTION, "Math.min(0,NaN)", Number.NaN, Math.min(0,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.min(1,NaN)", Number.NaN, Math.min(1,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.min(-1,NaN)", Number.NaN, Math.min(-1,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.min(NaN,NaN)", Number.NaN, Math.min(Number.NaN,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.min(1,1.0000000001)", 1, Math.min(1,1.0000000001) );
- array[item++] = new TestCase( SECTION, "Math.min(1.0000000001,1)", 1, Math.min(1.0000000001,1) );
- array[item++] = new TestCase( SECTION, "Math.min(0,0)", 0, Math.min(0,0) );
- array[item++] = new TestCase( SECTION, "Math.min(0,-0)", -0, Math.min(0,-0) );
- array[item++] = new TestCase( SECTION, "Math.min(-0,-0)", -0, Math.min(-0,-0) );
+new TestCase( SECTION,
+ "Math.min(-1, null)",
+ -1,
+ Math.min( -1, null ) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.min(0,-0)", -Infinity, Infinity/Math.min(0,-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.min(-0,-0)", -Infinity, Infinity/Math.min(-0,-0) );
+new TestCase( SECTION,
+ "Math.min(true, false)",
+ 0,
+ Math.min(true,false) );
+new TestCase( SECTION,
+ "Math.min('-99','99')",
+ -99,
+ Math.min( "-99","99") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.min(NaN,0)",
+ Number.NaN,
+ Math.min(Number.NaN,0) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.min(NaN,1)",
+ Number.NaN,
+ Math.min(Number.NaN,1) );
+
+new TestCase( SECTION,
+ "Math.min(NaN,-1)",
+ Number.NaN,
+ Math.min(Number.NaN,-1) );
+
+new TestCase( SECTION,
+ "Math.min(0,NaN)",
+ Number.NaN,
+ Math.min(0,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(1,NaN)",
+ Number.NaN,
+ Math.min(1,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(-1,NaN)",
+ Number.NaN,
+ Math.min(-1,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(NaN,NaN)",
+ Number.NaN,
+ Math.min(Number.NaN,Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.min(1,1.0000000001)",
+ 1,
+ Math.min(1,1.0000000001) );
+
+new TestCase( SECTION,
+ "Math.min(1.0000000001,1)",
+ 1,
+ Math.min(1.0000000001,1) );
+
+new TestCase( SECTION,
+ "Math.min(0,0)",
+ 0,
+ Math.min(0,0) );
+
+new TestCase( SECTION,
+ "Math.min(0,-0)",
+ -0,
+ Math.min(0,-0) );
+
+new TestCase( SECTION,
+ "Math.min(-0,-0)",
+ -0,
+ Math.min(-0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.min(0,-0)",
+ -Infinity,
+ Infinity/Math.min(0,-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.min(-0,-0)",
+ -Infinity,
+ Infinity/Math.min(-0,-0) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.13.js b/mozilla/js/tests/ecma/Math/15.8.2.13.js
index 0c44600fac4..aaaec9bdf40 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.13.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.13.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,114 +35,348 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.13.js
- ECMA Section: 15.8.2.13 Math.pow(x, y)
- Description: return an approximation to the result of x
- to the power of y. there are many special cases;
- refer to the spec.
- Author: christine@netscape.com
- Date: 9 july 1997
+ File Name: 15.8.2.13.js
+ ECMA Section: 15.8.2.13 Math.pow(x, y)
+ Description: return an approximation to the result of x
+ to the power of y. there are many special cases;
+ refer to the spec.
+ Author: christine@netscape.com
+ Date: 9 july 1997
*/
- var SECTION = "15.8.2.13";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.pow(x, y)";
- var BUGNUMBER="77141";
+var SECTION = "15.8.2.13";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.pow(x, y)";
+var BUGNUMBER="77141";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.pow.length",
+ 2,
+ Math.pow.length );
- array[item++] = new TestCase( SECTION, "Math.pow.length", 2, Math.pow.length );
+new TestCase( SECTION,
+ "Math.pow()",
+ Number.NaN,
+ Math.pow() );
- array[item++] = new TestCase( SECTION, "Math.pow()", Number.NaN, Math.pow() );
- array[item++] = new TestCase( SECTION, "Math.pow(null, null)", 1, Math.pow(null,null) );
- array[item++] = new TestCase( SECTION, "Math.pow(void 0, void 0)", Number.NaN, Math.pow(void 0, void 0));
- array[item++] = new TestCase( SECTION, "Math.pow(true, false)", 1, Math.pow(true, false) );
- array[item++] = new TestCase( SECTION, "Math.pow(false,true)", 0, Math.pow(false,true) );
- array[item++] = new TestCase( SECTION, "Math.pow('2','32')", 4294967296, Math.pow('2','32') );
+new TestCase( SECTION,
+ "Math.pow(null, null)",
+ 1,
+ Math.pow(null,null) );
- array[item++] = new TestCase( SECTION, "Math.pow(1,NaN)", Number.NaN, Math.pow(1,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.pow(0,NaN)", Number.NaN, Math.pow(0,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.pow(NaN,0)", 1, Math.pow(Number.NaN,0) );
- array[item++] = new TestCase( SECTION, "Math.pow(NaN,-0)", 1, Math.pow(Number.NaN,-0) );
- array[item++] = new TestCase( SECTION, "Math.pow(NaN,1)", Number.NaN, Math.pow(Number.NaN, 1) );
- array[item++] = new TestCase( SECTION, "Math.pow(NaN,.5)", Number.NaN, Math.pow(Number.NaN, .5) );
- array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(1.00000001, -Infinity)", 0, Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, Infinity)", Number.POSITIVE_INFINITY, Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1.00000001, -Infinity)", 0, Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(1, Infinity)", Number.NaN, Math.pow(1, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(1, -Infinity)", Number.NaN, Math.pow(1, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, Infinity)", Number.NaN, Math.pow(-1, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, -Infinity)", Number.NaN, Math.pow(-1, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, Infinity)", 0, Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-.0000000009, Infinity)", 0, Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(.0000000009, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(Infinity, .00000000001)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
- array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 1)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 1) );
- array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -.00000000001)",0, Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
- array[item++] = new TestCase( SECTION, "Math.pow(Infinity, -1)", 0, Math.pow(Number.POSITIVE_INFINITY, -1) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 1)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 1) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 333)", Number.NEGATIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 333) );
- array[item++] = new TestCase( SECTION, "Math.pow(Infinity, 2)", Number.POSITIVE_INFINITY, Math.pow(Number.POSITIVE_INFINITY, 2) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 666)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 666) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, 0.5)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, Infinity)", Number.POSITIVE_INFINITY, Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.pow(void 0, void 0)",
+ Number.NaN,
+ Math.pow(void 0, void 0));
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -1)", -0, Math.pow(Number.NEGATIVE_INFINITY, -1) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-Infinity, -1)", -Infinity, Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
+new TestCase( SECTION,
+ "Math.pow(true, false)",
+ 1,
+ Math.pow(true, false) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -3)", -0, Math.pow(Number.NEGATIVE_INFINITY, -3) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -2)", 0, Math.pow(Number.NEGATIVE_INFINITY, -2) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -0.5)", 0, Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(-Infinity, -Infinity)", 0, Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, 1)", 0, Math.pow(0,1) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, 0)", 1, Math.pow(0,0) );
- array[item++] = new TestCase( SECTION, "Math.pow(1, 0)", 1, Math.pow(1,0) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, 0)", 1, Math.pow(-1,0) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, 0.5)", 0, Math.pow(0,0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, 1000)", 0, Math.pow(0,1000) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, Infinity)", 0, Math.pow(0, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, -1)", Number.POSITIVE_INFINITY, Math.pow(0, -1) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, -0.5)", Number.POSITIVE_INFINITY, Math.pow(0, -0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, -1000)", Number.POSITIVE_INFINITY, Math.pow(0, -1000) );
- array[item++] = new TestCase( SECTION, "Math.pow(0, -Infinity)", Number.POSITIVE_INFINITY, Math.pow(0, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, 1)", -0, Math.pow(-0, 1) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, 3)", -0, Math.pow(-0,3) );
+new TestCase( SECTION,
+ "Math.pow(false,true)",
+ 0,
+ Math.pow(false,true) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 1)", -Infinity, Infinity/Math.pow(-0, 1) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.pow(-0, 3)", -Infinity, Infinity/Math.pow(-0,3) );
+new TestCase( SECTION,
+ "Math.pow('2','32')",
+ 4294967296,
+ Math.pow('2','32') );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, 2)", 0, Math.pow(-0,2) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, -1)", Number.NEGATIVE_INFINITY, Math.pow(-0, -1) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, -10001)", Number.NEGATIVE_INFINITY, Math.pow(-0, -10001) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, -2)", Number.POSITIVE_INFINITY, Math.pow(-0, -2) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, 0.5)", 0, Math.pow(-0, 0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(-0, Infinity)", 0, Math.pow(-0, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, 0.5)", Number.NaN, Math.pow(-1, 0.5) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, NaN)", Number.NaN, Math.pow(-1, Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.pow(-1, -0.5)", Number.NaN, Math.pow(-1, -0.5) );
+new TestCase( SECTION,
+ "Math.pow(1,NaN)",
+ Number.NaN,
+ Math.pow(1,Number.NaN) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.pow(0,NaN)",
+ Number.NaN,
+ Math.pow(0,Number.NaN) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.pow(NaN,0)",
+ 1,
+ Math.pow(Number.NaN,0) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,-0)",
+ 1,
+ Math.pow(Number.NaN,-0) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,1)",
+ Number.NaN,
+ Math.pow(Number.NaN, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(NaN,.5)",
+ Number.NaN,
+ Math.pow(Number.NaN, .5) );
+
+new TestCase( SECTION,
+ "Math.pow(1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(1.00000001, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1.00000001, -Infinity)",
+ 0,
+ Math.pow(1.00000001, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1.00000001, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-1.00000001,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1.00000001, -Infinity)",
+ 0,
+ Math.pow(-1.00000001,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1, Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(1, -Infinity)",
+ Number.NaN,
+ Math.pow(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, -Infinity)",
+ Number.NaN,
+ Math.pow(-1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(.0000000009, Infinity)",
+ 0,
+ Math.pow(.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-.0000000009, Infinity)",
+ 0,
+ Math.pow(-.0000000009, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(.0000000009, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-.0000000009, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, .00000000001)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY,.00000000001) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, 1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, -.00000000001)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -.00000000001) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, -1)",
+ 0,
+ Math.pow(Number.POSITIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 333)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 333) );
+
+new TestCase( SECTION,
+ "Math.pow(Infinity, 2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.POSITIVE_INFINITY, 2) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 666)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 666) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, 0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -1)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-Infinity, -1)",
+ -Infinity,
+ Infinity/Math.pow(Number.NEGATIVE_INFINITY, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -3)",
+ -0,
+ Math.pow(Number.NEGATIVE_INFINITY, -3) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -2)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, -2) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -0.5)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY,-0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-Infinity, -Infinity)",
+ 0,
+ Math.pow(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 1)",
+ 0,
+ Math.pow(0,1) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 0)",
+ 1,
+ Math.pow(0,0) );
+
+new TestCase( SECTION,
+ "Math.pow(1, 0)",
+ 1,
+ Math.pow(1,0) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, 0)",
+ 1,
+ Math.pow(-1,0) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 0.5)",
+ 0,
+ Math.pow(0,0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(0, 1000)",
+ 0,
+ Math.pow(0,1000) );
+
+new TestCase( SECTION,
+ "Math.pow(0, Infinity)",
+ 0,
+ Math.pow(0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -1)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -0.5)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -1000)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, -1000) );
+
+new TestCase( SECTION,
+ "Math.pow(0, -Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(0, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 1)",
+ -0,
+ Math.pow(-0, 1) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 3)",
+ -0,
+ Math.pow(-0,3) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-0, 1)",
+ -Infinity,
+ Infinity/Math.pow(-0, 1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.pow(-0, 3)",
+ -Infinity,
+ Infinity/Math.pow(-0,3) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 2)",
+ 0,
+ Math.pow(-0,2) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -1)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -1) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -10001)",
+ Number.NEGATIVE_INFINITY,
+ Math.pow(-0, -10001) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, -2)",
+ Number.POSITIVE_INFINITY,
+ Math.pow(-0, -2) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, 0.5)",
+ 0,
+ Math.pow(-0, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-0, Infinity)",
+ 0,
+ Math.pow(-0, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, 0.5)",
+ Number.NaN,
+ Math.pow(-1, 0.5) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, NaN)",
+ Number.NaN,
+ Math.pow(-1, Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.pow(-1, -0.5)",
+ Number.NaN,
+ Math.pow(-1, -0.5) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.14.js b/mozilla/js/tests/ecma/Math/15.8.2.14.js
index 03ef381d197..29148923822 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.14.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.14.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,65 +35,42 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.2.14.js
- ECMA Section: 15.8.2.14 Math.random()
- returns a number value x with a positive sign
- with 1 > x >= 0 with approximately uniform
- distribution over that range, using an
- implementation-dependent algorithm or strategy.
- This function takes no arguments.
-
- Description:
- Author: christine@netscape.com
- Date: 16 september 1997
-*/
-
- var SECTION = "15.8.2.14";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.random()";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- for ( item = 0; item < 100; item++ ) {
- array[item] = new TestCase( SECTION, "Math.random()", "pass", null );
- }
-
- return ( array );
-}
-function getRandom( caseno ) {
- testcases[caseno].reason = Math.random();
- testcases[caseno].actual = "pass";
-
- if ( ! ( testcases[caseno].reason >= 0) ) {
- testcases[caseno].actual = "fail";
- }
-
- if ( ! (testcases[caseno].reason < 1) ) {
- testcases[caseno].actual = "fail";
- }
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- getRandom( tc );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.2.14.js
+ ECMA Section: 15.8.2.14 Math.random()
+ returns a number value x with a positive sign
+ with 1 > x >= 0 with approximately uniform
+ distribution over that range, using an
+ implementation-dependent algorithm or strategy.
+ This function takes no arguments.
+
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
+*/
+
+var SECTION = "15.8.2.14";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.random()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+for ( var item = 0; item < 100; item++ ) {
+ var testcase = new TestCase( SECTION,
+ "Math.random()",
+ "pass",
+ null );
+ testcase.reason = Math.random();
+ testcase.actual = "pass";
+
+ if ( ! ( testcase.reason >= 0) ) {
+ testcase.actual = "fail";
+ }
+
+ if ( ! (testcase.reason < 1) ) {
+ testcase.actual = "fail";
+ }
+}
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.15.js b/mozilla/js/tests/ecma/Math/15.8.2.15.js
index 642113b8f36..82a50814389 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.15.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.15.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,95 +35,165 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.15.js
- ECMA Section: 15.8.2.15 Math.round(x)
- Description: return the greatest number value that is closest to the
- argument and is an integer. if two integers are equally
- close to the argument. then the result is the number value
- that is closer to Infinity. if the argument is an integer,
- return the argument.
- special cases:
- - if x is NaN return NaN
- - if x = +0 return +0
- - if x = -0 return -0
- - if x = Infinity return Infinity
- - if x = -Infinity return -Infinity
- - if 0 < x < 0.5 return 0
- - if -0.5 <= x < 0 return -0
- example:
- Math.round( 3.5 ) == 4
- Math.round( -3.5 ) == 3
- also:
- - Math.round(x) == Math.floor( x + 0.5 )
- except if x = -0. in that case, Math.round(x) = -0
+ File Name: 15.8.2.15.js
+ ECMA Section: 15.8.2.15 Math.round(x)
+ Description: return the greatest number value that is closest to the
+ argument and is an integer. if two integers are equally
+ close to the argument. then the result is the number value
+ that is closer to Infinity. if the argument is an integer,
+ return the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if 0 < x < 0.5 return 0
+ - if -0.5 <= x < 0 return -0
+ example:
+ Math.round( 3.5 ) == 4
+ Math.round( -3.5 ) == 3
+ also:
+ - Math.round(x) == Math.floor( x + 0.5 )
+ except if x = -0. in that case, Math.round(x) = -0
- and Math.floor( x+0.5 ) = +0
+ and Math.floor( x+0.5 ) = +0
- Author: christine@netscape.com
- Date: 7 july 1997
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.15";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.round(x)";
- var BUGNUMBER="331411";
+var SECTION = "15.8.2.15";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.round(x)";
+var BUGNUMBER="331411";
- var EXCLUDE = "true";
+var EXCLUDE = "true";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.round.length",
+ 1,
+ Math.round.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.round()",
+ Number.NaN,
+ Math.round() );
- array[item++] = new TestCase( SECTION, "Math.round.length", 1, Math.round.length );
+new TestCase( SECTION,
+ "Math.round(null)",
+ 0,
+ Math.round(0) );
- array[item++] = new TestCase( SECTION, "Math.round()", Number.NaN, Math.round() );
- array[item++] = new TestCase( SECTION, "Math.round(null)", 0, Math.round(0) );
- array[item++] = new TestCase( SECTION, "Math.round(void 0)", Number.NaN, Math.round(void 0) );
- array[item++] = new TestCase( SECTION, "Math.round(true)", 1, Math.round(true) );
- array[item++] = new TestCase( SECTION, "Math.round(false)", 0, Math.round(false) );
- array[item++] = new TestCase( SECTION, "Math.round('.99999')", 1, Math.round('.99999') );
- array[item++] = new TestCase( SECTION, "Math.round('12345e-2')", 123, Math.round('12345e-2') );
+new TestCase( SECTION,
+ "Math.round(void 0)",
+ Number.NaN,
+ Math.round(void 0) );
- array[item++] = new TestCase( SECTION, "Math.round(NaN)", Number.NaN, Math.round(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.round(0)", 0, Math.round(0) );
- array[item++] = new TestCase( SECTION, "Math.round(-0)", -0, Math.round(-0));
- array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0)", -Infinity, Infinity/Math.round(-0) );
+new TestCase( SECTION,
+ "Math.round(true)",
+ 1,
+ Math.round(true) );
- array[item++] = new TestCase( SECTION, "Math.round(Infinity)", Number.POSITIVE_INFINITY, Math.round(Number.POSITIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.round(-Infinity)",Number.NEGATIVE_INFINITY, Math.round(Number.NEGATIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.round(0.49)", 0, Math.round(0.49));
- array[item++] = new TestCase( SECTION, "Math.round(0.5)", 1, Math.round(0.5));
- array[item++] = new TestCase( SECTION, "Math.round(0.51)", 1, Math.round(0.51));
+new TestCase( SECTION,
+ "Math.round(false)",
+ 0,
+ Math.round(false) );
- array[item++] = new TestCase( SECTION, "Math.round(-0.49)", -0, Math.round(-0.49));
- array[item++] = new TestCase( SECTION, "Math.round(-0.5)", -0, Math.round(-0.5));
- array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.49)", -Infinity, Infinity/Math.round(-0.49));
- array[item++] = new TestCase( SECTION, "Infinity/Math.round(-0.5)", -Infinity, Infinity/Math.round(-0.5));
+new TestCase( SECTION,
+ "Math.round('.99999')",
+ 1,
+ Math.round('.99999') );
- array[item++] = new TestCase( SECTION, "Math.round(-0.51)", -1, Math.round(-0.51));
- array[item++] = new TestCase( SECTION, "Math.round(3.5)", 4, Math.round(3.5));
- array[item++] = new TestCase( SECTION, "Math.round(-3.5)", -3, Math.round(-3));
+new TestCase( SECTION,
+ "Math.round('12345e-2')",
+ 123,
+ Math.round('12345e-2') );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.round(NaN)",
+ Number.NaN,
+ Math.round(Number.NaN) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.round(0)",
+ 0,
+ Math.round(0) );
+
+new TestCase( SECTION,
+ "Math.round(-0)",
+ -0,
+ Math.round(-0));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0)",
+ -Infinity,
+ Infinity/Math.round(-0) );
+
+new TestCase( SECTION,
+ "Math.round(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.round(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.round(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.round(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.round(0.49)",
+ 0,
+ Math.round(0.49));
+
+new TestCase( SECTION,
+ "Math.round(0.5)",
+ 1,
+ Math.round(0.5));
+
+new TestCase( SECTION,
+ "Math.round(0.51)",
+ 1,
+ Math.round(0.51));
+
+new TestCase( SECTION,
+ "Math.round(-0.49)",
+ -0,
+ Math.round(-0.49));
+
+new TestCase( SECTION,
+ "Math.round(-0.5)",
+ -0,
+ Math.round(-0.5));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0.49)",
+ -Infinity,
+ Infinity/Math.round(-0.49));
+
+new TestCase( SECTION,
+ "Infinity/Math.round(-0.5)",
+ -Infinity,
+ Infinity/Math.round(-0.5));
+
+new TestCase( SECTION,
+ "Math.round(-0.51)",
+ -1,
+ Math.round(-0.51));
+
+new TestCase( SECTION,
+ "Math.round(3.5)",
+ 4,
+ Math.round(3.5));
+
+new TestCase( SECTION,
+ "Math.round(-3.5)",
+ -3,
+ Math.round(-3));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.16.js b/mozilla/js/tests/ecma/Math/15.8.2.16.js
index a80c95ad661..e79aab8051d 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.16.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.16.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,60 +35,96 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.16.js
- ECMA Section: 15.8.2.16 sin( x )
- Description: return an approximation to the sine of the
- argument. argument is expressed in radians
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.16.js
+ ECMA Section: 15.8.2.16 sin( x )
+ Description: return an approximation to the sine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.16";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.sin(x)";
+var SECTION = "15.8.2.16";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.sin(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.sin.length",
+ 1,
+ Math.sin.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.sin()",
+ Number.NaN,
+ Math.sin() );
- array[item++] = new TestCase( SECTION, "Math.sin.length", 1, Math.sin.length );
+new TestCase( SECTION,
+ "Math.sin(null)",
+ 0,
+ Math.sin(null) );
- array[item++] = new TestCase( SECTION, "Math.sin()", Number.NaN, Math.sin() );
- array[item++] = new TestCase( SECTION, "Math.sin(null)", 0, Math.sin(null) );
- array[item++] = new TestCase( SECTION, "Math.sin(void 0)", Number.NaN, Math.sin(void 0) );
- array[item++] = new TestCase( SECTION, "Math.sin(false)", 0, Math.sin(false) );
- array[item++] = new TestCase( SECTION, "Math.sin('2.356194490192')", 0.7071067811865, Math.sin('2.356194490192') );
+new TestCase( SECTION,
+ "Math.sin(void 0)",
+ Number.NaN,
+ Math.sin(void 0) );
- array[item++] = new TestCase( SECTION, "Math.sin(NaN)", Number.NaN, Math.sin(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.sin(0)", 0, Math.sin(0) );
- array[item++] = new TestCase( SECTION, "Math.sin(-0)", -0, Math.sin(-0));
- array[item++] = new TestCase( SECTION, "Math.sin(Infinity)", Number.NaN, Math.sin(Number.POSITIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.sin(-Infinity)", Number.NaN, Math.sin(Number.NEGATIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.sin(0.7853981633974)", 0.7071067811865, Math.sin(0.7853981633974));
- array[item++] = new TestCase( SECTION, "Math.sin(1.570796326795)", 1, Math.sin(1.570796326795));
- array[item++] = new TestCase( SECTION, "Math.sin(2.356194490192)", 0.7071067811865, Math.sin(2.356194490192));
- array[item++] = new TestCase( SECTION, "Math.sin(3.14159265359)", 0, Math.sin(3.14159265359));
+new TestCase( SECTION,
+ "Math.sin(false)",
+ 0,
+ Math.sin(false) );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.sin('2.356194490192')",
+ 0.7071067811865,
+ Math.sin('2.356194490192') );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.sin(NaN)",
+ Number.NaN,
+ Math.sin(Number.NaN) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.sin(0)",
+ 0,
+ Math.sin(0) );
+
+new TestCase( SECTION,
+ "Math.sin(-0)",
+ -0,
+ Math.sin(-0));
+
+new TestCase( SECTION,
+ "Math.sin(Infinity)",
+ Number.NaN,
+ Math.sin(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sin(-Infinity)",
+ Number.NaN,
+ Math.sin(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sin(0.7853981633974)",
+ 0.7071067811865,
+ Math.sin(0.7853981633974));
+
+new TestCase( SECTION,
+ "Math.sin(1.570796326795)",
+ 1,
+ Math.sin(1.570796326795));
+
+new TestCase( SECTION,
+ "Math.sin(2.356194490192)",
+ 0.7071067811865,
+ Math.sin(2.356194490192));
+
+new TestCase( SECTION,
+ "Math.sin(3.14159265359)",
+ 0,
+ Math.sin(3.14159265359));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.17.js b/mozilla/js/tests/ecma/Math/15.8.2.17.js
index e1b17412961..46ef565d059 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.17.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.17.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,81 +35,181 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.17.js
- ECMA Section: 15.8.2.17 Math.sqrt(x)
- Description: return an approximation to the squareroot of the argument.
- special cases:
- - if x is NaN return NaN
- - if x < 0 return NaN
- - if x == 0 return 0
- - if x == -0 return -0
- - if x == Infinity return Infinity
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.17.js
+ ECMA Section: 15.8.2.17 Math.sqrt(x)
+ Description: return an approximation to the squareroot of the argument.
+ special cases:
+ - if x is NaN return NaN
+ - if x < 0 return NaN
+ - if x == 0 return 0
+ - if x == -0 return -0
+ - if x == Infinity return Infinity
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.17";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.sqrt(x)";
+var SECTION = "15.8.2.17";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.sqrt(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.sqrt.length",
+ 1,
+ Math.sqrt.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.sqrt()",
+ Number.NaN,
+ Math.sqrt() );
- array[item++] = new TestCase( SECTION, "Math.sqrt.length", 1, Math.sqrt.length );
+new TestCase( SECTION,
+ "Math.sqrt(void 0)",
+ Number.NaN,
+ Math.sqrt(void 0) );
- array[item++] = new TestCase( SECTION, "Math.sqrt()", Number.NaN, Math.sqrt() );
- array[item++] = new TestCase( SECTION, "Math.sqrt(void 0)", Number.NaN, Math.sqrt(void 0) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(null)", 0, Math.sqrt(null) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(true)", 1, Math.sqrt(1) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(false)", 0, Math.sqrt(false) );
- array[item++] = new TestCase( SECTION, "Math.sqrt('225')", 15, Math.sqrt('225') );
+new TestCase( SECTION,
+ "Math.sqrt(null)",
+ 0,
+ Math.sqrt(null) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(NaN)", Number.NaN, Math.sqrt(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(-Infinity)", Number.NaN, Math.sqrt(Number.NEGATIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.sqrt(-1)", Number.NaN, Math.sqrt(-1));
- array[item++] = new TestCase( SECTION, "Math.sqrt(-0.5)", Number.NaN, Math.sqrt(-0.5));
- array[item++] = new TestCase( SECTION, "Math.sqrt(0)", 0, Math.sqrt(0));
- array[item++] = new TestCase( SECTION, "Math.sqrt(-0)", -0, Math.sqrt(-0));
- array[item++] = new TestCase( SECTION, "Infinity/Math.sqrt(-0)", -Infinity, Infinity/Math.sqrt(-0) );
- array[item++] = new TestCase( SECTION, "Math.sqrt(Infinity)", Number.POSITIVE_INFINITY, Math.sqrt(Number.POSITIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.sqrt(1)", 1, Math.sqrt(1));
- array[item++] = new TestCase( SECTION, "Math.sqrt(2)", Math.SQRT2, Math.sqrt(2));
- array[item++] = new TestCase( SECTION, "Math.sqrt(0.5)", Math.SQRT1_2, Math.sqrt(0.5));
- array[item++] = new TestCase( SECTION, "Math.sqrt(4)", 2, Math.sqrt(4));
- array[item++] = new TestCase( SECTION, "Math.sqrt(9)", 3, Math.sqrt(9));
- array[item++] = new TestCase( SECTION, "Math.sqrt(16)", 4, Math.sqrt(16));
- array[item++] = new TestCase( SECTION, "Math.sqrt(25)", 5, Math.sqrt(25));
- array[item++] = new TestCase( SECTION, "Math.sqrt(36)", 6, Math.sqrt(36));
- array[item++] = new TestCase( SECTION, "Math.sqrt(49)", 7, Math.sqrt(49));
- array[item++] = new TestCase( SECTION, "Math.sqrt(64)", 8, Math.sqrt(64));
- array[item++] = new TestCase( SECTION, "Math.sqrt(256)", 16, Math.sqrt(256));
- array[item++] = new TestCase( SECTION, "Math.sqrt(10000)", 100, Math.sqrt(10000));
- array[item++] = new TestCase( SECTION, "Math.sqrt(65536)", 256, Math.sqrt(65536));
- array[item++] = new TestCase( SECTION, "Math.sqrt(0.09)", 0.3, Math.sqrt(0.09));
- array[item++] = new TestCase( SECTION, "Math.sqrt(0.01)", 0.1, Math.sqrt(0.01));
- array[item++] = new TestCase( SECTION, "Math.sqrt(0.00000001)",0.0001, Math.sqrt(0.00000001));
+new TestCase( SECTION,
+ "Math.sqrt(true)",
+ 1,
+ Math.sqrt(1) );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.sqrt(false)",
+ 0,
+ Math.sqrt(false) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.sqrt('225')",
+ 15,
+ Math.sqrt('225') );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.sqrt(NaN)",
+ Number.NaN,
+ Math.sqrt(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.sqrt(-Infinity)",
+ Number.NaN,
+ Math.sqrt(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sqrt(-1)",
+ Number.NaN,
+ Math.sqrt(-1));
+
+new TestCase( SECTION,
+ "Math.sqrt(-0.5)",
+ Number.NaN,
+ Math.sqrt(-0.5));
+
+new TestCase( SECTION,
+ "Math.sqrt(0)",
+ 0,
+ Math.sqrt(0));
+
+new TestCase( SECTION,
+ "Math.sqrt(-0)",
+ -0,
+ Math.sqrt(-0));
+
+new TestCase( SECTION,
+ "Infinity/Math.sqrt(-0)",
+ -Infinity,
+ Infinity/Math.sqrt(-0) );
+
+new TestCase( SECTION,
+ "Math.sqrt(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.sqrt(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.sqrt(1)",
+ 1,
+ Math.sqrt(1));
+
+new TestCase( SECTION,
+ "Math.sqrt(2)",
+ Math.SQRT2,
+ Math.sqrt(2));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.5)",
+ Math.SQRT1_2,
+ Math.sqrt(0.5));
+
+new TestCase( SECTION,
+ "Math.sqrt(4)",
+ 2,
+ Math.sqrt(4));
+
+new TestCase( SECTION,
+ "Math.sqrt(9)",
+ 3,
+ Math.sqrt(9));
+
+new TestCase( SECTION,
+ "Math.sqrt(16)",
+ 4,
+ Math.sqrt(16));
+
+new TestCase( SECTION,
+ "Math.sqrt(25)",
+ 5,
+ Math.sqrt(25));
+
+new TestCase( SECTION,
+ "Math.sqrt(36)",
+ 6,
+ Math.sqrt(36));
+
+new TestCase( SECTION,
+ "Math.sqrt(49)",
+ 7,
+ Math.sqrt(49));
+
+new TestCase( SECTION,
+ "Math.sqrt(64)",
+ 8,
+ Math.sqrt(64));
+
+new TestCase( SECTION,
+ "Math.sqrt(256)",
+ 16,
+ Math.sqrt(256));
+
+new TestCase( SECTION,
+ "Math.sqrt(10000)",
+ 100,
+ Math.sqrt(10000));
+
+new TestCase( SECTION,
+ "Math.sqrt(65536)",
+ 256,
+ Math.sqrt(65536));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.09)",
+ 0.3,
+ Math.sqrt(0.09));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.01)",
+ 0.1,
+ Math.sqrt(0.01));
+
+new TestCase( SECTION,
+ "Math.sqrt(0.00000001)",
+ 0.0001,
+ Math.sqrt(0.00000001));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.18.js b/mozilla/js/tests/ecma/Math/15.8.2.18.js
index 4efac16be9b..994eab8a6eb 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.18.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.18.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,129 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.18.js
- ECMA Section: 15.8.2.18 tan( x )
- Description: return an approximation to the tan of the
- argument. argument is expressed in radians
- special cases:
- - if x is NaN result is NaN
- - if x is 0 result is 0
- - if x is -0 result is -0
- - if x is Infinity or -Infinity result is NaN
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.18.js
+ ECMA Section: 15.8.2.18 tan( x )
+ Description: return an approximation to the tan of the
+ argument. argument is expressed in radians
+ special cases:
+ - if x is NaN result is NaN
+ - if x is 0 result is 0
+ - if x is -0 result is -0
+ - if x is Infinity or -Infinity result is NaN
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.18";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.tan(x)";
- var EXCLUDE = "true";
+var SECTION = "15.8.2.18";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.tan(x)";
+var EXCLUDE = "true";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.tan.length",
+ 1,
+ Math.tan.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.tan()",
+ Number.NaN,
+ Math.tan() );
- array[item++] = new TestCase( SECTION, "Math.tan.length", 1, Math.tan.length );
+new TestCase( SECTION,
+ "Math.tan(void 0)",
+ Number.NaN,
+ Math.tan(void 0));
- array[item++] = new TestCase( SECTION, "Math.tan()", Number.NaN, Math.tan() );
- array[item++] = new TestCase( SECTION, "Math.tan(void 0)", Number.NaN, Math.tan(void 0));
- array[item++] = new TestCase( SECTION, "Math.tan(null)", 0, Math.tan(null) );
- array[item++] = new TestCase( SECTION, "Math.tan(false)", 0, Math.tan(false) );
+new TestCase( SECTION,
+ "Math.tan(null)",
+ 0,
+ Math.tan(null) );
- array[item++] = new TestCase( SECTION, "Math.tan(NaN)", Number.NaN, Math.tan(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.tan(0)", 0, Math.tan(0));
- array[item++] = new TestCase( SECTION, "Math.tan(-0)", -0, Math.tan(-0));
- array[item++] = new TestCase( SECTION, "Math.tan(Infinity)", Number.NaN, Math.tan(Number.POSITIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.tan(-Infinity)", Number.NaN, Math.tan(Number.NEGATIVE_INFINITY));
- array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/4)", 1, Math.tan(Math.PI/4));
- array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/4)", -1, Math.tan(3*Math.PI/4));
- array[item++] = new TestCase( SECTION, "Math.tan(Math.PI)", -0, Math.tan(Math.PI));
- array[item++] = new TestCase( SECTION, "Math.tan(5*Math.PI/4)", 1, Math.tan(5*Math.PI/4));
- array[item++] = new TestCase( SECTION, "Math.tan(7*Math.PI/4)", -1, Math.tan(7*Math.PI/4));
- array[item++] = new TestCase( SECTION, "Infinity/Math.tan(-0)", -Infinity, Infinity/Math.tan(-0) );
+new TestCase( SECTION,
+ "Math.tan(false)",
+ 0,
+ Math.tan(false) );
+
+new TestCase( SECTION,
+ "Math.tan(NaN)",
+ Number.NaN,
+ Math.tan(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.tan(0)",
+ 0,
+ Math.tan(0));
+
+new TestCase( SECTION,
+ "Math.tan(-0)",
+ -0,
+ Math.tan(-0));
+
+new TestCase( SECTION,
+ "Math.tan(Infinity)",
+ Number.NaN,
+ Math.tan(Number.POSITIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.tan(-Infinity)",
+ Number.NaN,
+ Math.tan(Number.NEGATIVE_INFINITY));
+
+new TestCase( SECTION,
+ "Math.tan(Math.PI/4)",
+ 1,
+ Math.tan(Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(3*Math.PI/4)",
+ -1,
+ Math.tan(3*Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(Math.PI)",
+ -0,
+ Math.tan(Math.PI));
+
+new TestCase( SECTION,
+ "Math.tan(5*Math.PI/4)",
+ 1,
+ Math.tan(5*Math.PI/4));
+
+new TestCase( SECTION,
+ "Math.tan(7*Math.PI/4)",
+ -1,
+ Math.tan(7*Math.PI/4));
+
+new TestCase( SECTION,
+ "Infinity/Math.tan(-0)",
+ -Infinity,
+ Infinity/Math.tan(-0) );
/*
- Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2.
- That is to say, perturbing PI/2 by this much is about the smallest rounding error possible.
+ Arctan (x) ~ PI/2 - 1/x for large x. For x = 1.6x10^16, 1/x is about the last binary digit of double precision PI/2.
+ That is to say, perturbing PI/2 by this much is about the smallest rounding error possible.
- This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I
- suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest
- results to infinity that the algorithm can deliver.
+ This suggests that the answer Christine is getting and a real Infinity are "adjacent" results from the tangent function. I
+ suspect that tan (PI/2 + one ulp) is a negative result about the same size as tan (PI/2) and that this pair are the closest
+ results to infinity that the algorithm can deliver.
- In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger.
- = C =
+ In any case, my call is that the answer we're seeing is "right". I suggest the test pass on any result this size or larger.
+ = C =
*/
- array[item++] = new TestCase( SECTION, "Math.tan(3*Math.PI/2) >= 5443000000000000", true, Math.tan(3*Math.PI/2) >= 5443000000000000 );
- array[item++] = new TestCase( SECTION, "Math.tan(Math.PI/2) >= 5443000000000000", true, Math.tan(Math.PI/2) >= 5443000000000000 );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.tan(3*Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(3*Math.PI/2) >= 5443000000000000 );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.tan(Math.PI/2) >= 5443000000000000",
+ true,
+ Math.tan(Math.PI/2) >= 5443000000000000 );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.2.js b/mozilla/js/tests/ecma/Math/15.8.2.2.js
index e59b5ef66c1..3e4d6851bb5 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.2.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,114 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.2.2.js
- ECMA Section: 15.8.2.2 acos( x )
- Description: return an approximation to the arc cosine of the
- argument. the result is expressed in radians and
- range is from +0 to +PI. special cases:
- - if x is NaN, return NaN
- - if x > 1, the result is NaN
- - if x < -1, the result is NaN
- - if x == 1, the result is +0
- Author: christine@netscape.com
- Date: 7 july 1997
-*/
- var SECTION = "15.8.2.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.acos()";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Math.acos.length", 1, Math.acos.length );
-
- array[item++] = new TestCase( SECTION, "Math.acos(void 0)", Number.NaN, Math.acos(void 0) );
- array[item++] = new TestCase( SECTION, "Math.acos()", Number.NaN, Math.acos() );
- array[item++] = new TestCase( SECTION, "Math.acos(null)", Math.PI/2, Math.acos(null) );
- array[item++] = new TestCase( SECTION, "Math.acos(NaN)", Number.NaN, Math.acos(Number.NaN) );
-
- array[item++] = new TestCase( SECTION, "Math.acos(a string)", Number.NaN, Math.acos("a string") );
- array[item++] = new TestCase( SECTION, "Math.acos('0')", Math.PI/2, Math.acos('0') );
- array[item++] = new TestCase( SECTION, "Math.acos('1')", 0, Math.acos('1') );
- array[item++] = new TestCase( SECTION, "Math.acos('-1')", Math.PI, Math.acos('-1') );
-
- array[item++] = new TestCase( SECTION, "Math.acos(1.00000001)", Number.NaN, Math.acos(1.00000001) );
- array[item++] = new TestCase( SECTION, "Math.acos(11.00000001)", Number.NaN, Math.acos(-1.00000001) );
- array[item++] = new TestCase( SECTION, "Math.acos(1)", 0, Math.acos(1) );
- array[item++] = new TestCase( SECTION, "Math.acos(-1)", Math.PI, Math.acos(-1) );
- array[item++] = new TestCase( SECTION, "Math.acos(0)", Math.PI/2, Math.acos(0) );
- array[item++] = new TestCase( SECTION, "Math.acos(-0)", Math.PI/2, Math.acos(-0) );
- array[item++] = new TestCase( SECTION, "Math.acos(Math.SQRT1_2)", Math.PI/4, Math.acos(Math.SQRT1_2));
- array[item++] = new TestCase( SECTION, "Math.acos(-Math.SQRT1_2)", Math.PI/4*3, Math.acos(-Math.SQRT1_2));
- array[item++] = new TestCase( SECTION, "Math.acos(0.9999619230642)", Math.PI/360, Math.acos(0.9999619230642));
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.2.2.js
+ ECMA Section: 15.8.2.2 acos( x )
+ Description: return an approximation to the arc cosine of the
+ argument. the result is expressed in radians and
+ range is from +0 to +PI. special cases:
+ - if x is NaN, return NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == 1, the result is +0
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.acos()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.acos.length",
+ 1,
+ Math.acos.length );
+
+new TestCase( SECTION,
+ "Math.acos(void 0)",
+ Number.NaN,
+ Math.acos(void 0) );
+
+new TestCase( SECTION,
+ "Math.acos()",
+ Number.NaN,
+ Math.acos() );
+
+new TestCase( SECTION,
+ "Math.acos(null)",
+ Math.PI/2,
+ Math.acos(null) );
+
+new TestCase( SECTION,
+ "Math.acos(NaN)",
+ Number.NaN,
+ Math.acos(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.acos(a string)",
+ Number.NaN,
+ Math.acos("a string") );
+
+new TestCase( SECTION,
+ "Math.acos('0')",
+ Math.PI/2,
+ Math.acos('0') );
+
+new TestCase( SECTION,
+ "Math.acos('1')",
+ 0,
+ Math.acos('1') );
+
+new TestCase( SECTION,
+ "Math.acos('-1')",
+ Math.PI,
+ Math.acos('-1') );
+
+new TestCase( SECTION,
+ "Math.acos(1.00000001)",
+ Number.NaN,
+ Math.acos(1.00000001) );
+
+new TestCase( SECTION,
+ "Math.acos(11.00000001)",
+ Number.NaN,
+ Math.acos(-1.00000001) );
+
+new TestCase( SECTION,
+ "Math.acos(1)",
+ 0,
+ Math.acos(1) );
+
+new TestCase( SECTION,
+ "Math.acos(-1)",
+ Math.PI,
+ Math.acos(-1) );
+
+new TestCase( SECTION,
+ "Math.acos(0)",
+ Math.PI/2,
+ Math.acos(0) );
+
+new TestCase( SECTION,
+ "Math.acos(-0)",
+ Math.PI/2,
+ Math.acos(-0) );
+
+new TestCase( SECTION,
+ "Math.acos(Math.SQRT1_2)",
+ Math.PI/4,
+ Math.acos(Math.SQRT1_2));
+
+new TestCase( SECTION,
+ "Math.acos(-Math.SQRT1_2)",
+ Math.PI/4*3,
+ Math.acos(-Math.SQRT1_2));
+
+new TestCase( SECTION,
+ "Math.acos(0.9999619230642)",
+ Math.PI/360,
+ Math.acos(0.9999619230642));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.3.js b/mozilla/js/tests/ecma/Math/15.8.2.3.js
index f9b751608e1..2e9e1a68660 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.3.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,122 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.3.js
- ECMA Section: 15.8.2.3 asin( x )
- Description: return an approximation to the arc sine of the
- argument. the result is expressed in radians and
- range is from -PI/2 to +PI/2. special cases:
- - if x is NaN, the result is NaN
- - if x > 1, the result is NaN
- - if x < -1, the result is NaN
- - if x == +0, the result is +0
- - if x == -0, the result is -0
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.3.js
+ ECMA Section: 15.8.2.3 asin( x )
+ Description: return an approximation to the arc sine of the
+ argument. the result is expressed in radians and
+ range is from -PI/2 to +PI/2. special cases:
+ - if x is NaN, the result is NaN
+ - if x > 1, the result is NaN
+ - if x < -1, the result is NaN
+ - if x == +0, the result is +0
+ - if x == -0, the result is -0
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.asin()";
+var SECTION = "15.8.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.asin()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.asin()",
+ Number.NaN,
+ Math.asin() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.asin(void 0)",
+ Number.NaN,
+ Math.asin(void 0) );
- array[item++] = new TestCase( SECTION, "Math.asin()", Number.NaN, Math.asin() );
- array[item++] = new TestCase( SECTION, "Math.asin(void 0)", Number.NaN, Math.asin(void 0) );
- array[item++] = new TestCase( SECTION, "Math.asin(null)", 0, Math.asin(null) );
- array[item++] = new TestCase( SECTION, "Math.asin(NaN)", Number.NaN, Math.asin(Number.NaN) );
+new TestCase( SECTION,
+ "Math.asin(null)",
+ 0,
+ Math.asin(null) );
- array[item++] = new TestCase( SECTION, "Math.asin('string')", Number.NaN, Math.asin("string") );
- array[item++] = new TestCase( SECTION, "Math.asin('0')", 0, Math.asin("0") );
- array[item++] = new TestCase( SECTION, "Math.asin('1')", Math.PI/2, Math.asin("1") );
- array[item++] = new TestCase( SECTION, "Math.asin('-1')", -Math.PI/2, Math.asin("-1") );
- array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2+'')", Math.PI/4, Math.asin(Math.SQRT1_2+'') );
- array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2+'')", -Math.PI/4, Math.asin(-Math.SQRT1_2+'') );
+new TestCase( SECTION,
+ "Math.asin(NaN)",
+ Number.NaN,
+ Math.asin(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.asin(1.000001)", Number.NaN, Math.asin(1.000001) );
- array[item++] = new TestCase( SECTION, "Math.asin(-1.000001)", Number.NaN, Math.asin(-1.000001) );
- array[item++] = new TestCase( SECTION, "Math.asin(0)", 0, Math.asin(0) );
- array[item++] = new TestCase( SECTION, "Math.asin(-0)", -0, Math.asin(-0) );
+new TestCase( SECTION,
+ "Math.asin('string')",
+ Number.NaN,
+ Math.asin("string") );
- array[item++] = new TestCase( SECTION, "Infinity/Math.asin(-0)", -Infinity, Infinity/Math.asin(-0) );
+new TestCase( SECTION,
+ "Math.asin('0')",
+ 0,
+ Math.asin("0") );
- array[item++] = new TestCase( SECTION, "Math.asin(1)", Math.PI/2, Math.asin(1) );
- array[item++] = new TestCase( SECTION, "Math.asin(-1)", -Math.PI/2, Math.asin(-1) );
- array[item++] = new TestCase( SECTION, "Math.asin(Math.SQRT1_2))", Math.PI/4, Math.asin(Math.SQRT1_2) );
- array[item++] = new TestCase( SECTION, "Math.asin(-Math.SQRT1_2))", -Math.PI/4, Math.asin(-Math.SQRT1_2));
+new TestCase( SECTION,
+ "Math.asin('1')",
+ Math.PI/2,
+ Math.asin("1") );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.asin('-1')",
+ -Math.PI/2,
+ Math.asin("-1") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.asin(Math.SQRT1_2+'')",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2+'') );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.asin(-Math.SQRT1_2+'')",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2+'') );
+
+new TestCase( SECTION,
+ "Math.asin(1.000001)",
+ Number.NaN,
+ Math.asin(1.000001) );
+
+new TestCase( SECTION,
+ "Math.asin(-1.000001)",
+ Number.NaN,
+ Math.asin(-1.000001) );
+
+new TestCase( SECTION,
+ "Math.asin(0)",
+ 0,
+ Math.asin(0) );
+
+new TestCase( SECTION,
+ "Math.asin(-0)",
+ -0,
+ Math.asin(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.asin(-0)",
+ -Infinity,
+ Infinity/Math.asin(-0) );
+
+new TestCase( SECTION,
+ "Math.asin(1)",
+ Math.PI/2,
+ Math.asin(1) );
+
+new TestCase( SECTION,
+ "Math.asin(-1)",
+ -Math.PI/2,
+ Math.asin(-1) );
+
+new TestCase( SECTION,
+ "Math.asin(Math.SQRT1_2))",
+ Math.PI/4,
+ Math.asin(Math.SQRT1_2) );
+
+new TestCase( SECTION,
+ "Math.asin(-Math.SQRT1_2))",
+ -Math.PI/4,
+ Math.asin(-Math.SQRT1_2));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.4.js b/mozilla/js/tests/ecma/Math/15.8.2.4.js
index 0643ba76e20..043ebaf5b68 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.4.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -50,54 +51,102 @@
*/
- var SECTION = "15.8.2.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.atan()";
- var BUGNUMBER="77391";
+var SECTION = "15.8.2.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.atan()";
+var BUGNUMBER="77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.atan.length",
+ 1,
+ Math.atan.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.atan()",
+ Number.NaN,
+ Math.atan() );
- array[item++] = new TestCase( SECTION, "Math.atan.length", 1, Math.atan.length );
+new TestCase( SECTION,
+ "Math.atan(void 0)",
+ Number.NaN,
+ Math.atan(void 0) );
- array[item++] = new TestCase( SECTION, "Math.atan()", Number.NaN, Math.atan() );
- array[item++] = new TestCase( SECTION, "Math.atan(void 0)", Number.NaN, Math.atan(void 0) );
- array[item++] = new TestCase( SECTION, "Math.atan(null)", 0, Math.atan(null) );
- array[item++] = new TestCase( SECTION, "Math.atan(NaN)", Number.NaN, Math.atan(Number.NaN) );
+new TestCase( SECTION,
+ "Math.atan(null)",
+ 0,
+ Math.atan(null) );
- array[item++] = new TestCase( SECTION, "Math.atan('a string')", Number.NaN, Math.atan("a string") );
- array[item++] = new TestCase( SECTION, "Math.atan('0')", 0, Math.atan('0') );
- array[item++] = new TestCase( SECTION, "Math.atan('1')", Math.PI/4, Math.atan('1') );
- array[item++] = new TestCase( SECTION, "Math.atan('-1')", -Math.PI/4, Math.atan('-1') );
- array[item++] = new TestCase( SECTION, "Math.atan('Infinity)", Math.PI/2, Math.atan('Infinity') );
- array[item++] = new TestCase( SECTION, "Math.atan('-Infinity)", -Math.PI/2, Math.atan('-Infinity') );
+new TestCase( SECTION,
+ "Math.atan(NaN)",
+ Number.NaN,
+ Math.atan(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.atan(0)", 0, Math.atan(0) );
- array[item++] = new TestCase( SECTION, "Math.atan(-0)", -0, Math.atan(-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.atan(-0)", -Infinity, Infinity/Math.atan(-0) );
- array[item++] = new TestCase( SECTION, "Math.atan(Infinity)", Math.PI/2, Math.atan(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan(-Infinity)", -Math.PI/2, Math.atan(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan(1)", Math.PI/4, Math.atan(1) );
- array[item++] = new TestCase( SECTION, "Math.atan(-1)", -Math.PI/4, Math.atan(-1) );
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.atan('a string')",
+ Number.NaN,
+ Math.atan("a string") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.atan('0')",
+ 0,
+ Math.atan('0') );
+
+new TestCase( SECTION,
+ "Math.atan('1')",
+ Math.PI/4,
+ Math.atan('1') );
+
+new TestCase( SECTION,
+ "Math.atan('-1')",
+ -Math.PI/4,
+ Math.atan('-1') );
+
+new TestCase( SECTION,
+ "Math.atan('Infinity)",
+ Math.PI/2,
+ Math.atan('Infinity') );
+
+new TestCase( SECTION,
+ "Math.atan('-Infinity)",
+ -Math.PI/2,
+ Math.atan('-Infinity') );
+
+new TestCase( SECTION,
+ "Math.atan(0)",
+ 0,
+ Math.atan(0) );
+
+new TestCase( SECTION,
+ "Math.atan(-0)",
+ -0,
+ Math.atan(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan(-0)",
+ -Infinity,
+ Infinity/Math.atan(-0) );
+
+new TestCase( SECTION,
+ "Math.atan(Infinity)",
+ Math.PI/2,
+ Math.atan(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan(-Infinity)",
+ -Math.PI/2,
+ Math.atan(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan(1)",
+ Math.PI/4,
+ Math.atan(1) );
+
+new TestCase( SECTION,
+ "Math.atan(-1)",
+ -Math.PI/4,
+ Math.atan(-1) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.5.js b/mozilla/js/tests/ecma/Math/15.8.2.5.js
index 84ced54cbd0..a89c729a9ed 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.5.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,207 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.2.5.js
- ECMA Section: 15.8.2.5 atan2( y, x )
- Description:
- Author: christine@netscape.com
- Date: 7 july 1997
+/**
+ File Name: 15.8.2.5.js
+ ECMA Section: 15.8.2.5 atan2( y, x )
+ Description:
+
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.atan2(x,y)";
- var BUGNUMBER="76111";
+var SECTION = "15.8.2.5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.atan2(x,y)";
+var BUGNUMBER="76111";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.atan2.length",
+ 2,
+ Math.atan2.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.atan2(NaN, 0)",
+ Number.NaN,
+ Math.atan2(Number.NaN,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2.length", 2, Math.atan2.length );
+new TestCase( SECTION,
+ "Math.atan2(null, null)",
+ 0,
+ Math.atan2(null, null) );
- array[item++] = new TestCase( SECTION, "Math.atan2(NaN, 0)", Number.NaN, Math.atan2(Number.NaN,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(null, null)", 0, Math.atan2(null, null) );
- array[item++] = new TestCase( SECTION, "Math.atan2(void 0, void 0)", Number.NaN, Math.atan2(void 0, void 0) );
- array[item++] = new TestCase( SECTION, "Math.atan2()", Number.NaN, Math.atan2() );
+new TestCase( SECTION,
+ "Math.atan2(void 0, void 0)",
+ Number.NaN,
+ Math.atan2(void 0, void 0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(0, NaN)", Number.NaN, Math.atan2(0,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.atan2(1, 0)", Math.PI/2, Math.atan2(1,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(1,-0)", Math.PI/2, Math.atan2(1,-0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(0,0.001)", 0, Math.atan2(0,0.001) );
- array[item++] = new TestCase( SECTION, "Math.atan2(0,0)", 0, Math.atan2(0,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(0, -0)", Math.PI, Math.atan2(0,-0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(0, -1)", Math.PI, Math.atan2(0, -1) );
+new TestCase( SECTION,
+ "Math.atan2()",
+ Number.NaN,
+ Math.atan2() );
- array[item++] = new TestCase( SECTION, "Math.atan2(-0, 1)", -0, Math.atan2(-0, 1) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-0, 1)", -Infinity, Infinity/Math.atan2(-0,1) );
+new TestCase( SECTION,
+ "Math.atan2(0, NaN)",
+ Number.NaN,
+ Math.atan2(0,Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-0, 0)", -0, Math.atan2(-0,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-0, -0)", -Math.PI, Math.atan2(-0, -0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-0, -1)", -Math.PI, Math.atan2(-0, -1) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-1, 0)", -Math.PI/2, Math.atan2(-1, 0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-1, -0)", -Math.PI/2, Math.atan2(-1, -0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(1, Infinity)", 0, Math.atan2(1, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(1,-Infinity)", Math.PI, Math.atan2(1, Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.atan2(1, 0)",
+ Math.PI/2,
+ Math.atan2(1,0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-1, Infinity)", -0, Math.atan2(-1,Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.atan2(-1, Infinity)", -Infinity, Infinity/Math.atan2(-1,Infinity) );
+new TestCase( SECTION,
+ "Math.atan2(1,-0)",
+ Math.PI/2,
+ Math.atan2(1,-0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-1,-Infinity)", -Math.PI, Math.atan2(-1,Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, 1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY, 1) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-1)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-1) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity,-0)", Math.PI/2, Math.atan2(Number.POSITIVE_INFINITY,-0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity,-0)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-0) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, 1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY, 1) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -1)", -Math.PI/2, Math.atan2(Number.NEGATIVE_INFINITY,-1) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, Infinity)", Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(Infinity, -Infinity)", 3*Math.PI/4, Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, Infinity)", -Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-Infinity, -Infinity)", -3*Math.PI/4, Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.atan2(-1, 1)", -Math.PI/4, Math.atan2( -1, 1) );
+new TestCase( SECTION,
+ "Math.atan2(0,0.001)",
+ 0,
+ Math.atan2(0,0.001) );
- return array;
-}
+new TestCase( SECTION,
+ "Math.atan2(0,0)",
+ 0,
+ Math.atan2(0,0) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.atan2(0, -0)",
+ Math.PI,
+ Math.atan2(0,-0) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.atan2(0, -1)",
+ Math.PI,
+ Math.atan2(0, -1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, 1)",
+ -0,
+ Math.atan2(-0, 1) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan2(-0, 1)",
+ -Infinity,
+ Infinity/Math.atan2(-0,1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, 0)",
+ -0,
+ Math.atan2(-0,0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, -0)",
+ -Math.PI,
+ Math.atan2(-0, -0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-0, -1)",
+ -Math.PI,
+ Math.atan2(-0, -1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, 0)",
+ -Math.PI/2,
+ Math.atan2(-1, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, -0)",
+ -Math.PI/2,
+ Math.atan2(-1, -0) );
+
+new TestCase( SECTION,
+ "Math.atan2(1, Infinity)",
+ 0,
+ Math.atan2(1, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(1,-Infinity)",
+ Math.PI,
+ Math.atan2(1, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, Infinity)",
+ -0,
+ Math.atan2(-1,Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Infinity/Math.atan2(-1, Infinity)",
+ -Infinity,
+ Infinity/Math.atan2(-1,Infinity) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1,-Infinity)",
+ -Math.PI,
+ Math.atan2(-1,Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, 0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, 1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity,-1)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity,-0)",
+ Math.PI/2,
+ Math.atan2(Number.POSITIVE_INFINITY,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, 0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity,-0)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-0) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, 1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY, 1) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, -1)",
+ -Math.PI/2,
+ Math.atan2(Number.NEGATIVE_INFINITY,-1) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, Infinity)",
+ Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(Infinity, -Infinity)",
+ 3*Math.PI/4,
+ Math.atan2(Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, Infinity)",
+ -Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-Infinity, -Infinity)",
+ -3*Math.PI/4,
+ Math.atan2(Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.atan2(-1, 1)",
+ -Math.PI/4,
+ Math.atan2( -1, 1) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.6.js b/mozilla/js/tests/ecma/Math/15.8.2.6.js
index 48a6578dd93..1353c022b3e 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.6.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,90 +35,195 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.8.2.6.js
- ECMA Section: 15.8.2.6 Math.ceil(x)
- Description: return the smallest number value that is not less than the
- argument and is equal to a mathematical integer. if the
- number is already an integer, return the number itself.
- special cases:
- - if x is NaN return NaN
- - if x = +0 return +0
- - if x = 0 return -0
- - if x = Infinity return Infinity
- - if x = -Infinity return -Infinity
- - if ( -1 < x < 0 ) return -0
- also:
- - the value of Math.ceil(x) == -Math.ceil(-x)
- Author: christine@netscape.com
- Date: 7 july 1997
-*/
- var SECTION = "15.8.2.6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.ceil(x)";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Math.ceil.length", 1, Math.ceil.length );
-
- array[item++] = new TestCase( SECTION, "Math.ceil(NaN)", Number.NaN, Math.ceil(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.ceil(null)", 0, Math.ceil(null) );
- array[item++] = new TestCase( SECTION, "Math.ceil()", Number.NaN, Math.ceil() );
- array[item++] = new TestCase( SECTION, "Math.ceil(void 0)", Number.NaN, Math.ceil(void 0) );
-
- array[item++] = new TestCase( SECTION, "Math.ceil('0')", 0, Math.ceil('0') );
- array[item++] = new TestCase( SECTION, "Math.ceil('-0')", -0, Math.ceil('-0') );
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('0')", Infinity, Infinity/Math.ceil('0'));
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil('-0')", -Infinity, Infinity/Math.ceil('-0'));
-
- array[item++] = new TestCase( SECTION, "Math.ceil(0)", 0, Math.ceil(0) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-0)", -0, Math.ceil(-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(0)", Infinity, Infinity/Math.ceil(0));
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0)", -Infinity, Infinity/Math.ceil(-0));
-
- array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", Number.POSITIVE_INFINITY, Math.ceil(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", Number.NEGATIVE_INFINITY, Math.ceil(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -0, Math.ceil(-Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-Number.MIN_VALUE)", -Infinity, Infinity/Math.ceil(-Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "Math.ceil(1)", 1, Math.ceil(1) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -1, Math.ceil(-1) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -0, Math.ceil(-0.9) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.ceil(-0.9)", -Infinity, Infinity/Math.ceil(-0.9) );
- array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", 1, Math.ceil( 0.9) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -1, Math.ceil( -1.1));
- array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", 2, Math.ceil( 1.1));
-
- array[item++] = new TestCase( SECTION, "Math.ceil(Infinity)", -Math.floor(-Infinity), Math.ceil(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-Infinity)", -Math.floor(Infinity), Math.ceil(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-Number.MIN_VALUE)", -Math.floor(Number.MIN_VALUE), Math.ceil(-Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "Math.ceil(1)", -Math.floor(-1), Math.ceil(1) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-1)", -Math.floor(1), Math.ceil(-1) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-0.9)", -Math.floor(0.9), Math.ceil(-0.9) );
- array[item++] = new TestCase( SECTION, "Math.ceil(0.9 )", -Math.floor(-0.9), Math.ceil( 0.9) );
- array[item++] = new TestCase( SECTION, "Math.ceil(-1.1)", -Math.floor(1.1), Math.ceil( -1.1));
- array[item++] = new TestCase( SECTION, "Math.ceil( 1.1)", -Math.floor(-1.1), Math.ceil( 1.1));
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.8.2.6.js
+ ECMA Section: 15.8.2.6 Math.ceil(x)
+ Description: return the smallest number value that is not less than the
+ argument and is equal to a mathematical integer. if the
+ number is already an integer, return the number itself.
+ special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = 0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.ceil(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
+*/
+var SECTION = "15.8.2.6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.ceil(x)";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "Math.ceil.length",
+ 1,
+ Math.ceil.length );
+
+new TestCase( SECTION,
+ "Math.ceil(NaN)",
+ Number.NaN,
+ Math.ceil(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.ceil(null)",
+ 0,
+ Math.ceil(null) );
+
+new TestCase( SECTION,
+ "Math.ceil()",
+ Number.NaN,
+ Math.ceil() );
+
+new TestCase( SECTION,
+ "Math.ceil(void 0)",
+ Number.NaN,
+ Math.ceil(void 0) );
+
+new TestCase( SECTION,
+ "Math.ceil('0')",
+ 0,
+ Math.ceil('0') );
+
+new TestCase( SECTION,
+ "Math.ceil('-0')",
+ -0,
+ Math.ceil('-0') );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil('0')",
+ Infinity,
+ Infinity/Math.ceil('0'));
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil('-0')",
+ -Infinity,
+ Infinity/Math.ceil('-0'));
+
+new TestCase( SECTION,
+ "Math.ceil(0)",
+ 0,
+ Math.ceil(0) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0)",
+ -0,
+ Math.ceil(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(0)",
+ Infinity,
+ Infinity/Math.ceil(0));
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-0)",
+ -Infinity,
+ Infinity/Math.ceil(-0));
+
+
+new TestCase( SECTION,
+ "Math.ceil(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Number.MIN_VALUE)",
+ -0,
+ Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-Number.MIN_VALUE)",
+ -Infinity,
+ Infinity/Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Math.ceil(1)",
+ 1,
+ Math.ceil(1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1)",
+ -1,
+ Math.ceil(-1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0.9)",
+ -0,
+ Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Infinity/Math.ceil(-0.9)",
+ -Infinity,
+ Infinity/Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(0.9 )",
+ 1,
+ Math.ceil( 0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1.1)",
+ -1,
+ Math.ceil( -1.1));
+
+new TestCase( SECTION,
+ "Math.ceil( 1.1)",
+ 2,
+ Math.ceil( 1.1));
+
+new TestCase( SECTION,
+ "Math.ceil(Infinity)",
+ -Math.floor(-Infinity),
+ Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Infinity)",
+ -Math.floor(Infinity),
+ Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.ceil(-Number.MIN_VALUE)",
+ -Math.floor(Number.MIN_VALUE),
+ Math.ceil(-Number.MIN_VALUE) );
+
+new TestCase( SECTION,
+ "Math.ceil(1)",
+ -Math.floor(-1),
+ Math.ceil(1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1)",
+ -Math.floor(1),
+ Math.ceil(-1) );
+
+new TestCase( SECTION,
+ "Math.ceil(-0.9)",
+ -Math.floor(0.9),
+ Math.ceil(-0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(0.9 )",
+ -Math.floor(-0.9),
+ Math.ceil( 0.9) );
+
+new TestCase( SECTION,
+ "Math.ceil(-1.1)",
+ -Math.floor(1.1),
+ Math.ceil( -1.1));
+
+new TestCase( SECTION,
+ "Math.ceil( 1.1)",
+ -Math.floor(-1.1),
+ Math.ceil( 1.1));
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.7.js b/mozilla/js/tests/ecma/Math/15.8.2.7.js
index 3b1d0fe8cd1..89b1f98d43d 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.7.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,247 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.7.js
- ECMA Section: 15.8.2.7 cos( x )
- Description: return an approximation to the cosine of the
- argument. argument is expressed in radians
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.7.js
+ ECMA Section: 15.8.2.7 cos( x )
+ Description: return an approximation to the cosine of the
+ argument. argument is expressed in radians
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.cos(x)";
+var SECTION = "15.8.2.7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.cos(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.cos.length",
+ 1,
+ Math.cos.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.cos()",
+ Number.NaN,
+ Math.cos() );
- array[item++] = new TestCase( SECTION, "Math.cos.length", 1, Math.cos.length );
+new TestCase( SECTION,
+ "Math.cos(void 0)",
+ Number.NaN,
+ Math.cos(void 0) );
- array[item++] = new TestCase( SECTION, "Math.cos()", Number.NaN, Math.cos() );
- array[item++] = new TestCase( SECTION, "Math.cos(void 0)", Number.NaN, Math.cos(void 0) );
- array[item++] = new TestCase( SECTION, "Math.cos(false)", 1, Math.cos(false) );
- array[item++] = new TestCase( SECTION, "Math.cos(null)", 1, Math.cos(null) );
+new TestCase( SECTION,
+ "Math.cos(false)",
+ 1,
+ Math.cos(false) );
- array[item++] = new TestCase( SECTION, "Math.cos('0')", 1, Math.cos('0') );
- array[item++] = new TestCase( SECTION, "Math.cos('Infinity')", Number.NaN, Math.cos("Infinity") );
- array[item++] = new TestCase( SECTION, "Math.cos('3.14159265359')", -1, Math.cos('3.14159265359') );
+new TestCase( SECTION,
+ "Math.cos(null)",
+ 1,
+ Math.cos(null) );
- array[item++] = new TestCase( SECTION, "Math.cos(NaN)", Number.NaN, Math.cos(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.cos(0)", 1, Math.cos(0) );
- array[item++] = new TestCase( SECTION, "Math.cos(-0)", 1, Math.cos(-0) );
- array[item++] = new TestCase( SECTION, "Math.cos(Infinity)", Number.NaN, Math.cos(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.cos(-Infinity)", Number.NaN, Math.cos(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.cos(0.7853981633974)", 0.7071067811865, Math.cos(0.7853981633974) );
- array[item++] = new TestCase( SECTION, "Math.cos(1.570796326795)", 0, Math.cos(1.570796326795) );
- array[item++] = new TestCase( SECTION, "Math.cos(2.356194490192)", -0.7071067811865, Math.cos(2.356194490192) );
- array[item++] = new TestCase( SECTION, "Math.cos(3.14159265359)", -1, Math.cos(3.14159265359) );
- array[item++] = new TestCase( SECTION, "Math.cos(3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) );
- array[item++] = new TestCase( SECTION, "Math.cos(4.712388980385)", 0, Math.cos(4.712388980385) );
- array[item++] = new TestCase( SECTION, "Math.cos(5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) );
- array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(Math.PI*2) );
- array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/4)", Math.SQRT2/2, Math.cos(Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(Math.PI/2)", 0, Math.cos(Math.PI/2) );
- array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/4)", -Math.SQRT2/2, Math.cos(3*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(Math.PI)", -1, Math.cos(Math.PI) );
- array[item++] = new TestCase( SECTION, "Math.cos(5*Math.PI/4)", -Math.SQRT2/2, Math.cos(5*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(3*Math.PI/2)", 0, Math.cos(3*Math.PI/2) );
- array[item++] = new TestCase( SECTION, "Math.cos(7*Math.PI/4)", Math.SQRT2/2, Math.cos(7*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(Math.PI*2)", 1, Math.cos(2*Math.PI) );
- array[item++] = new TestCase( SECTION, "Math.cos(-0.7853981633974)", 0.7071067811865, Math.cos(-0.7853981633974) );
- array[item++] = new TestCase( SECTION, "Math.cos(-1.570796326795)", 0, Math.cos(-1.570796326795) );
- array[item++] = new TestCase( SECTION, "Math.cos(-2.3561944901920)", -.7071067811865, Math.cos(2.3561944901920) );
- array[item++] = new TestCase( SECTION, "Math.cos(-3.14159265359)", -1, Math.cos(3.14159265359) );
- array[item++] = new TestCase( SECTION, "Math.cos(-3.926990816987)", -0.7071067811865, Math.cos(3.926990816987) );
- array[item++] = new TestCase( SECTION, "Math.cos(-4.712388980385)", 0, Math.cos(4.712388980385) );
- array[item++] = new TestCase( SECTION, "Math.cos(-5.497787143782)", 0.7071067811865, Math.cos(5.497787143782) );
- array[item++] = new TestCase( SECTION, "Math.cos(-6.28318530718)", 1, Math.cos(6.28318530718) );
- array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/4)", Math.SQRT2/2, Math.cos(-Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI/2)", 0, Math.cos(-Math.PI/2) );
- array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/4)", -Math.SQRT2/2, Math.cos(-3*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI)", -1, Math.cos(-Math.PI) );
- array[item++] = new TestCase( SECTION, "Math.cos(-5*Math.PI/4)", -Math.SQRT2/2, Math.cos(-5*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(-3*Math.PI/2)", 0, Math.cos(-3*Math.PI/2) );
- array[item++] = new TestCase( SECTION, "Math.cos(-7*Math.PI/4)", Math.SQRT2/2, Math.cos(-7*Math.PI/4) );
- array[item++] = new TestCase( SECTION, "Math.cos(-Math.PI*2)", 1, Math.cos(-Math.PI*2) );
+new TestCase( SECTION,
+ "Math.cos('0')",
+ 1,
+ Math.cos('0') );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.cos('Infinity')",
+ Number.NaN,
+ Math.cos("Infinity") );
+new TestCase( SECTION,
+ "Math.cos('3.14159265359')",
+ -1,
+ Math.cos('3.14159265359') );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.cos(NaN)",
+ Number.NaN,
+ Math.cos(Number.NaN) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.cos(0)",
+ 1,
+ Math.cos(0) );
+
+new TestCase( SECTION,
+ "Math.cos(-0)",
+ 1,
+ Math.cos(-0) );
+
+new TestCase( SECTION,
+ "Math.cos(Infinity)",
+ Number.NaN,
+ Math.cos(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.cos(-Infinity)",
+ Number.NaN,
+ Math.cos(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.cos(0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(0.7853981633974) );
+
+new TestCase( SECTION,
+ "Math.cos(1.570796326795)",
+ 0,
+ Math.cos(1.570796326795) );
+
+new TestCase( SECTION,
+ "Math.cos(2.356194490192)",
+ -0.7071067811865,
+ Math.cos(2.356194490192) );
+
+new TestCase( SECTION,
+ "Math.cos(3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase( SECTION,
+ "Math.cos(3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase( SECTION,
+ "Math.cos(4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase( SECTION,
+ "Math.cos(5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(Math.PI*2) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI/2)",
+ 0,
+ Math.cos(Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(3*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI)",
+ -1,
+ Math.cos(Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(5*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(3*Math.PI/2)",
+ 0,
+ Math.cos(3*Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(7*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(Math.PI*2)",
+ 1,
+ Math.cos(2*Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(-0.7853981633974)",
+ 0.7071067811865,
+ Math.cos(-0.7853981633974) );
+
+new TestCase( SECTION,
+ "Math.cos(-1.570796326795)",
+ 0,
+ Math.cos(-1.570796326795) );
+
+new TestCase( SECTION,
+ "Math.cos(-2.3561944901920)",
+ -.7071067811865,
+ Math.cos(2.3561944901920) );
+
+new TestCase( SECTION,
+ "Math.cos(-3.14159265359)",
+ -1,
+ Math.cos(3.14159265359) );
+
+new TestCase( SECTION,
+ "Math.cos(-3.926990816987)",
+ -0.7071067811865,
+ Math.cos(3.926990816987) );
+
+new TestCase( SECTION,
+ "Math.cos(-4.712388980385)",
+ 0,
+ Math.cos(4.712388980385) );
+
+new TestCase( SECTION,
+ "Math.cos(-5.497787143782)",
+ 0.7071067811865,
+ Math.cos(5.497787143782) );
+
+new TestCase( SECTION,
+ "Math.cos(-6.28318530718)",
+ 1,
+ Math.cos(6.28318530718) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI/2)",
+ 0,
+ Math.cos(-Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(-3*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-3*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI)",
+ -1,
+ Math.cos(-Math.PI) );
+
+new TestCase( SECTION,
+ "Math.cos(-5*Math.PI/4)",
+ -Math.SQRT2/2,
+ Math.cos(-5*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-3*Math.PI/2)",
+ 0,
+ Math.cos(-3*Math.PI/2) );
+
+new TestCase( SECTION,
+ "Math.cos(-7*Math.PI/4)",
+ Math.SQRT2/2,
+ Math.cos(-7*Math.PI/4) );
+
+new TestCase( SECTION,
+ "Math.cos(-Math.PI*2)",
+ 1,
+ Math.cos(-Math.PI*2) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.8.js b/mozilla/js/tests/ecma/Math/15.8.2.8.js
index d3d20bc937f..79cc451cec6 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.8.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,66 +35,98 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.8.js
- ECMA Section: 15.8.2.8 Math.exp(x)
- Description: return an approximation to the exponential function of
- the argument (e raised to the power of the argument)
- special cases:
- - if x is NaN return NaN
- - if x is 0 return 1
- - if x is -0 return 1
- - if x is Infinity return Infinity
- - if x is -Infinity return 0
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.8.js
+ ECMA Section: 15.8.2.8 Math.exp(x)
+ Description: return an approximation to the exponential function of
+ the argument (e raised to the power of the argument)
+ special cases:
+ - if x is NaN return NaN
+ - if x is 0 return 1
+ - if x is -0 return 1
+ - if x is Infinity return Infinity
+ - if x is -Infinity return 0
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.exp(x)";
+var SECTION = "15.8.2.8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.exp(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.exp.length",
+ 1,
+ Math.exp.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.exp()",
+ Number.NaN,
+ Math.exp() );
- array[item++] = new TestCase( SECTION, "Math.exp.length", 1, Math.exp.length );
+new TestCase( SECTION,
+ "Math.exp(null)",
+ 1,
+ Math.exp(null) );
- array[item++] = new TestCase( SECTION, "Math.exp()", Number.NaN, Math.exp() );
- array[item++] = new TestCase( SECTION, "Math.exp(null)", 1, Math.exp(null) );
- array[item++] = new TestCase( SECTION, "Math.exp(void 0)", Number.NaN, Math.exp(void 0) );
- array[item++] = new TestCase( SECTION, "Math.exp(1)", Math.E, Math.exp(1) );
- array[item++] = new TestCase( SECTION, "Math.exp(true)", Math.E, Math.exp(true) );
- array[item++] = new TestCase( SECTION, "Math.exp(false)", 1, Math.exp(false) );
+new TestCase( SECTION,
+ "Math.exp(void 0)",
+ Number.NaN,
+ Math.exp(void 0) );
- array[item++] = new TestCase( SECTION, "Math.exp('1')", Math.E, Math.exp('1') );
- array[item++] = new TestCase( SECTION, "Math.exp('0')", 1, Math.exp('0') );
+new TestCase( SECTION,
+ "Math.exp(1)",
+ Math.E,
+ Math.exp(1) );
- array[item++] = new TestCase( SECTION, "Math.exp(NaN)", Number.NaN, Math.exp(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.exp(0)", 1, Math.exp(0) );
- array[item++] = new TestCase( SECTION, "Math.exp(-0)", 1, Math.exp(-0) );
- array[item++] = new TestCase( SECTION, "Math.exp(Infinity)", Number.POSITIVE_INFINITY, Math.exp(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.exp(-Infinity)", 0, Math.exp(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.exp(true)",
+ Math.E,
+ Math.exp(true) );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.exp(false)",
+ 1,
+ Math.exp(false) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Math.exp('1')",
+ Math.E,
+ Math.exp('1') );
+
+new TestCase( SECTION,
+ "Math.exp('0')",
+ 1,
+ Math.exp('0') );
+
+new TestCase( SECTION,
+ "Math.exp(NaN)",
+ Number.NaN,
+ Math.exp(Number.NaN) );
+
+new TestCase( SECTION,
+ "Math.exp(0)",
+ 1,
+ Math.exp(0) );
+
+new TestCase( SECTION,
+ "Math.exp(-0)",
+ 1,
+ Math.exp(-0) );
+
+new TestCase( SECTION,
+ "Math.exp(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.exp(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.exp(-Infinity)",
+ 0,
+ Math.exp(Number.NEGATIVE_INFINITY) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/15.8.2.9.js b/mozilla/js/tests/ecma/Math/15.8.2.9.js
index 7edec78994c..11afe3cc527 100644
--- a/mozilla/js/tests/ecma/Math/15.8.2.9.js
+++ b/mozilla/js/tests/ecma/Math/15.8.2.9.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,155 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.8.2.9.js
- ECMA Section: 15.8.2.9 Math.floor(x)
- Description: return the greatest number value that is not greater
- than the argument and is equal to a mathematical integer.
- if the number is already an integer, return the number
- itself. special cases:
- - if x is NaN return NaN
- - if x = +0 return +0
- - if x = -0 return -0
- - if x = Infinity return Infinity
- - if x = -Infinity return -Infinity
- - if ( -1 < x < 0 ) return -0
- also:
- - the value of Math.floor(x) == -Math.ceil(-x)
- Author: christine@netscape.com
- Date: 7 july 1997
+ File Name: 15.8.2.9.js
+ ECMA Section: 15.8.2.9 Math.floor(x)
+ Description: return the greatest number value that is not greater
+ than the argument and is equal to a mathematical integer.
+ if the number is already an integer, return the number
+ itself. special cases:
+ - if x is NaN return NaN
+ - if x = +0 return +0
+ - if x = -0 return -0
+ - if x = Infinity return Infinity
+ - if x = -Infinity return -Infinity
+ - if ( -1 < x < 0 ) return -0
+ also:
+ - the value of Math.floor(x) == -Math.ceil(-x)
+ Author: christine@netscape.com
+ Date: 7 july 1997
*/
- var SECTION = "15.8.2.9";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Math.floor(x)";
+var SECTION = "15.8.2.9";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Math.floor(x)";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Math.floor.length",
+ 1,
+ Math.floor.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Math.floor()",
+ Number.NaN,
+ Math.floor() );
- array[item++] = new TestCase( SECTION, "Math.floor.length", 1, Math.floor.length );
+new TestCase( SECTION,
+ "Math.floor(void 0)",
+ Number.NaN,
+ Math.floor(void 0) );
- array[item++] = new TestCase( SECTION, "Math.floor()", Number.NaN, Math.floor() );
- array[item++] = new TestCase( SECTION, "Math.floor(void 0)", Number.NaN, Math.floor(void 0) );
- array[item++] = new TestCase( SECTION, "Math.floor(null)", 0, Math.floor(null) );
- array[item++] = new TestCase( SECTION, "Math.floor(true)", 1, Math.floor(true) );
- array[item++] = new TestCase( SECTION, "Math.floor(false)", 0, Math.floor(false) );
+new TestCase( SECTION,
+ "Math.floor(null)",
+ 0,
+ Math.floor(null) );
- array[item++] = new TestCase( SECTION, "Math.floor('1.1')", 1, Math.floor("1.1") );
- array[item++] = new TestCase( SECTION, "Math.floor('-1.1')", -2, Math.floor("-1.1") );
- array[item++] = new TestCase( SECTION, "Math.floor('0.1')", 0, Math.floor("0.1") );
- array[item++] = new TestCase( SECTION, "Math.floor('-0.1')", -1, Math.floor("-0.1") );
+new TestCase( SECTION,
+ "Math.floor(true)",
+ 1,
+ Math.floor(true) );
- array[item++] = new TestCase( SECTION, "Math.floor(NaN)", Number.NaN, Math.floor(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.floor(NaN)==-Math.ceil(-NaN)", false, Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) );
+new TestCase( SECTION,
+ "Math.floor(false)",
+ 0,
+ Math.floor(false) );
- array[item++] = new TestCase( SECTION, "Math.floor(0)", 0, Math.floor(0) );
- array[item++] = new TestCase( SECTION, "Math.floor(0)==-Math.ceil(-0)", true, Math.floor(0) == -Math.ceil(-0) );
+new TestCase( SECTION,
+ "Math.floor('1.1')",
+ 1,
+ Math.floor("1.1") );
- array[item++] = new TestCase( SECTION, "Math.floor(-0)", -0, Math.floor(-0) );
- array[item++] = new TestCase( SECTION, "Infinity/Math.floor(-0)", -Infinity, Infinity/Math.floor(-0) );
- array[item++] = new TestCase( SECTION, "Math.floor(-0)==-Math.ceil(0)", true, Math.floor(-0)== -Math.ceil(0) );
+new TestCase( SECTION,
+ "Math.floor('-1.1')",
+ -2,
+ Math.floor("-1.1") );
- array[item++] = new TestCase( SECTION, "Math.floor(Infinity)", Number.POSITIVE_INFINITY, Math.floor(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.floor(Infinity)==-Math.ceil(-Infinity)", true, Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.floor('0.1')",
+ 0,
+ Math.floor("0.1") );
- array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)", Number.NEGATIVE_INFINITY, Math.floor(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Math.floor(-Infinity)==-Math.ceil(Infinity)", true, Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION,
+ "Math.floor('-0.1')",
+ -1,
+ Math.floor("-0.1") );
- array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)", 0, Math.floor(0.0000001) );
- array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(0.0000001)==-Math.ceil(-0.0000001) );
+new TestCase( SECTION,
+ "Math.floor(NaN)",
+ Number.NaN,
+ Math.floor(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Math.floor(-0.0000001)", -1, Math.floor(-0.0000001) );
- array[item++] = new TestCase( SECTION, "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true, Math.floor(-0.0000001)==-Math.ceil(0.0000001) );
+new TestCase( SECTION,
+ "Math.floor(NaN)==-Math.ceil(-NaN)",
+ false,
+ Math.floor(Number.NaN) == -Math.ceil(-Number.NaN) );
- return ( array );
-}
+new TestCase( SECTION,
+ "Math.floor(0)",
+ 0,
+ Math.floor(0) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "Math.floor(0)==-Math.ceil(-0)",
+ true,
+ Math.floor(0) == -Math.ceil(-0) );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+new TestCase( SECTION,
+ "Math.floor(-0)",
+ -0,
+ Math.floor(-0) );
+
+new TestCase( SECTION,
+ "Infinity/Math.floor(-0)",
+ -Infinity,
+ Infinity/Math.floor(-0) );
+
+new TestCase( SECTION,
+ "Math.floor(-0)==-Math.ceil(0)",
+ true,
+ Math.floor(-0)== -Math.ceil(0) );
+
+new TestCase( SECTION,
+ "Math.floor(Infinity)",
+ Number.POSITIVE_INFINITY,
+ Math.floor(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(Infinity)==-Math.ceil(-Infinity)",
+ true,
+ Math.floor(Number.POSITIVE_INFINITY) == -Math.ceil(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(-Infinity)",
+ Number.NEGATIVE_INFINITY,
+ Math.floor(Number.NEGATIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(-Infinity)==-Math.ceil(Infinity)",
+ true,
+ Math.floor(Number.NEGATIVE_INFINITY) == -Math.ceil(Number.POSITIVE_INFINITY) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)",
+ 0,
+ Math.floor(0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)==-Math.ceil(0.0000001)", true,
+ Math.floor(0.0000001)==-Math.ceil(-0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(-0.0000001)",
+ -1,
+ Math.floor(-0.0000001) );
+
+new TestCase( SECTION,
+ "Math.floor(0.0000001)==-Math.ceil(0.0000001)",
+ true,
+ Math.floor(-0.0000001)==-Math.ceil(0.0000001) );
+
+test();
diff --git a/mozilla/js/tests/ecma/Math/browser.js b/mozilla/js/tests/ecma/Math/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Math/shell.js b/mozilla/js/tests/ecma/Math/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/NativeObjects/15-1.js b/mozilla/js/tests/ecma/NativeObjects/15-1.js
index 504526a6137..5c3c093f7ea 100644
--- a/mozilla/js/tests/ecma/NativeObjects/15-1.js
+++ b/mozilla/js/tests/ecma/NativeObjects/15-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,77 +35,58 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.js
- ECMA Section: 15 Native ECMAScript Objects
- Description: Every built-in prototype object has the Object prototype
- object, which is the value of the expression
- Object.prototype (15.2.3.1) as the value of its internal
- [[Prototype]] property, except the Object prototype
- object itself.
+ File Name: 15.js
+ ECMA Section: 15 Native ECMAScript Objects
+ Description: Every built-in prototype object has the Object prototype
+ object, which is the value of the expression
+ Object.prototype (15.2.3.1) as the value of its internal
+ [[Prototype]] property, except the Object prototype
+ object itself.
- Every native object associated with a program-created
- function also has the Object prototype object as the
- value of its internal [[Prototype]] property.
+ Every native object associated with a program-created
+ function also has the Object prototype object as the
+ value of its internal [[Prototype]] property.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Native ECMAScript Objects";
+var SECTION = "15-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Native ECMAScript Objects";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
+writeHeaderToLog( SECTION + " "+ TITLE);
/*
- array[item++] = new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
-// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ );
+ new TestCase( SECTION, "Function.prototype.__proto__", Object.prototype, Function.prototype.__proto__ );
+ new TestCase( SECTION, "Array.prototype.__proto__", Object.prototype, Array.prototype.__proto__ );
+ new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
+ new TestCase( SECTION, "Boolean.prototype.__proto__", Object.prototype, Boolean.prototype.__proto__ );
+ new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// new TestCase( SECTION, "Math.prototype.__proto__", Object.prototype, Math.prototype.__proto__ );
+new TestCase( SECTION, "Date.prototype.__proto__", Object.prototype, Date.prototype.__proto__ );
+new TestCase( SECTION, "TestCase.prototype.__proto__", Object.prototype, TestCase.prototype.__proto__ );
- array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ );
+new TestCase( SECTION, "MyObject.prototype.__proto__", Object.prototype, MyObject.prototype.__proto__ );
*/
- array[item++] = new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
-// array[item++] = new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Function.prototype.__proto__ == Object.prototype", true, Function.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Array.prototype.__proto__ == Object.prototype", true, Array.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "String.prototype.__proto__ == Object.prototype", true, String.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Boolean.prototype.__proto__ == Object.prototype", true, Boolean.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+// new TestCase( SECTION, "Math.prototype.__proto__ == Object.prototype", true, Math.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "Date.prototype.__proto__ == Object.prototype", true, Date.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "TestCase.prototype.__proto__ == Object.prototype", true, TestCase.prototype.__proto__ == Object.prototype );
- array[item++] = new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype );
+new TestCase( SECTION, "MyObject.prototype.__proto__ == Object.prototype", true, MyObject.prototype.__proto__ == Object.prototype );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+test();
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
}
diff --git a/mozilla/js/tests/ecma/NativeObjects/15-2.js b/mozilla/js/tests/ecma/NativeObjects/15-2.js
index 64a092ae611..d9811358813 100644
--- a/mozilla/js/tests/ecma/NativeObjects/15-2.js
+++ b/mozilla/js/tests/ecma/NativeObjects/15-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 15-2.js
ECMA Section: 15 Native ECMAScript Objects
@@ -58,36 +60,16 @@
writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+ new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+ new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
+ new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ );
+ new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ );
+ new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
+ new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ );
+ new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ );
- array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
- array[item++] = new TestCase( SECTION, "Array.__proto__", Function.prototype, Array.__proto__ );
- array[item++] = new TestCase( SECTION, "String.__proto__", Function.prototype, String.__proto__ );
- array[item++] = new TestCase( SECTION, "Boolean.__proto__", Function.prototype, Boolean.__proto__ );
- array[item++] = new TestCase( SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
- array[item++] = new TestCase( SECTION, "Date.__proto__", Function.prototype, Date.__proto__ );
- array[item++] = new TestCase( SECTION, "TestCase.__proto__", Function.prototype, TestCase.__proto__ );
+ new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
+ new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ );
+ new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ );
- array[item++] = new TestCase( SECTION, "eval.__proto__", Function.prototype, eval.__proto__ );
- array[item++] = new TestCase( SECTION, "Math.pow.__proto__", Function.prototype, Math.pow.__proto__ );
- array[item++] = new TestCase( SECTION, "String.prototype.indexOf.__proto__", Function.prototype, String.prototype.indexOf.__proto__ );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/NativeObjects/browser.js b/mozilla/js/tests/ecma/NativeObjects/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/NativeObjects/shell.js b/mozilla/js/tests/ecma/NativeObjects/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Number/15.7.1.js b/mozilla/js/tests/ecma/Number/15.7.1.js
index ae33b8a7d49..fd5e652621d 100644
--- a/mozilla/js/tests/ecma/Number/15.7.1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.1.js
- ECMA Section: 15.7.1 The Number Constructor Called as a Function
- 15.7.1.1
- 15.7.1.2
+ File Name: 15.7.1.js
+ ECMA Section: 15.7.1 The Number Constructor Called as a Function
+ 15.7.1.1
+ 15.7.1.2
- Description: When Number is called as a function rather than as a
- constructor, it performs a type conversion.
- 15.7.1.1 Return a number value (not a Number object)
- computed by ToNumber( value )
- 15.7.1.2 Number() returns 0.
+ Description: When Number is called as a function rather than as a
+ constructor, it performs a type conversion.
+ 15.7.1.1 Return a number value (not a Number object)
+ computed by ToNumber( value )
+ 15.7.1.2 Number() returns 0.
- need to add more test cases. see the testcases for
- TypeConversion ToNumber.
+ need to add more test cases. see the testcases for
+ TypeConversion ToNumber.
- Author: christine@netscape.com
- Date: 29 september 1997
+ Author: christine@netscape.com
+ Date: 29 september 1997
*/
- var SECTION = "15.7.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The Number Constructor Called as a Function";
+var SECTION = "15.7.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The Number Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase(SECTION, "Number()", 0, Number() );
+new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+new TestCase(SECTION, "Number(null)", 0, Number(null) );
+new TestCase(SECTION, "Number()", 0, Number() );
+new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) );
+new TestCase(SECTION, "Number(0)", 0, Number(0) );
+new TestCase(SECTION, "Number(1)", 1, Number(1) );
+new TestCase(SECTION, "Number(-1)", -1, Number(-1) );
+new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) );
+new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") );
+new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) );
+new TestCase(SECTION, "Number('')", 0, Number( "" ) );
+new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") );
+new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+test();
- array[item++] = new TestCase(SECTION, "Number()", 0, Number() );
- array[item++] = new TestCase(SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
- array[item++] = new TestCase(SECTION, "Number(null)", 0, Number(null) );
- array[item++] = new TestCase(SECTION, "Number()", 0, Number() );
- array[item++] = new TestCase(SECTION, "Number(new Number())", 0, Number( new Number() ) );
- array[item++] = new TestCase(SECTION, "Number(0)", 0, Number(0) );
- array[item++] = new TestCase(SECTION, "Number(1)", 1, Number(1) );
- array[item++] = new TestCase(SECTION, "Number(-1)", -1, Number(-1) );
- array[item++] = new TestCase(SECTION, "Number(NaN)", Number.NaN, Number( Number.NaN ) );
- array[item++] = new TestCase(SECTION, "Number('string')", Number.NaN, Number( "string") );
- array[item++] = new TestCase(SECTION, "Number(new String())", 0, Number( new String() ) );
- array[item++] = new TestCase(SECTION, "Number('')", 0, Number( "" ) );
- array[item++] = new TestCase(SECTION, "Number(Infinity)", Number.POSITIVE_INFINITY, Number("Infinity") );
-
- array[item++] = new TestCase(SECTION, "Number(new MyObject(100))", 100, Number(new MyObject(100)) );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+}
diff --git a/mozilla/js/tests/ecma/Number/15.7.2.js b/mozilla/js/tests/ecma/Number/15.7.2.js
index 85b7e3b5b55..487f69f8894 100644
--- a/mozilla/js/tests/ecma/Number/15.7.2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 15.7.2.js
ECMA Section: 15.7.2 The Number Constructor
@@ -68,121 +70,97 @@
writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
// To verify that the object's prototype is the Number.prototype, check to see if the object's
// constructor property is the same as Number.prototype.constructor.
- array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+ new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
- array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+ new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) );
- array[item++] = new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(0)).constructor", Number.prototype.constructor, (new Number(0)).constructor );
+ new TestCase(SECTION, "typeof (new Number(0))", "object", typeof (new Number(0)) );
+ new TestCase(SECTION, "(new Number(0)).valueOf()", 0, (new Number(0)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(0);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) );
- array[item++] = new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(1)).constructor", Number.prototype.constructor, (new Number(1)).constructor );
+ new TestCase(SECTION, "typeof (new Number(1))", "object", typeof (new Number(1)) );
+ new TestCase(SECTION, "(new Number(1)).valueOf()", 1, (new Number(1)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) );
- array[item++] = new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(-1)).constructor", Number.prototype.constructor, (new Number(-1)).constructor );
+ new TestCase(SECTION, "typeof (new Number(-1))", "object", typeof (new Number(-1)) );
+ new TestCase(SECTION, "(new Number(-1)).valueOf()", -1, (new Number(-1)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(-1);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) );
- array[item++] = new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(Number.NaN)).constructor", Number.prototype.constructor, (new Number(Number.NaN)).constructor );
+ new TestCase(SECTION, "typeof (new Number(Number.NaN))", "object", typeof (new Number(Number.NaN)) );
+ new TestCase(SECTION, "(new Number(Number.NaN)).valueOf()", Number.NaN, (new Number(Number.NaN)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(Number.NaN);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) );
- array[item++] = new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number('string')).constructor", Number.prototype.constructor, (new Number('string')).constructor );
+ new TestCase(SECTION, "typeof (new Number('string'))", "object", typeof (new Number('string')) );
+ new TestCase(SECTION, "(new Number('string')).valueOf()", Number.NaN, (new Number('string')).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number('string');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) );
- array[item++] = new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(new String())).constructor", Number.prototype.constructor, (new Number(new String())).constructor );
+ new TestCase(SECTION, "typeof (new Number(new String()))", "object", typeof (new Number(new String())) );
+ new TestCase(SECTION, "(new Number(new String())).valueOf()", 0, (new Number(new String())).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(new String());NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) );
- array[item++] = new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number('')).constructor", Number.prototype.constructor, (new Number('')).constructor );
+ new TestCase(SECTION, "typeof (new Number(''))", "object", typeof (new Number('')) );
+ new TestCase(SECTION, "(new Number('')).valueOf()", 0, (new Number('')).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number('');NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) );
- array[item++] = new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.POSITIVE_INFINITY)).constructor );
+ new TestCase(SECTION, "typeof (new Number(Number.POSITIVE_INFINITY))", "object", typeof (new Number(Number.POSITIVE_INFINITY)) );
+ new TestCase(SECTION, "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, (new Number(Number.POSITIVE_INFINITY)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(Number.POSITIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) );
- array[item++] = new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).constructor", Number.prototype.constructor, (new Number(Number.NEGATIVE_INFINITY)).constructor );
+ new TestCase(SECTION, "typeof (new Number(Number.NEGATIVE_INFINITY))", "object", typeof (new Number(Number.NEGATIVE_INFINITY)) );
+ new TestCase(SECTION, "(new Number(Number.NEGATIVE_INFINITY)).valueOf()", Number.NEGATIVE_INFINITY, (new Number(Number.NEGATIVE_INFINITY)).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number(Number.NEGATIVE_INFINITY);NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- array[item++] = new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
- array[item++] = new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
- array[item++] = new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
- array[item++] = new TestCase(SECTION,
+ new TestCase(SECTION, "(new Number()).constructor", Number.prototype.constructor, (new Number()).constructor );
+ new TestCase(SECTION, "typeof (new Number())", "object", typeof (new Number()) );
+ new TestCase(SECTION, "(new Number()).valueOf()", 0, (new Number()).valueOf() );
+ new TestCase(SECTION,
"NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()",
"[object Number]",
eval("NUMB = new Number();NUMB.toString=Object.prototype.toString;NUMB.toString()") );
- return ( array );
-}
-
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.1-1.js b/mozilla/js/tests/ecma/Number/15.7.3.1-1.js
index f3b14acbb3b..e1bc78e28c5 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.1-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.1-2.js
- ECMA Section: 15.7.3.1 Number.prototype
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.prototype
+ this test checks the DontDelete attribute of Number.prototype
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
var SECTION = "15.7.3.1-1";
var VERSION = "ECMA_1";
- startTest();
+startTest();
var TITLE = "Number.prototype";
writeHeaderToLog( SECTION +" "+ TITLE);
-var testcases = getTestCases();
+new TestCase(SECTION,
+ "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype",
+ true,
+ eval("var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype") );
+
+new TestCase(SECTION,
+ "delete( Number.prototype )",
+ false,
+ eval("delete( Number.prototype )") );
+
test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(SECTION, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype", true, "var NUM_PROT = Number.prototype; delete( Number.prototype ); NUM_PROT == Number.prototype" );
- array[item++] = new TestCase(SECTION, "delete( Number.prototype )", false, "delete( Number.prototype )" );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
- }
- stopTest();
- return ( testcases );
-}
-
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.1-2.js b/mozilla/js/tests/ecma/Number/15.7.3.1-2.js
index 0b143833f4e..27d988b896d 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.1-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.1-2.js
- ECMA Section: 15.7.3.1 Number.prototype
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.1-2.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.prototype
+ this test checks the ReadOnly attribute of Number.prototype
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.prototype";
+var SECTION = "15.7.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION,
+ "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT",
+ true,
+ eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") );
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT",
- true,
- eval("var NUM_PROT = Number.prototype; Number.prototype = null; Number.prototype == NUM_PROT") );
-
- array[item++] = new TestCase( SECTION,
- "Number.prototype=0; Number.prototype",
- Number.prototype,
- eval("Number.prototype=0; Number.prototype") );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Number.prototype=0; Number.prototype",
+ Number.prototype,
+ eval("Number.prototype=0; Number.prototype") );
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.1-3.js b/mozilla/js/tests/ecma/Number/15.7.3.1-3.js
index 267f865a878..45d14f175db 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.1-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.1-4.js
- ECMA Section: 15.7.3.1 Number.prototype
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.1-4.js
+ ECMA Section: 15.7.3.1 Number.prototype
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.prototype
+ this test checks the DontEnum attribute of Number.prototype
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "15.7.3.1-3";
- var TITLE = "Number.prototype";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "15.7.3.1-3";
+var TITLE = "Number.prototype";
- writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute");
+writeHeaderToLog( SECTION + " Number.prototype: DontEnum Attribute");
- var testcases = getTestCases();
+new TestCase(
+ SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;")
+ );
- test( testcases );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop: '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'prototype' ) ? prop : '' } string;")
- );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += "property should not be enumerated ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.2-1.js b/mozilla/js/tests/ecma/Number/15.7.3.2-1.js
index 2463ddfe4c9..78fdee124ca 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.2-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.2-1.js
- ECMA Section: 15.7.3.2 Number.MAX_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.2-1.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the value of MAX_VALUE
+ this test checks the value of MAX_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MAX_VALUE";
+var SECTION = "15.7.3.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "Number.MAX_VALUE",
+ 1.7976931348623157e308,
+ Number.MAX_VALUE );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "Number.MAX_VALUE", 1.7976931348623157e308, Number.MAX_VALUE );
-
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.2-2.js b/mozilla/js/tests/ecma/Number/15.7.3.2-2.js
index 771896faa54..ece98559141 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.2-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.2-2.js
- ECMA Section: 15.7.3.2 Number.MAX_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.2-2.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.MAX_VALUE
+ this test checks the DontDelete attribute of Number.MAX_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MAX_VALUE: DontDelete Attribute";
+var SECTION = "15.7.3.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE: DontDelete Attribute";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "delete( Number.MAX_VALUE ); Number.MAX_VALUE",
+ 1.7976931348623157e308,
+ eval("delete( Number.MAX_VALUE );Number.MAX_VALUE") );
+new TestCase( SECTION,
+ "delete( Number.MAX_VALUE )",
+ false,
+ eval("delete( Number.MAX_VALUE )") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE ); Number.MAX_VALUE", 1.7976931348623157e308, "delete( Number.MAX_VALUE );Number.MAX_VALUE" );
- array[item++] = new TestCase( SECTION, "delete( Number.MAX_VALUE )", false, "delete( Number.MAX_VALUE )" );
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.2-3.js b/mozilla/js/tests/ecma/Number/15.7.3.2-3.js
index 765b6cce1e6..1ea2aff2897 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.2-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.2-3.js
- ECMA Section: 15.7.3.2 Number.MAX_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.2-3.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.MAX_VALUE
+ this test checks the ReadOnly attribute of Number.MAX_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MAX_VALUE";
+var SECTION = "15.7.3.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test();
+var MAX_VAL = 1.7976931348623157e308;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Number.MAX_VALUE=0; Number.MAX_VALUE",
+ MAX_VAL,
+ eval("Number.MAX_VALUE=0; Number.MAX_VALUE") );
- var MAX_VAL = 1.7976931348623157e308;
-
- array[item++] = new TestCase( SECTION,
- "Number.MAX_VALUE=0; Number.MAX_VALUE",
- MAX_VAL,
- eval("Number.MAX_VALUE=0; Number.MAX_VALUE") );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.2-4.js b/mozilla/js/tests/ecma/Number/15.7.3.2-4.js
index ef432e31dc1..5110e6e0f2b 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.2-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.2-4.js
- ECMA Section: 15.7.3.2 Number.MAX_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.2-4.js
+ ECMA Section: 15.7.3.2 Number.MAX_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.MAX_VALUE
+ this test checks the DontEnum attribute of Number.MAX_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.2-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MAX_VALUE: DontEnum Attribute";
- writeHeaderToLog( SECTION + " "+ TITLE);
+var SECTION = "15.7.3.2-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MAX_VALUE: DontEnum Attribute";
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MAX_VALUE' ) ? prop : '' } string;")
- );
-
- return ( array );
-}
-function test( testcases ) {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "property should not be enumerated ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.3-1.js b/mozilla/js/tests/ecma/Number/15.7.3.3-1.js
index d751462344c..9fc37a3c4aa 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.3-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.3-1.js
- ECMA Section: 15.7.3.3 Number.MIN_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.3-1.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the value of Number.MIN_VALUE
+ this test checks the value of Number.MIN_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MIN_VALUE";
+var SECTION = "15.7.3.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test( testcases );
+var MIN_VAL = 5e-324;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "Number.MIN_VALUE",
+ MIN_VAL,
+ Number.MIN_VALUE );
- var MIN_VAL = 5e-324;
-
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE", MIN_VAL, Number.MIN_VALUE );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.3-2.js b/mozilla/js/tests/ecma/Number/15.7.3.3-2.js
index dd41a2b7596..5d69926cf75 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.3-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.3-2.js
- ECMA Section: 15.7.3.3 Number.MIN_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.3-2.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.MIN_VALUE
+ this test checks the DontDelete attribute of Number.MIN_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MIN_VALUE";
+var SECTION = "15.7.3.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test( testcases );
+var MIN_VAL = 5e-324;
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "delete( Number.MIN_VALUE )",
+ false,
+ eval("delete( Number.MIN_VALUE )") );
- var MIN_VAL = 5e-324;
+new TestCase( SECTION,
+ "delete( Number.MIN_VALUE ); Number.MIN_VALUE",
+ MIN_VAL,
+ eval("delete( Number.MIN_VALUE );Number.MIN_VALUE") );
- array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE )", false, "delete( Number.MIN_VALUE )" );
- array[item++] = new TestCase( SECTION, "delete( Number.MIN_VALUE ); Number.MIN_VALUE", MIN_VAL, "delete( Number.MIN_VALUE );Number.MIN_VALUE" );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.3-3.js b/mozilla/js/tests/ecma/Number/15.7.3.3-3.js
index 2f9a92ce6b9..6faaec35547 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.3-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.3-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.3-3.js
- ECMA Section: 15.7.3.3 Number.MIN_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.3-3.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.MIN_VALUE
+ this test checks the ReadOnly attribute of Number.MIN_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.3-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.MIN_VALUE: ReadOnly Attribute";
+var SECTION = "15.7.3.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.MIN_VALUE: ReadOnly Attribute";
- writeHeaderToLog( SECTION + " "+TITLE );
+writeHeaderToLog( SECTION + " "+TITLE );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Number.MIN_VALUE=0; Number.MIN_VALUE",
+ Number.MIN_VALUE,
+ eval("Number.MIN_VALUE=0; Number.MIN_VALUE" ));
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "Number.MIN_VALUE=0; Number.MIN_VALUE",
- Number.MIN_VALUE,
- "Number.MIN_VALUE=0; Number.MIN_VALUE" );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "property should be readonly ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.3-4.js b/mozilla/js/tests/ecma/Number/15.7.3.3-4.js
index fc1e7a06e90..fe978efb976 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.3-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.3-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.3-4.js
- ECMA Section: 15.7.3.3 Number.MIN_VALUE
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.3-4.js
+ ECMA Section: 15.7.3.3 Number.MIN_VALUE
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.MIN_VALUE
+ this test checks the DontEnum attribute of Number.MIN_VALUE
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.3-4";
- var VERSION = "ECMA_1";
- startTest();
+var SECTION = "15.7.3.3-4";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute");
+writeHeaderToLog( SECTION + " Number.MIN_VALUE: DontEnum Attribute");
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'MIN_VALUE' ) ? prop : '' } string;")
- );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "property should not be enumerated ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.4-1.js b/mozilla/js/tests/ecma/Number/15.7.3.4-1.js
index 13faefcae86..11e00207760 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.4-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.4-1.js
- ECMA Section: 15.7.3.4 Number.NaN
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.4-1.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the value of Number.NaN
+ this test checks the value of Number.NaN
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NaN";
+var SECTION = "15.7.3.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test();
+new TestCase(SECTION,
+ "NaN",
+ NaN,
+ Number.NaN );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(SECTION, "NaN", NaN, Number.NaN );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.4-2.js b/mozilla/js/tests/ecma/Number/15.7.3.4-2.js
index dafadbaf360..c6b5711c587 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.4-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.4-2.js
- ECMA Section: 15.7.3.4 Number.NaN
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.4-2.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.NaN
+ this test checks the DontDelete attribute of Number.NaN
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.4-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NaN";
+var SECTION = "15.7.3.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test();
+new TestCase(SECTION,
+ "delete( Number.NaN ); Number.NaN",
+ NaN,
+ eval("delete( Number.NaN );Number.NaN" ));
+new TestCase( SECTION,
+ "delete( Number.NaN )",
+ false,
+ eval("delete( Number.NaN )") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(SECTION, "delete( Number.NaN ); Number.NaN", NaN, "delete( Number.NaN );Number.NaN" );
- array[item++] = new TestCase( SECTION, "delete( Number.NaN )", false, "delete( Number.NaN )" );
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.4-3.js b/mozilla/js/tests/ecma/Number/15.7.3.4-3.js
index b1dab709f0d..993efcbd8a8 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.4-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.4-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.4-3.js
- ECMA Section: 15.7.3.4 Number.NaN
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.4-3.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.NaN
+ this test checks the ReadOnly attribute of Number.NaN
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.4-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NaN";
+var SECTION = "15.7.3.4-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
- writeHeaderToLog( SECTION + " "+ TITLE );
+writeHeaderToLog( SECTION + " "+ TITLE );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Number.NaN=0; Number.NaN",
+ Number.NaN,
+ eval("Number.NaN=0; Number.NaN") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(
- SECTION,
- "Number.NaN=0; Number.NaN",
- Number.NaN,
- "Number.NaN=0; Number.NaN" );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += "property should be readonly ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.4-4.js b/mozilla/js/tests/ecma/Number/15.7.3.4-4.js
index d0480445576..56005834ac2 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.4-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.4-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.4-4.js
- ECMA Section: 15.7.3.4 Number.NaN
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.4-4.js
+ ECMA Section: 15.7.3.4 Number.NaN
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.NaN
+ this test checks the DontEnum attribute of Number.NaN
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.4-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NaN";
+var SECTION = "15.7.3.4-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NaN";
- writeHeaderToLog( SECTION + " " + TITLE);
+writeHeaderToLog( SECTION + " " + TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NaN' ) ? prop : '' } string;")
- );
-
- return ( array );
-}
-
-function test( testcases ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += "property should not be enumerated ";
- passed = false;
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.5-1.js b/mozilla/js/tests/ecma/Number/15.7.3.5-1.js
index fe1ba845aba..798c1ca91ec 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.5-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,43 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.5-1.js
- ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.5-1.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the value of Number.NEGATIVE_INFINITY
+ this test checks the value of Number.NEGATIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NEGATIVE_INFINITY";
+var SECTION = "15.7.3.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase(SECTION,
+ "Number.NEGATIVE_INFINITY",
+ -Infinity,
+ Number.NEGATIVE_INFINITY );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(SECTION, "Number.NEGATIVE_INFINITY", -Infinity, Number.NEGATIVE_INFINITY );
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.5-2.js b/mozilla/js/tests/ecma/Number/15.7.3.5-2.js
index 7898c244d62..c085d5527d4 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.5-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.5-2.js
- ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.5-2.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY
+ this test checks the DontDelete attribute of Number.NEGATIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NEGATIVE_INFINITY";
+var SECTION = "15.7.3.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY )",
+ false,
+ eval("delete( Number.NEGATIVE_INFINITY )") );
+new TestCase( SECTION,
+ "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY",
+ -Infinity,
+ eval("delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "delete( Number.NEGATIVE_INFINITY )",
- false,
- "delete( Number.NEGATIVE_INFINITY )" );
-
- array[item++] = new TestCase( SECTION,
- "delete( Number.NEGATIVE_INFINITY ); Number.NEGATIVE_INFINITY",
- -Infinity,
- "delete( Number.NEGATIVE_INFINITY );Number.NEGATIVE_INFINITY" );
- return ( array );
-}
-function test( testcases ) {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.5-3.js b/mozilla/js/tests/ecma/Number/15.7.3.5-3.js
index 883b4487a08..37db8e93fc3 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.5-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.5-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.5-3.js
- ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.5-3.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY
+ this test checks the ReadOnly attribute of Number.NEGATIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.5-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NEGATIVE_INFINITY";
+var SECTION = "15.7.3.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY",
+ -Infinity,
+ eval("Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY",
- -Infinity,
- "Number.NEGATIVE_INFINITY=0; Number.NEGATIVE_INFINITY" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += "property should be readonly ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.5-4.js b/mozilla/js/tests/ecma/Number/15.7.3.5-4.js
index 1aada3ab9de..5c7c8164ed2 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.5-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.5-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.5-4.js
- ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.5-4.js
+ ECMA Section: 15.7.3.5 Number.NEGATIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY
+ this test checks the DontEnum attribute of Number.NEGATIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.5-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.NEGATIVE_INFINITY";
+var SECTION = "15.7.3.5-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.NEGATIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'NEGATIVE_INFINITY' ) ? prop : '' } string;")
- );
- return ( array );
-}
-
-function test( testcases ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += "property should not be enumerated ";
-
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.6-1.js b/mozilla/js/tests/ecma/Number/15.7.3.6-1.js
index 56d21e88a4f..a9b3c688edb 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.6-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.6-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,42 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.6-1.js
- ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.6-1.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the value of Number.POSITIVE_INFINITY
+ this test checks the value of Number.POSITIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.6-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.POSITIVE_INFINITY";
+var SECTION = "15.7.3.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", Infinity, Number.POSITIVE_INFINITY );
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION,
+ "Number.POSITIVE_INFINITY",
+ Infinity,
+ Number.POSITIVE_INFINITY );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.6-2.js b/mozilla/js/tests/ecma/Number/15.7.3.6-2.js
index 1433470983a..43f2a8d9058 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.6-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.6-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.6-2.js
- ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.6-2.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontDelete attribute of Number.POSITIVE_INFINITY
+ this test checks the DontDelete attribute of Number.POSITIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.6-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.POSITIVE_INFINITY";
+var SECTION = "15.7.3.6-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase(SECTION,
+ "delete( Number.POSITIVE_INFINITY )",
+ false,
+ eval("delete( Number.POSITIVE_INFINITY )") );
+new TestCase(SECTION,
+ "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY",
+ Infinity,
+ eval("delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY )", false, "delete( Number.POSITIVE_INFINITY )" );
- array[item++] = new TestCase(SECTION, "delete( Number.POSITIVE_INFINITY ); Number.POSITIVE_INFINITY", Infinity, "delete( Number.POSITIVE_INFINITY );Number.POSITIVE_INFINITY" );
- return ( array );
-}
-
-function test( testcases ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "delete should not be allowed "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.6-3.js b/mozilla/js/tests/ecma/Number/15.7.3.6-3.js
index d5fb82ef3e8..409f6960d8a 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.6-3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.6-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.6-3.js
- ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.6-3.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY
+ this test checks the ReadOnly attribute of Number.POSITIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.6-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.POSITIVE_INFINITY";
+var SECTION = "15.7.3.6-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY",
+ Number.POSITIVE_INFINITY,
+ eval("Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY",
- Number.POSITIVE_INFINITY,
- "Number.POSITIVE_INFINITY=0; Number.POSITIVE_INFINITY" );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += "property should be readonly ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.6-4.js b/mozilla/js/tests/ecma/Number/15.7.3.6-4.js
index e51cd7c89ff..62614116e10 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.6-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.6-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.6-4.js
- ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
- Description: All value properties of the Number object should have
- the attributes [DontEnum, DontDelete, ReadOnly]
+ File Name: 15.7.3.6-4.js
+ ECMA Section: 15.7.3.6 Number.POSITIVE_INFINITY
+ Description: All value properties of the Number object should have
+ the attributes [DontEnum, DontDelete, ReadOnly]
- this test checks the DontEnum attribute of Number.POSITIVE_INFINITY
+ this test checks the DontEnum attribute of Number.POSITIVE_INFINITY
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.3.6-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.POSITIVE_INFINITY";
+var SECTION = "15.7.3.6-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.POSITIVE_INFINITY";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;",
+ "",
+ eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;")
+ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(
- SECTION,
- "var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;",
- "",
- eval("var string = ''; for ( prop in Number ) { string += ( prop == 'POSITIVE_INFINITY' ) ? prop : '' } string;")
- );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += "property should not be enumerated ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.3.js b/mozilla/js/tests/ecma/Number/15.7.3.js
index c71deb431ef..93738df8378 100644
--- a/mozilla/js/tests/ecma/Number/15.7.3.js
+++ b/mozilla/js/tests/ecma/Number/15.7.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.3.js
- 15.7.3 Properties of the Number Constructor
+ File Name: 15.7.3.js
+ 15.7.3 Properties of the Number Constructor
- Description: The value of the internal [[Prototype]] property
- of the Number constructor is the Function prototype
- object. The Number constructor also has the internal
- [[Call]] and [[Construct]] properties, and the length
- property.
+ Description: The value of the internal [[Prototype]] property
+ of the Number constructor is the Function prototype
+ object. The Number constructor also has the internal
+ [[Call]] and [[Construct]] properties, and the length
+ property.
- Other properties are in subsequent tests.
+ Other properties are in subsequent tests.
- Author: christine@netscape.com
- Date: 29 september 1997
+ Author: christine@netscape.com
+ Date: 29 september 1997
*/
- var SECTION = "15.7.3";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "Properties of the Number Constructor";
+var SECTION = "15.7.3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Number Constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase(SECTION,
+ "Number.__proto__",
+ Function.prototype,
+ Number.__proto__ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase(SECTION, "Number.__proto__", Function.prototype, Number.__proto__ );
- array[item++] = new TestCase(SECTION, "Number.length", 1, Number.length );
+new TestCase(SECTION,
+ "Number.length",
+ 1,
+ Number.length );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4-1.js b/mozilla/js/tests/ecma/Number/15.7.4-1.js
index 9ccf571f32c..1d2fceac129 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,6 +35,7 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
File Name: 15.7.4-1.js
ECMA Section: 15.7.4.1 Properties of the Number Prototype Object
@@ -48,31 +50,9 @@
startTest();
writeHeaderToLog( SECTION + "Properties of the Number prototype object");
- var testcases = getTestCases();
+ new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
+ new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) );
+ new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number );
+// new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ );
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase(SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
- array[item++] = new TestCase(SECTION, "typeof(Number.prototype)", "object", typeof(Number.prototype) );
- array[item++] = new TestCase(SECTION, "Number.prototype.constructor == Number", true, Number.prototype.constructor == Number );
-// array[item++] = new TestCase(SECTION, "Number.prototype == Number.__proto__", true, Number.prototype == Number.__proto__ );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.1.js b/mozilla/js/tests/ecma/Number/15.7.4.1.js
index 59be37c81c1..d833c249c35 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.1.js
- ECMA Section: 15.7.4.1.1 Number.prototype.constructor
+ File Name: 15.7.4.1.js
+ ECMA Section: 15.7.4.1.1 Number.prototype.constructor
- Number.prototype.constructor is the built-in Number constructor.
+ Number.prototype.constructor is the built-in Number constructor.
- Description:
- Author: christine@netscape.com
- Date: 16 september 1997
+ Description:
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Number.prototype.constructor";
+var SECTION = "15.7.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Number.prototype.constructor";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "Number.prototype.constructor",
- Number,
- Number.prototype.constructor );
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION,
+ "Number.prototype.constructor",
+ Number,
+ Number.prototype.constructor );
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.2-1.js b/mozilla/js/tests/ecma/Number/15.7.4.2-1.js
index 406a22e34af..92117294716 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.2-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.2.js
- ECMA Section: 15.7.4.2.1 Number.prototype.toString()
- Description:
- If the radix is the number 10 or not supplied, then this number value is
- given as an argument to the ToString operator; the resulting string value
- is returned.
+ File Name: 15.7.4.2.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
- If the radix is supplied and is an integer from 2 to 36, but not 10, the
- result is a string, the choice of which is implementation dependent.
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
-
- writeHeaderToLog( SECTION + " Number.prototype.toString()");
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var SECTION = "15.7.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
+
// the following two lines cause navigator to crash -- cmb 9/16/97
- array[item++] = new TestCase(SECTION, "Number.prototype.toString()", "0", "Number.prototype.toString()" );
- array[item++] = new TestCase(SECTION, "typeof(Number.prototype.toString())", "string", "typeof(Number.prototype.toString())" );
+new TestCase(SECTION,
+ "Number.prototype.toString()",
+ "0",
+ eval("Number.prototype.toString()") );
- array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()", "0", "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()" );
- array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()", "1", "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()" );
- array[item++] = new TestCase(SECTION, "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()", "-1", "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()" );
+new TestCase(SECTION,
+ "typeof(Number.prototype.toString())",
+ "string",
+ eval("typeof(Number.prototype.toString())") );
- array[item++] = new TestCase(SECTION, "var MYNUM = new Number(255); MYNUM.toString(10)", "255", "var MYNUM = new Number(255); MYNUM.toString(10)" );
- array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)", "NaN", "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)" );
- array[item++] = new TestCase(SECTION, "var MYNUM = new Number(Infinity); MYNUM.toString(10)", "Infinity", "var MYNUM = new Number(Infinity); MYNUM.toString(10)" );
- array[item++] = new TestCase(SECTION, "var MYNUM = new Number(-Infinity); MYNUM.toString(10)", "-Infinity", "var MYNUM = new Number(-Infinity); MYNUM.toString(10)" );
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()",
+ "0",
+ eval("s = Number.prototype.toString; o = new Number(); o.toString = s; o.toString()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual= eval(testcases[tc].actual );
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()",
+ "1",
+ eval("s = Number.prototype.toString; o = new Number(1); o.toString = s; o.toString()") );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase(SECTION,
+ "s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()",
+ "-1",
+ eval("s = Number.prototype.toString; o = new Number(-1); o.toString = s; o.toString()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase(SECTION,
+ "var MYNUM = new Number(255); MYNUM.toString(10)",
+ "255",
+ eval("var MYNUM = new Number(255); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(Number.NaN); MYNUM.toString(10)",
+ "NaN",
+ eval("var MYNUM = new Number(Number.NaN); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(Infinity); MYNUM.toString(10)",
+ "Infinity",
+ eval("var MYNUM = new Number(Infinity); MYNUM.toString(10)") );
+
+new TestCase(SECTION,
+ "var MYNUM = new Number(-Infinity); MYNUM.toString(10)",
+ "-Infinity",
+ eval("var MYNUM = new Number(-Infinity); MYNUM.toString(10)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.2-2-n.js b/mozilla/js/tests/ecma/Number/15.7.4.2-2-n.js
index defe8a1c3c2..d23b795121c 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.2-2-n.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,40 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.2-2-n.js
- ECMA Section: 15.7.4.2.1 Number.prototype.toString()
- Description:
- If the radix is the number 10 or not supplied, then this number value is
- given as an argument to the ToString operator; the resulting string value
- is returned.
+ File Name: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
- If the radix is supplied and is an integer from 2 to 36, but not 10, the
- result is a string, the choice of which is implementation dependent.
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.2-2-n";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.7.4.2-2-n";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.prototype.toString()");
- test();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+DESCRIPTION = "o = new Object(); o.toString = Number.prototype.toString; o.toString()";
+EXPECTED = "error";
- array[item++] = new TestCase(SECTION, "o = new Object(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new Object(); o.toString = Number.prototype.toString; o.toString()" );
-// array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" );
-// array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", "o = 3; o.toString = Number.prototype.toString; o.toString()" );
+new TestCase(SECTION,
+ "o = new Object(); o.toString = Number.prototype.toString; o.toString()",
+ "error",
+ eval("o = new Object(); o.toString = Number.prototype.toString; o.toString()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+// new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") );
+// new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "error", eval("o = 3; o.toString = Number.prototype.toString; o.toString()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.2-3-n.js b/mozilla/js/tests/ecma/Number/15.7.4.2-3-n.js
index 726051f78a1..85e30a1583a 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.2-3-n.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.2-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.2-3-n.js
- ECMA Section: 15.7.4.2.1 Number.prototype.toString()
- Description:
- If the radix is the number 10 or not supplied, then this number value is
- given as an argument to the ToString operator; the resulting string value
- is returned.
+ File Name: 15.7.4.2-3-n.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
- If the radix is supplied and is an integer from 2 to 36, but not 10, the
- result is a string, the choice of which is implementation dependent.
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.2-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.7.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.prototype.toString()");
- test();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+DESCRIPTION = "o = new String(); o.toString = Number.prototype.toString; o.toString()";
+EXPECTED = "error";
- array[item++] = new TestCase(SECTION, "o = new String(); o.toString = Number.prototype.toString; o.toString()", "error", "o = new String(); o.toString = Number.prototype.toString; o.toString()" );
+new TestCase(SECTION,
+ "o = new String(); o.toString = Number.prototype.toString; o.toString()",
+ "error",
+ eval("o = new String(); o.toString = Number.prototype.toString; o.toString()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.2-4.js b/mozilla/js/tests/ecma/Number/15.7.4.2-4.js
index b37ceb7e16d..12690b1ea4d 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.2-4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.2-4.js
- ECMA Section: 15.7.4.2.1 Number.prototype.toString()
- Description:
- If the radix is the number 10 or not supplied, then this number value is
- given as an argument to the ToString operator; the resulting string value
- is returned.
+ File Name: 15.7.4.2-4.js
+ ECMA Section: 15.7.4.2.1 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
- If the radix is supplied and is an integer from 2 to 36, but not 10, the
- result is a string, the choice of which is implementation dependent.
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.2-4";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.7.4.2-4";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.prototype.toString()");
- test();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase(SECTION,
+ "o = 3; o.toString = Number.prototype.toString; o.toString()",
+ "3",
+ eval("o = 3; o.toString = Number.prototype.toString; o.toString()") );
- array[item++] = new TestCase(SECTION, "o = 3; o.toString = Number.prototype.toString; o.toString()", "3", "o = 3; o.toString = Number.prototype.toString; o.toString()" );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.3-1.js b/mozilla/js/tests/ecma/Number/15.7.4.3-1.js
index 59c625c30e7..1ccff42c5a5 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.3-1.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,61 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.3-1.js
- ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
- Description:
- Returns this number value.
+ File Name: 15.7.4.3-1.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
- The valueOf function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
-
- writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
- test();
+var SECTION = "15.7.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
// the following two line causes navigator to crash -- cmb 9/16/97
- array[item++] = new TestCase("15.7.4.1", "Number.prototype.valueOf()", 0, "Number.prototype.valueOf()" );
+new TestCase("SECTION",
+ "Number.prototype.valueOf()",
+ 0,
+ eval("Number.prototype.valueOf()") );
- array[item++] = new TestCase("15.7.4.1", "(new Number(1)).valueOf()", 1, "(new Number(1)).valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "(new Number(-1)).valueOf()", -1, "(new Number(-1)).valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "(new Number(0)).valueOf()", 0, "(new Number(0)).valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "(new Number(Number.POSITIVE_INFINITY)).valueOf()", Number.POSITIVE_INFINITY, "(new Number(Number.POSITIVE_INFINITY)).valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "(new Number(Number.NaN)).valueOf()", Number.NaN, "(new Number(Number.NaN)).valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "(new Number()).valueOf()", 0, "(new Number()).valueOf()" );
+new TestCase("SECTION",
+ "(new Number(1)).valueOf()",
+ 1,
+ eval("(new Number(1)).valueOf()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase("SECTION",
+ "(new Number(-1)).valueOf()",
+ -1,
+ eval("(new Number(-1)).valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase("SECTION",
+ "(new Number(0)).valueOf()",
+ 0,
+ eval("(new Number(0)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(Number.POSITIVE_INFINITY)).valueOf()",
+ Number.POSITIVE_INFINITY,
+ eval("(new Number(Number.POSITIVE_INFINITY)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number(Number.NaN)).valueOf()",
+ Number.NaN,
+ eval("(new Number(Number.NaN)).valueOf()") );
+
+new TestCase("SECTION",
+ "(new Number()).valueOf()",
+ 0,
+ eval("(new Number()).valueOf()") );
+
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.3-2.js b/mozilla/js/tests/ecma/Number/15.7.4.3-2.js
index 78a05e2d551..de7e21ca863 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.3-2.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.3-2.js
- ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
- Description:
- Returns this number value.
+ File Name: 15.7.4.3-2.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
- The valueOf function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.7.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
- test();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase(SECTION,
+ "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()",
+ 3,
+ eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") );
- array[item++] = new TestCase(SECTION, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", 3, "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" );
-
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.3-3-n.js b/mozilla/js/tests/ecma/Number/15.7.4.3-3-n.js
index cfeaa4b2be8..5ad17fa0ea7 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.3-3-n.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.3-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.3-3.js
- ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
- Description:
- Returns this number value.
+ File Name: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
- The valueOf function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "15.7.4.3-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.7.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
- test();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", eval("v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+DESCRIPTION = "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()";
+EXPECTED = "error";
-// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()", "error", "v = Number.prototype.valueOf; num = 3; num.valueOf = v; num.valueOf()" );
- array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()" );
-// array[item++] = new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()" );
+new TestCase("15.7.4.1",
+ "v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()",
+ "error",
+ eval("v = Number.prototype.valueOf; o = new String('Infinity'); o.valueOf = v; o.valueOf()") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+// new TestCase("15.7.4.1", "v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()", "error", eval("v = Number.prototype.valueOf; o = new Object(); o.valueOf = v; o.valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/15.7.4.js b/mozilla/js/tests/ecma/Number/15.7.4.js
index 5d1d3a63a3c..baee2bac151 100644
--- a/mozilla/js/tests/ecma/Number/15.7.4.js
+++ b/mozilla/js/tests/ecma/Number/15.7.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,68 +35,54 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.7.4.js
- ECMA Section: 15.7.4
+ File Name: 15.7.4.js
+ ECMA Section: 15.7.4
- Description:
+ Description:
- The Number prototype object is itself a Number object (its [[Class]] is
- "Number") whose value is +0.
+ The Number prototype object is itself a Number object (its [[Class]] is
+ "Number") whose value is +0.
- The value of the internal [[Prototype]] property of the Number prototype
- object is the Object prototype object (15.2.3.1).
+ The value of the internal [[Prototype]] property of the Number prototype
+ object is the Object prototype object (15.2.3.1).
- In following descriptions of functions that are properties of the Number
- prototype object, the phrase "this Number object" refers to the object
- that is the this value for the invocation of the function; it is an error
- if this does not refer to an object for which the value of the internal
- [[Class]] property is "Number". Also, the phrase "this number value" refers
- to the number value represented by this Number object, that is, the value
- of the internal [[Value]] property of this Number object.
+ In following descriptions of functions that are properties of the Number
+ prototype object, the phrase "this Number object" refers to the object
+ that is the this value for the invocation of the function; it is an error
+ if this does not refer to an object for which the value of the internal
+ [[Class]] property is "Number". Also, the phrase "this number value" refers
+ to the number value represented by this Number object, that is, the value
+ of the internal [[Value]] property of this Number object.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.7.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Number Prototype Object";
+var SECTION = "15.7.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Number Prototype Object";
- writeHeaderToLog( SECTION + " "+TITLE);
+writeHeaderToLog( SECTION + " "+TITLE);
- var testcases = getTestCases();
- test( testcases );
+new TestCase( SECTION,
+ "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()",
+ "[object Number]",
+ eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION,
- "Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()",
- "[object Number]",
- eval("Number.prototype.toString=Object.prototype.toString;Number.prototype.toString()") );
- array[item++] = new TestCase( SECTION, "typeof Number.prototype", "object", typeof Number.prototype );
- array[item++] = new TestCase( SECTION, "Number.prototype.valueOf()", 0, Number.prototype.valueOf() );
+new TestCase( SECTION,
+ "typeof Number.prototype",
+ "object",
+ typeof Number.prototype );
+new TestCase( SECTION,
+ "Number.prototype.valueOf()",
+ 0,
+ Number.prototype.valueOf() );
// The __proto__ property cannot be used in ECMA_1 tests.
-// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
-// array[item++] = new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
+// new TestCase( SECTION, "Number.prototype.__proto__", Object.prototype, Number.prototype.__proto__ );
+// new TestCase( SECTION, "Number.prototype.__proto__ == Object.prototype", true, Number.prototype.__proto__ == Object.prototype );
-
- return ( array );
-}
-function test( ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Number/browser.js b/mozilla/js/tests/ecma/Number/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Number/shell.js b/mozilla/js/tests/ecma/Number/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.1.1.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.1.1.js
index 30c0040e462..ba647d8dc27 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.1.1.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.1.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,133 +35,112 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.1.1.js
- ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
- Object(value)
- Description: When Object is called as a function rather than as a
- constructor, the following steps are taken:
+ File Name: 15.2.1.1.js
+ ECMA Section: 15.2.1.1 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
- 1. If value is null or undefined, create and return a
- new object with no properties other than internal
- properties exactly as if the object constructor
- had been called on that same value (15.2.2.1).
- 2. Return ToObject (value), whose rules are:
+ 1. If value is null or undefined, create and return a
+ new object with no properties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
- undefined generate a runtime error
- null generate a runtime error
- boolean create a new Boolean object whose default
- value is the value of the boolean.
- number Create a new Number object whose default
- value is the value of the number.
- string Create a new String object whose default
- value is the value of the string.
- object Return the input argument (no conversion).
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
- Author: christine@netscape.com
- Date: 17 july 1997
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var SECTION = "15.2.1.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object( value )";
+var SECTION = "15.2.1.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object( value )";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var NULL_OBJECT = Object(null);
- var NULL_OBJECT = Object(null);
+new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() );
+new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) );
+new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(null).valueOf()", NULL_OBJECT, (NULL_OBJECT).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(null)", "object", typeof (Object(null)) );
- array[item++] = new TestCase( SECTION, "Object(null).__proto__", Object.prototype, (Object(null)).__proto__ );
+var UNDEFINED_OBJECT = Object( void 0 );
- var UNDEFINED_OBJECT = Object( void 0 );
+new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() );
+new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) );
+new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(void 0).valueOf()", UNDEFINED_OBJECT, (UNDEFINED_OBJECT).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(void 0)", "object", typeof (Object(void 0)) );
- array[item++] = new TestCase( SECTION, "Object(void 0).__proto__", Object.prototype, (Object(void 0)).__proto__ );
+new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("var MYOB = Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MAX_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.MIN_VALUE); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.POSITIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NEGATIVE_INFINITY); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("var MYOB = Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('a string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object('\\r\\t\\b\\n\\v\\f'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+// new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
-// array[item++] = new TestCase( SECTION, "var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("var MYOB = Object( '\\\'\\\"\\' ); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason +=
- ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.1.2.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.1.2.js
index 1514da38973..b450d634b1b 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.1.2.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.1.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,67 +35,45 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.1.2.js
- ECMA Section: 15.2.1.2 The Object Constructor Called as a Function:
- Object(value)
- Description: When Object is called as a function rather than as a
- constructor, the following steps are taken:
+ File Name: 15.2.1.2.js
+ ECMA Section: 15.2.1.2 The Object Constructor Called as a Function:
+ Object(value)
+ Description: When Object is called as a function rather than as a
+ constructor, the following steps are taken:
- 1. If value is null or undefined, create and return a
- new object with no proerties other than internal
- properties exactly as if the object constructor
- had been called on that same value (15.2.2.1).
- 2. Return ToObject (value), whose rules are:
+ 1. If value is null or undefined, create and return a
+ new object with no proerties other than internal
+ properties exactly as if the object constructor
+ had been called on that same value (15.2.2.1).
+ 2. Return ToObject (value), whose rules are:
- undefined generate a runtime error
- null generate a runtime error
- boolean create a new Boolean object whose default
- value is the value of the boolean.
- number Create a new Number object whose default
- value is the value of the number.
- string Create a new String object whose default
- value is the value of the string.
- object Return the input argument (no conversion).
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
- Author: christine@netscape.com
- Date: 17 july 1997
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var SECTION = "15.2.1.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object()";
+var SECTION = "15.2.1.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var MYOB = Object();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
+new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
+new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
- var MYOB = Object();
-
- array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.valueOf()", MYOB, MYOB.valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object()", "object", typeof (Object(null)) );
- array[item++] = new TestCase( SECTION, "var MYOB = Object(); MYOB.toString()", "[object Object]", eval("var MYOB = Object(); MYOB.toString()") );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason +=
- ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.2.1.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.2.1.js
index 34680c7e822..2780c8b672f 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.2.1.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.2.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,121 +35,102 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.2.1.js
- ECMA Section: 15.2.2.1 The Object Constructor: new Object( value )
+ File Name: 15.2.2.1.js
+ ECMA Section: 15.2.2.1 The Object Constructor: new Object( value )
- 1.If the type of the value is not Object, go to step 4.
- 2.If the value is a native ECMAScript object, do not create a new object; simply return value.
- 3.If the value is a host object, then actions are taken and a result is returned in an
- implementation-dependent manner that may depend on the host object.
- 4.If the type of the value is String, return ToObject(value).
- 5.If the type of the value is Boolean, return ToObject(value).
- 6.If the type of the value is Number, return ToObject(value).
- 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object.
- The [[Prototype]] property of the newly constructed object is set to the Object prototype object.
- The [[Class]] property of the newly constructed object is set to "Object".
- The newly constructed object has no [[Value]] property.
- Return the newly created native object.
+ 1.If the type of the value is not Object, go to step 4.
+ 2.If the value is a native ECMAScript object, do not create a new object; simply return value.
+ 3.If the value is a host object, then actions are taken and a result is returned in an
+ implementation-dependent manner that may depend on the host object.
+ 4.If the type of the value is String, return ToObject(value).
+ 5.If the type of the value is Boolean, return ToObject(value).
+ 6.If the type of the value is Number, return ToObject(value).
+ 7.(The type of the value must be Null or Undefined.) Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to the Object prototype object.
+ The [[Class]] property of the newly constructed object is set to "Object".
+ The newly constructed object has no [[Value]] property.
+ Return the newly created native object.
- Description: This does not test cases where the object is a host object.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Description: This does not test cases where the object is a host object.
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.2.2.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Object( value )";
+var SECTION = "15.2.2.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Object( value )";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) );
- array[item++] = new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) );
- array[item++] = new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
-
- array[item++] = new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() );
-
- array[item++] = new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) );
- array[item++] = new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() );
+writeHeaderToLog( SECTION + " "+ TITLE);
- var myglobal = this;
- var myobject = new Object( "my new object" );
- var myarray = new Array();
- var myboolean = new Boolean();
- var mynumber = new Number();
- var mystring = new String();
- var myobject = new Object();
- var myfunction = new Function( "x", "return x");
- var mymath = Math;
+new TestCase( SECTION, "typeof new Object(null)", "object", typeof new Object(null) );
+new TestCase( SECTION, "MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(null); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- array[item++] = new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) );
- array[item++] = new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) );
- array[item++] = new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) );
- array[item++] = new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) );
- array[item++] = new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) );
- array[item++] = new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) );
- array[item++] = new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) );
- array[item++] = new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) );
- array[item++] = new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) );
+new TestCase( SECTION, "typeof new Object(void 0)", "object", typeof new Object(void 0) );
+new TestCase( SECTION, "MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Object]", eval("MYOB = new Object(new Object(void 0)); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
- return ( array );
-}
-function test() {
- for (tc = 0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+new TestCase( SECTION, "typeof new Object('string')", "object", typeof new Object('string') );
+new TestCase( SECTION, "MYOB = (new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object('string'); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object('string').valueOf()", "string", (new Object('string')).valueOf() );
- }
+new TestCase( SECTION, "typeof new Object('')", "object", typeof new Object('') );
+new TestCase( SECTION, "MYOB = (new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object String]", eval("MYOB = new Object(''); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object('').valueOf()", "", (new Object('')).valueOf() );
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION, "typeof new Object(Number.NaN)", "object", typeof new Object(Number.NaN) );
+new TestCase( SECTION, "MYOB = (new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(Number.NaN); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(Number.NaN).valueOf()", Number.NaN, (new Object(Number.NaN)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(0)", "object", typeof new Object(0) );
+new TestCase( SECTION, "MYOB = (new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(0).valueOf()", 0, (new Object(0)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(-0)", "object", typeof new Object(-0) );
+new TestCase( SECTION, "MYOB = (new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-0); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(-0).valueOf()", -0, (new Object(-0)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(1)", "object", typeof new Object(1) );
+new TestCase( SECTION, "MYOB = (new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(1).valueOf()", 1, (new Object(1)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(-1)", "object", typeof new Object(-1) );
+new TestCase( SECTION, "MYOB = (new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Number]", eval("MYOB = new Object(-1); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(-1).valueOf()", -1, (new Object(-1)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(true)", "object", typeof new Object(true) );
+new TestCase( SECTION, "MYOB = (new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(true); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(true).valueOf()", true, (new Object(true)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(false)", "object", typeof new Object(false) );
+new TestCase( SECTION, "MYOB = (new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(false); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(false).valueOf()", false, (new Object(false)).valueOf() );
+
+new TestCase( SECTION, "typeof new Object(Boolean())", "object", typeof new Object(Boolean()) );
+new TestCase( SECTION, "MYOB = (new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()", "[object Boolean]", eval("MYOB = new Object(Boolean()); MYOB.toString = Object.prototype.toString; MYOB.toString()") );
+new TestCase( SECTION, "(new Object(Boolean()).valueOf()", Boolean(), (new Object(Boolean())).valueOf() );
+
+
+var myglobal = this;
+var myobject = new Object( "my new object" );
+var myarray = new Array();
+var myboolean = new Boolean();
+var mynumber = new Number();
+var mystring = new String();
+var myobject = new Object();
+var myfunction = new Function( "x", "return x");
+var mymath = Math;
+
+new TestCase( SECTION, "myglobal = new Object( this )", myglobal, new Object(this) );
+new TestCase( SECTION, "myobject = new Object('my new object'); new Object(myobject)", myobject, new Object(myobject) );
+new TestCase( SECTION, "myarray = new Array(); new Object(myarray)", myarray, new Object(myarray) );
+new TestCase( SECTION, "myboolean = new Boolean(); new Object(myboolean)", myboolean, new Object(myboolean) );
+new TestCase( SECTION, "mynumber = new Number(); new Object(mynumber)", mynumber, new Object(mynumber) );
+new TestCase( SECTION, "mystring = new String9); new Object(mystring)", mystring, new Object(mystring) );
+new TestCase( SECTION, "myobject = new Object(); new Object(mynobject)", myobject, new Object(myobject) );
+new TestCase( SECTION, "myfunction = new Function(); new Object(myfunction)", myfunction, new Object(myfunction) );
+new TestCase( SECTION, "mymath = Math; new Object(mymath)", mymath, new Object(mymath) );
+
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.2.2.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.2.2.js
index ac0e510a46b..4099f0f448a 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.2.2.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.2.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,63 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.2.2.js
- ECMA Section: 15.2.2.2 new Object()
- Description:
+ File Name: 15.2.2.2.js
+ ECMA Section: 15.2.2.2 new Object()
+ Description:
- When the Object constructor is called with no argument, the following
- step is taken:
+ When the Object constructor is called with no argument, the following
+ step is taken:
- 1. Create a new native ECMAScript object.
- The [[Prototype]] property of the newly constructed object is set to
- the Object prototype object.
+ 1. Create a new native ECMAScript object.
+ The [[Prototype]] property of the newly constructed object is set to
+ the Object prototype object.
- The [[Class]] property of the newly constructed object is set
- to "Object".
+ The [[Class]] property of the newly constructed object is set
+ to "Object".
- The newly constructed object has no [[Value]] property.
+ The newly constructed object has no [[Value]] property.
- Return the newly created native object.
+ Return the newly created native object.
- Author: christine@netscape.com
- Date: 7 october 1997
+ Author: christine@netscape.com
+ Date: 7 october 1997
*/
- var SECTION = "15.2.2.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "new Object()";
+var SECTION = "15.2.2.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "new Object()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() );
+new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() );
+new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "typeof new Object()", "object", typeof new Object() );
- array[item++] = new TestCase( SECTION, "Object.prototype.toString()", "[object Object]", Object.prototype.toString() );
- array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-
-function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = new Function( "return this.value+''" );
-}
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3-1.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3-1.js
index 51317261c3b..ed8415159cc 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3-1.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3-1.js
- ECMA Section: 15.2.3 Properties of the Object Constructor
+ File Name: 15.2.3-1.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
- Description: The value of the internal [[Prototype]] property of the
- Object constructor is the Function prototype object.
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
- Besides the call and construct propreties and the length
- property, the Object constructor has properties described
- in 15.2.3.1.
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3";
- var VERSION = "ECMA_2";
- startTest();
- var testcases = getTestCases();
+var SECTION = "15.2.3";
+var VERSION = "ECMA_2";
+startTest();
- writeHeaderToLog( SECTION + " Properties of the Object Constructor");
- test();
+writeHeaderToLog( SECTION + " Properties of the Object Constructor");
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+new TestCase( SECTION, "Object.length", 1, Object.length );
- array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
- array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length );
-
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-1.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-1.js
index 6c2b07555c6..af41647760f 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-1.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3.1-1.js
- ECMA Section: 15.2.3.1 Object.prototype
+ File Name: 15.2.3.1-1.js
+ ECMA Section: 15.2.3.1 Object.prototype
- Description: The initial value of Object.prototype is the built-in
- Object prototype object.
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete ReadOnly ]
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
- This tests the [DontEnum] property of Object.prototype
+ This tests the [DontEnum] property of Object.prototype
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype";
+var SECTION = "15.2.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "var str = '';for ( p in Object ) { str += p; }; str",
+ "",
+ eval( "var str = ''; for ( p in Object ) { str += p; }; str" ) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "var str = '';for ( p in Object ) { str += p; }; str",
- "",
- eval( "var str = ''; for ( p in Object ) { str += p; }; str" )
- );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-2.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-2.js
index 21964f3b89b..2465fa61ad6 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-2.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3.1-2.js
- ECMA Section: 15.2.3.1 Object.prototype
+ File Name: 15.2.3.1-2.js
+ ECMA Section: 15.2.3.1 Object.prototype
- Description: The initial value of Object.prototype is the built-in
- Object prototype object.
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete ReadOnly ]
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
- This tests the [DontDelete] property of Object.prototype
+ This tests the [DontDelete] property of Object.prototype
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype";
+var SECTION = "15.2.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "delete( Object.prototype )",
+ false,
+ eval("delete( Object.prototype )") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete( Object.prototype )",
- false,
- "delete( Object.prototype )"
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-3.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-3.js
index 3c12de8c2a6..8b49d69bb5d 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-3.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3.1-3.js
- ECMA Section: 15.2.3.1 Object.prototype
+ File Name: 15.2.3.1-3.js
+ ECMA Section: 15.2.3.1 Object.prototype
- Description: The initial value of Object.prototype is the built-in
- Object prototype object.
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete ReadOnly ]
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
- This tests the [ReadOnly] property of Object.prototype
+ This tests the [ReadOnly] property of Object.prototype
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype";
+var SECTION = "15.2.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Object.prototype = null; Object.prototype",
+ Object.prototype,
+ eval("Object.prototype = null; Object.prototype"));
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Object.prototype = null; Object.prototype",
- Object.prototype,
- "Object.prototype = null; Object.prototype"
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-4.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-4.js
index 3b687654898..d22eeaace40 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-4.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.1-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,34 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3.1-4.js
- ECMA Section: 15.2.3.1 Object.prototype
+ File Name: 15.2.3.1-4.js
+ ECMA Section: 15.2.3.1 Object.prototype
- Description: The initial value of Object.prototype is the built-in
- Object prototype object.
+ Description: The initial value of Object.prototype is the built-in
+ Object prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete ReadOnly ]
+ This property shall have the attributes [ DontEnum,
+ DontDelete ReadOnly ]
- This tests the [DontDelete] property of Object.prototype
+ This tests the [DontDelete] property of Object.prototype
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3.1-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype";
+var SECTION = "15.2.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "delete( Object.prototype ); Object.prototype",
+ Object.prototype,
+ eval("delete(Object.prototype); Object.prototype") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "delete( Object.prototype ); Object.prototype",
- Object.prototype,
- "delete(Object.prototype); Object.prototype"
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual);
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.js
index 77f864fe439..3afafded5aa 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.3.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.3.js
- ECMA Section: 15.2.3 Properties of the Object Constructor
+ File Name: 15.2.3.js
+ ECMA Section: 15.2.3 Properties of the Object Constructor
- Description: The value of the internal [[Prototype]] property of the
- Object constructor is the Function prototype object.
+ Description: The value of the internal [[Prototype]] property of the
+ Object constructor is the Function prototype object.
- Besides the call and construct propreties and the length
- property, the Object constructor has properties described
- in 15.2.3.1.
+ Besides the call and construct propreties and the length
+ property, the Object constructor has properties described
+ in 15.2.3.1.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the Object Constructor";
+var SECTION = "15.2.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the Object Constructor";
- writeHeaderToLog( SECTION + " " + TITLE);
+writeHeaderToLog( SECTION + " " + TITLE);
- var testcases = getTestCases();
- test();
+// new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
+new TestCase( SECTION, "Object.length", 1, Object.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
-// array[item++] = new TestCase( SECTION, "Object.__proto__", Function.prototype, Object.__proto__ );
- array[item++] = new TestCase( SECTION, "Object.length", 1, Object.length );
-
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.1.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.1.js
index 6cf7ad3e852..ad960e4bb3a 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.1.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,45 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.4.1.js
- ECMA Section: 15.2.4 Object.prototype.constructor
+ File Name: 15.2.4.1.js
+ ECMA Section: 15.2.4 Object.prototype.constructor
- Description: The initial value of the Object.prototype.constructor
- is the built-in Object constructor.
+ Description: The initial value of the Object.prototype.constructor
+ is the built-in Object constructor.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype.constructor";
+var SECTION = "15.2.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "Object.prototype.constructor",
+ Object,
+ Object.prototype.constructor );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "Object.prototype.constructor",
- Object,
- Object.prototype.constructor
- );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.2.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.2.js
index a5b0a854d7f..60c8ef20828 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.2.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,110 +35,90 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.4.2.js
- ECMA Section: 15.2.4.2 Object.prototype.toString()
+ File Name: 15.2.4.2.js
+ ECMA Section: 15.2.4.2 Object.prototype.toString()
- Description: When the toString method is called, the following
- steps are taken:
- 1. Get the [[Class]] property of this object
- 2. Call ToString( Result(1) )
- 3. Compute a string value by concatenating the three
- strings "[object " + Result(2) + "]"
- 4. Return Result(3).
+ Description: When the toString method is called, the following
+ steps are taken:
+ 1. Get the [[Class]] property of this object
+ 2. Call ToString( Result(1) )
+ 3. Compute a string value by concatenating the three
+ strings "[object " + Result(2) + "]"
+ 4. Return Result(3).
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.4.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype.toString()";
+var SECTION = "15.2.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.toString()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()",
+ GLOBAL,
+ eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "(new Object()).toString()", "[object Object]", (new Object()).toString() );
+new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()",
- GLOBAL,
- eval("myvar = this; myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()",
+ '[object Object]',
+ eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Function]",
- eval("myvar = MyObject; myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Number]",
+ eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()",
- '[object Object]',
- eval("myvar = new MyObject( true ); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object String]",
+ eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Number]",
- eval("myvar = new Number(0); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Math]",
+ eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object String]",
- eval("myvar = new String(''); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Function]",
+ eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Math]",
- eval("myvar = Math; myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Array]",
+ eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Function]",
- eval("myvar = new Function(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Boolean]",
+ eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Array]",
- eval("myvar = new Array(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()",
+ "[object Date]",
+ eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Boolean]",
- eval("myvar = new Boolean(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()",
+ GLOBAL,
+ eval("var MYVAR = new Object( this ); MYVAR.toString()") );
- array[item++] = new TestCase( SECTION, "myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()",
- "[object Date]",
- eval("myvar = new Date(); myvar.toString = Object.prototype.toString; myvar.toString()") );
+new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(); MYVAR.toString()") );
- array[item++] = new TestCase( SECTION, "var MYVAR = new Object( this ); MYVAR.toString()",
- GLOBAL,
- eval("var MYVAR = new Object( this ); MYVAR.toString()") );
+new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(void 0); MYVAR.toString()") );
- array[item++] = new TestCase( SECTION, "var MYVAR = new Object(); MYVAR.toString()",
- "[object Object]",
- eval("var MYVAR = new Object(); MYVAR.toString()") );
+new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()",
+ "[object Object]",
+ eval("var MYVAR = new Object(null); MYVAR.toString()") );
- array[item++] = new TestCase( SECTION, "var MYVAR = new Object(void 0); MYVAR.toString()",
- "[object Object]",
- eval("var MYVAR = new Object(void 0); MYVAR.toString()") );
-
- array[item++] = new TestCase( SECTION, "var MYVAR = new Object(null); MYVAR.toString()",
- "[object Object]",
- eval("var MYVAR = new Object(null); MYVAR.toString()") );
-
- return ( array );
-}
-function test( array ) {
- for ( tc=0 ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = new Function( "return this.value" );
- this.toString = new Function ( "return this.value+''");
-}
\ No newline at end of file
+ this.value = new Function( "return this.value" );
+ this.toString = new Function ( "return this.value+''");
+}
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.3.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.3.js
index ff154711580..d2df3e7ff3f 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.3.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,97 +35,81 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.4.3.js
- ECMA Section: 15.2.4.3 Object.prototype.valueOf()
+ File Name: 15.2.4.3.js
+ ECMA Section: 15.2.4.3 Object.prototype.valueOf()
- Description: As a rule, the valueOf method for an object simply
- returns the object; but if the object is a "wrapper"
- for a host object, as may perhaps be created by the
- Object constructor, then the contained host object
- should be returned.
+ Description: As a rule, the valueOf method for an object simply
+ returns the object; but if the object is a "wrapper"
+ for a host object, as may perhaps be created by the
+ Object constructor, then the contained host object
+ should be returned.
- This only covers native objects.
+ This only covers native objects.
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.4.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Object.prototype.valueOf()";
+var SECTION = "15.2.4.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Object.prototype.valueOf()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var myarray = new Array();
+myarray.valueOf = Object.prototype.valueOf;
+var myboolean = new Boolean();
+myboolean.valueOf = Object.prototype.valueOf;
+var myfunction = new Function();
+myfunction.valueOf = Object.prototype.valueOf;
+var myobject = new Object();
+myobject.valueOf = Object.prototype.valueOf;
+var mymath = Math;
+mymath.valueOf = Object.prototype.valueOf;
+var mydate = new Date();
+mydate.valueOf = Object.prototype.valueOf;
+var mynumber = new Number();
+mynumber.valueOf = Object.prototype.valueOf;
+var mystring = new String();
+mystring.valueOf = Object.prototype.valueOf;
- var myarray = new Array();
- myarray.valueOf = Object.prototype.valueOf;
- var myboolean = new Boolean();
- myboolean.valueOf = Object.prototype.valueOf;
- var myfunction = new Function();
- myfunction.valueOf = Object.prototype.valueOf;
- var myobject = new Object();
- myobject.valueOf = Object.prototype.valueOf;
- var mymath = Math;
- mymath.valueOf = Object.prototype.valueOf;
- var mydate = new Date();
- mydate.valueOf = Object.prototype.valueOf;
- var mynumber = new Number();
- mynumber.valueOf = Object.prototype.valueOf;
- var mystring = new String();
- mystring.valueOf = Object.prototype.valueOf;
+new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length );
- array[item++] = new TestCase( SECTION, "Object.prototype.valueOf.length", 0, Object.prototype.valueOf.length );
+new TestCase( SECTION,
+ "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()",
+ myarray,
+ myarray.valueOf() );
+new TestCase( SECTION,
+ "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()",
+ myboolean,
+ myboolean.valueOf() );
+new TestCase( SECTION,
+ "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()",
+ myfunction,
+ myfunction.valueOf() );
+new TestCase( SECTION,
+ "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()",
+ myobject,
+ myobject.valueOf() );
+new TestCase( SECTION,
+ "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()",
+ mymath,
+ mymath.valueOf() );
+new TestCase( SECTION,
+ "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()",
+ mynumber,
+ mynumber.valueOf() );
+new TestCase( SECTION,
+ "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()",
+ mystring,
+ mystring.valueOf() );
+new TestCase( SECTION,
+ "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()",
+ mydate,
+ mydate.valueOf() );
- array[item++] = new TestCase( SECTION,
- "myarray = new Array(); myarray.valueOf = Object.prototype.valueOf; myarray.valueOf()",
- myarray,
- myarray.valueOf() );
- array[item++] = new TestCase( SECTION,
- "myboolean = new Boolean(); myboolean.valueOf = Object.prototype.valueOf; myboolean.valueOf()",
- myboolean,
- myboolean.valueOf() );
- array[item++] = new TestCase( SECTION,
- "myfunction = new Function(); myfunction.valueOf = Object.prototype.valueOf; myfunction.valueOf()",
- myfunction,
- myfunction.valueOf() );
- array[item++] = new TestCase( SECTION,
- "myobject = new Object(); myobject.valueOf = Object.prototype.valueOf; myobject.valueOf()",
- myobject,
- myobject.valueOf() );
- array[item++] = new TestCase( SECTION,
- "mymath = Math; mymath.valueOf = Object.prototype.valueOf; mymath.valueOf()",
- mymath,
- mymath.valueOf() );
- array[item++] = new TestCase( SECTION,
- "mynumber = new Number(); mynumber.valueOf = Object.prototype.valueOf; mynumber.valueOf()",
- mynumber,
- mynumber.valueOf() );
- array[item++] = new TestCase( SECTION,
- "mystring = new String(); mystring.valueOf = Object.prototype.valueOf; mystring.valueOf()",
- mystring,
- mystring.valueOf() );
- array[item++] = new TestCase( SECTION,
- "mydate = new Date(); mydate.valueOf = Object.prototype.valueOf; mydate.valueOf()",
- mydate,
- mydate.valueOf() );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.js b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.js
index cc099c21190..2487c6582d3 100644
--- a/mozilla/js/tests/ecma/ObjectObjects/15.2.4.js
+++ b/mozilla/js/tests/ecma/ObjectObjects/15.2.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,42 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.2.4.js
- ECMA Section: 15.2.4 Properties of the Object prototype object
+ File Name: 15.2.4.js
+ ECMA Section: 15.2.4 Properties of the Object prototype object
- Description: The value of the internal [[Prototype]] property of
- the Object prototype object is null
+ Description: The value of the internal [[Prototype]] property of
+ the Object prototype object is null
- Author: christine@netscape.com
- Date: 28 october 1997
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.2.4";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "Properties of the Object.prototype object";
+var SECTION = "15.2.4";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Properties of the Object.prototype object";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- testcases[tc++] = new TestCase( SECTION, "Object.prototype.__proto__",
- null,
- Object.prototype.__proto__
- );
+new TestCase( SECTION,
+ "Object.prototype.__proto__",
+ null,
+ Object.prototype.__proto__ );
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/ObjectObjects/browser.js b/mozilla/js/tests/ecma/ObjectObjects/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/ObjectObjects/shell.js b/mozilla/js/tests/ecma/ObjectObjects/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/README b/mozilla/js/tests/ecma/README
new file mode 100755
index 00000000000..91f174ab610
--- /dev/null
+++ b/mozilla/js/tests/ecma/README
@@ -0,0 +1 @@
+ECMA 262 Edition 1
diff --git a/mozilla/js/tests/ecma/SourceText/6-1.js b/mozilla/js/tests/ecma/SourceText/6-1.js
index 543b9da7531..bca7d308c46 100644
--- a/mozilla/js/tests/ecma/SourceText/6-1.js
+++ b/mozilla/js/tests/ecma/SourceText/6-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,106 +35,92 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 6-1.js
- ECMA Section: Source Text
- Description:
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
- ECMAScript source text is represented as a sequence of characters
- representable using the Unicode version 2.0 character encoding.
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
- SourceCharacter ::
- any Unicode character
+ SourceCharacter ::
+ any Unicode character
- However, it is possible to represent every ECMAScript program using
- only ASCII characters (which are equivalent to the first 128 Unicode
- characters). Non-ASCII Unicode characters may appear only within comments
- and string literals. In string literals, any Unicode character may also be
- expressed as a Unicode escape sequence consisting of six ASCII characters,
- namely \u plus four hexadecimal digits. Within a comment, such an escape
- sequence is effectively ignored as part of the comment. Within a string
- literal, the Unicode escape sequence contributes one character to the string
- value of the literal.
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
- Note that ECMAScript differs from the Java programming language in the
- behavior of Unicode escape sequences. In a Java program, if the Unicode escape
- sequence \u000A, for example, occurs within a single-line comment, it is
- interpreted as a line terminator (Unicode character 000A is line feed) and
- therefore the next character is not part of the comment. Similarly, if the
- Unicode escape sequence \u000A occurs within a string literal in a Java
- program, it is likewise interpreted as a line terminator, which is not
- allowed within a string literal-one must write \n instead of \u000A to
- cause a line feed to be part of the string value of a string literal. In
- an ECMAScript program, a Unicode escape sequence occurring within a comment
- is never interpreted and therefore cannot contribute to termination of the
- comment. Similarly, a Unicode escape sequence occurring within a string literal
- in an ECMAScript program always contributes a character to the string value of
- the literal and is never interpreted as a line terminator or as a quote mark
- that might terminate the string literal.
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "6-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Source Text";
+var SECTION = "6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Source Text";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var testcase = new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \u000A",
+ 'PASSED',
+ "PASSED" );
- testcases[tc] = new TestCase( SECTION,
- "// the following character should not be interpreted as a line terminator in a comment: \u000A",
- 'PASSED',
- "PASSED" );
+// \u000A testcase.actual = "FAILED!";
- // \u000A testcases[tc].actual = "FAILED!";
+testcase =
+new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'",
+ 'PASSED',
+ 'PASSED' );
- tc++;
+// the following character should noy be interpreted as a line terminator: \\n testcase.actual = "FAILED"
- testcases[tc] = new TestCase( SECTION,
- "// the following character should not be interpreted as a line terminator in a comment: \\n 'FAILED'",
- 'PASSED',
- 'PASSED' );
+testcase =
+new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'",
+ 'PASSED',
+ 'PASSED' );
- // the following character should noy be interpreted as a line terminator: \\n testcases[tc].actual = "FAILED"
+// the following character should not be interpreted as a line terminator: \u000A testcase.actual = "FAILED"
- tc++;
+testcase =
+new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'",
+ 'PASSED',
+ 'PASSED' );
+// the following character should not be interpreted as a line terminator: \n testcase.actual = 'FAILED'
- testcases[tc] = new TestCase( SECTION,
- "// the following character should not be interpreted as a line terminator in a comment: \\u000A 'FAILED'",
- 'PASSED',
- 'PASSED' )
+testcase =
+new TestCase( SECTION,
+ "// the following character should not be interpreted as a line terminator in a comment: u000D",
+ 'PASSED',
+ 'PASSED' );
- // the following character should not be interpreted as a line terminator: \u000A testcases[tc].actual = "FAILED"
+// the following character should not be interpreted as a line terminator: \u000D testcase.actual = "FAILED"
- testcases[tc++] = new TestCase( SECTION,
- "// the following character should not be interpreted as a line terminator in a comment: \n 'PASSED'",
- 'PASSED',
- 'PASSED' )
- // the following character should not be interpreted as a line terminator: \n testcases[tc].actual = 'FAILED'
+test();
- testcases[tc] = new TestCase( SECTION,
- "// the following character should not be interpreted as a line terminator in a comment: u000D",
- 'PASSED',
- 'PASSED' )
-
- // the following character should not be interpreted as a line terminator: \u000D testcases[tc].actual = "FAILED"
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/SourceText/6-2.js b/mozilla/js/tests/ecma/SourceText/6-2.js
index f5d5d229ddc..fa517ab0ec7 100644
--- a/mozilla/js/tests/ecma/SourceText/6-2.js
+++ b/mozilla/js/tests/ecma/SourceText/6-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,111 +35,95 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 6-1.js
- ECMA Section: Source Text
- Description:
+ File Name: 6-1.js
+ ECMA Section: Source Text
+ Description:
- ECMAScript source text is represented as a sequence of characters
- representable using the Unicode version 2.0 character encoding.
+ ECMAScript source text is represented as a sequence of characters
+ representable using the Unicode version 2.0 character encoding.
- SourceCharacter ::
- any Unicode character
+ SourceCharacter ::
+ any Unicode character
- However, it is possible to represent every ECMAScript program using
- only ASCII characters (which are equivalent to the first 128 Unicode
- characters). Non-ASCII Unicode characters may appear only within comments
- and string literals. In string literals, any Unicode character may also be
- expressed as a Unicode escape sequence consisting of six ASCII characters,
- namely \u plus four hexadecimal digits. Within a comment, such an escape
- sequence is effectively ignored as part of the comment. Within a string
- literal, the Unicode escape sequence contributes one character to the string
- value of the literal.
+ However, it is possible to represent every ECMAScript program using
+ only ASCII characters (which are equivalent to the first 128 Unicode
+ characters). Non-ASCII Unicode characters may appear only within comments
+ and string literals. In string literals, any Unicode character may also be
+ expressed as a Unicode escape sequence consisting of six ASCII characters,
+ namely \u plus four hexadecimal digits. Within a comment, such an escape
+ sequence is effectively ignored as part of the comment. Within a string
+ literal, the Unicode escape sequence contributes one character to the string
+ value of the literal.
- Note that ECMAScript differs from the Java programming language in the
- behavior of Unicode escape sequences. In a Java program, if the Unicode escape
- sequence \u000A, for example, occurs within a single-line comment, it is
- interpreted as a line terminator (Unicode character 000A is line feed) and
- therefore the next character is not part of the comment. Similarly, if the
- Unicode escape sequence \u000A occurs within a string literal in a Java
- program, it is likewise interpreted as a line terminator, which is not
- allowed within a string literal-one must write \n instead of \u000A to
- cause a line feed to be part of the string value of a string literal. In
- an ECMAScript program, a Unicode escape sequence occurring within a comment
- is never interpreted and therefore cannot contribute to termination of the
- comment. Similarly, a Unicode escape sequence occurring within a string literal
- in an ECMAScript program always contributes a character to the string value of
- the literal and is never interpreted as a line terminator or as a quote mark
- that might terminate the string literal.
+ Note that ECMAScript differs from the Java programming language in the
+ behavior of Unicode escape sequences. In a Java program, if the Unicode escape
+ sequence \u000A, for example, occurs within a single-line comment, it is
+ interpreted as a line terminator (Unicode character 000A is line feed) and
+ therefore the next character is not part of the comment. Similarly, if the
+ Unicode escape sequence \u000A occurs within a string literal in a Java
+ program, it is likewise interpreted as a line terminator, which is not
+ allowed within a string literal-one must write \n instead of \u000A to
+ cause a line feed to be part of the string value of a string literal. In
+ an ECMAScript program, a Unicode escape sequence occurring within a comment
+ is never interpreted and therefore cannot contribute to termination of the
+ comment. Similarly, a Unicode escape sequence occurring within a string literal
+ in an ECMAScript program always contributes a character to the string value of
+ the literal and is never interpreted as a line terminator or as a quote mark
+ that might terminate the string literal.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "6-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Source Text";
+var SECTION = "6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Source Text";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// encoded quotes should not end a quote
- // encoded quotes should not end a quote
+new TestCase( SECTION,
+ "var s = 'PAS\\u0022SED'; s",
+ "PAS\"SED",
+ eval("var s = 'PAS\\u0022SED'; s") );
- testcases[tc++]= new TestCase( SECTION,
- "var s = 'PAS\\u0022SED'; s",
- "PAS\"SED",
- eval("var s = 'PAS\\u0022SED'; s") );
-
- testcases[tc++]= new TestCase( SECTION,
- 'var s = "PAS\\u0022SED"; s',
- "PAS\"SED",
- eval('var s = "PAS\\u0022SED"; s') );
+new TestCase( SECTION,
+ 'var s = "PAS\\u0022SED"; s',
+ "PAS\"SED",
+ eval('var s = "PAS\\u0022SED"; s') );
- testcases[tc++]= new TestCase( SECTION,
- "var s = 'PAS\\u0027SED'; s",
- "PAS\'SED",
- eval("var s = 'PAS\\u0027SED'; s") );
+new TestCase( SECTION,
+ "var s = 'PAS\\u0027SED'; s",
+ "PAS\'SED",
+ eval("var s = 'PAS\\u0027SED'; s") );
- testcases[tc++]= new TestCase( SECTION,
- 'var s = "PAS\\u0027SED"; s',
- "PAS\'SED",
- eval('var s = "PAS\\u0027SED"; s') );
+new TestCase( SECTION,
+ 'var s = "PAS\\u0027SED"; s',
+ "PAS\'SED",
+ eval('var s = "PAS\\u0027SED"; s') );
- testcases[tc] = new TestCase( SECTION,
- 'var s="PAS\\u0027SED"; s',
- "PAS\'SED",
- "" )
- var s = "PAS\u0027SED";
+var testcase = new TestCase( SECTION,
+ 'var s="PAS\\u0027SED"; s',
+ "PAS\'SED",
+ "" );
+var s = "PAS\u0027SED";
- testcases[tc].actual = s;
+testcase.actual = s;
- tc++;
+testcase = new TestCase( SECTION,
+ 'var s = "PAS\\u0022SED"; s',
+ "PAS\"SED",
+ "" );
+var s = "PAS\u0022SED";
- testcases[tc]= new TestCase( SECTION,
- 'var s = "PAS\\u0027SED"; s',
- "PAS\"SED",
- "" );
- var s = "PAS\u0022SED";
-
- testcases[tc].actual = s;
+testcase.actual = s;
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/SourceText/browser.js b/mozilla/js/tests/ecma/SourceText/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/SourceText/shell.js b/mozilla/js/tests/ecma/SourceText/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Statements/12.10-1.js b/mozilla/js/tests/ecma/Statements/12.10-1.js
index a5e6166da2b..3938ecdd22e 100644
--- a/mozilla/js/tests/ecma/Statements/12.10-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.10-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,133 +35,115 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.10-1.js
- ECMA Section: 12.10 The with statement
- Description:
- WithStatement :
- with ( Expression ) Statement
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
+ WithStatement :
+ with ( Expression ) Statement
- The with statement adds a computed object to the front of the scope chain
- of the current execution context, then executes a statement with this
- augmented scope chain, then restores the scope chain.
+ The with statement adds a computed object to the front of the scope chain
+ of the current execution context, then executes a statement with this
+ augmented scope chain, then restores the scope chain.
- Semantics
+ Semantics
- The production WithStatement : with ( Expression ) Statement is evaluated
- as follows:
- 1. Evaluate Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Add Result(3) to the front of the scope chain.
- 5. Evaluate Statement using the augmented scope chain from step 4.
- 6. Remove Result(3) from the front of the scope chain.
- 7. Return Result(5).
+ The production WithStatement : with ( Expression ) Statement is evaluated
+ as follows:
+ 1. Evaluate Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Add Result(3) to the front of the scope chain.
+ 5. Evaluate Statement using the augmented scope chain from step 4.
+ 6. Remove Result(3) from the front of the scope chain.
+ 7. Return Result(5).
- Discussion
- Note that no matter how control leaves the embedded Statement, whether
- normally or by some form of abrupt completion, the scope chain is always
- restored to its former state.
+ Discussion
+ Note that no matter how control leaves the embedded Statement, whether
+ normally or by some form of abrupt completion, the scope chain is always
+ restored to its former state.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.10-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The with statment";
+var SECTION = "12.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The with statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // although the scope chain changes, the this value is immutable for a given
- // execution context.
-
- array[item++] = new TestCase( SECTION,
- "with( new Number() ) { this +'' }",
- "[object global]",
- eval("with( new Number() ) { this +'' }") );
-
- // the object's functions and properties should override those of the
- // global object.
-
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(true); with (MYOB) { parseInt() }",
- true,
- eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") );
-
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(false); with (MYOB) { NaN }",
- false,
- eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") );
-
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }",
- Number.NaN,
- eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") );
-
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(false); with (MYOB) { }; Infinity",
- Number.POSITIVE_INFINITY,
- eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") );
+writeHeaderToLog( SECTION + " "+ TITLE);
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }",
- Number.POSITIVE_INFINITY,
- eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") );
+// although the scope chain changes, the this value is immutable for a given
+// execution context.
- // let us leave the with block via a break.
+new TestCase( SECTION,
+ "with( new Number() ) { this +'' }",
+ GLOBAL,
+ eval("with( new Number() ) { this +'' }") );
- array[item++] = new TestCase(
- SECTION,
- "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity",
- Number.POSITIVE_INFINITY,
- eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") );
+// the object's functions and properties should override those of the
+// global object.
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(true); with (MYOB) { parseInt() }",
+ true,
+ eval("var MYOB = new WithObject(true); with (MYOB) { parseInt() }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { NaN }",
+ false,
+ eval("var MYOB = new WithObject(false); with (MYOB) { NaN }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(NaN); with (MYOB) { Infinity }",
+ Number.NaN,
+ eval("var MYOB = new WithObject(NaN); with (MYOB) { Infinity }") );
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(false); with (MYOB) { }; Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(false); with (MYOB) { }; Infinity") );
+
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); with (MYOB) { delete Infinity; Infinity }") );
+
+// let us leave the with block via a break.
+
+new TestCase(
+ SECTION,
+ "var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity",
+ Number.POSITIVE_INFINITY,
+ eval("var MYOB = new WithObject(0); while (true) { with (MYOB) { Infinity; break; } } Infinity") );
+
+
+test();
- return ( array );
-}
function WithObject( value ) {
- this.prop1 = 1;
- this.prop2 = new Boolean(true);
- this.prop3 = "a string";
- this.value = value;
+ this.prop1 = 1;
+ this.prop2 = new Boolean(true);
+ this.prop3 = "a string";
+ this.value = value;
- // now we will override global functions
+ // now we will override global functions
- this.parseInt = new Function( "return this.value" );
- this.NaN = value;
- this.Infinity = value;
- this.unescape = new Function( "return this.value" );
- this.escape = new Function( "return this.value" );
- this.eval = new Function( "return this.value" );
- this.parseFloat = new Function( "return this.value" );
- this.isNaN = new Function( "return this.value" );
- this.isFinite = new Function( "return this.value" );
+ this.parseInt = new Function( "return this.value" );
+ this.NaN = value;
+ this.Infinity = value;
+ this.unescape = new Function( "return this.value" );
+ this.escape = new Function( "return this.value" );
+ this.eval = new Function( "return this.value" );
+ this.parseFloat = new Function( "return this.value" );
+ this.isNaN = new Function( "return this.value" );
+ this.isFinite = new Function( "return this.value" );
}
diff --git a/mozilla/js/tests/ecma/Statements/12.10.js b/mozilla/js/tests/ecma/Statements/12.10.js
index a53b97d1087..5d4d659296d 100644
--- a/mozilla/js/tests/ecma/Statements/12.10.js
+++ b/mozilla/js/tests/ecma/Statements/12.10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,25 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.10-1.js
- ECMA Section: 12.10 The with statement
- Description:
+ File Name: 12.10-1.js
+ ECMA Section: 12.10 The with statement
+ Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.10-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The with statement";
+var SECTION = "12.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The with statement";
- var testcases = getTestCases();
+writeHeaderToLog( SECTION +" "+ TITLE);
- writeHeaderToLog( SECTION +" "+ TITLE);
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var x; with (7) x = valueOf(); typeof x;",
- "number",
- eval("var x; with(7) x = valueOf(); typeof x;") );
- return ( array );
-}
+new TestCase( SECTION,
+ "var x; with (7) x = valueOf(); typeof x;",
+ "number",
+ eval("var x; with(7) x = valueOf(); typeof x;") );
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.2-1.js b/mozilla/js/tests/ecma/Statements/12.2-1.js
index 5beca24d8ee..69e5a93f12f 100644
--- a/mozilla/js/tests/ecma/Statements/12.2-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.2-1.js
- ECMA Section: The variable statement
- Description:
+ File Name: 12.2-1.js
+ ECMA Section: The variable statement
+ Description:
- If the variable statement occurs inside a FunctionDeclaration, the
- variables are defined with function-local scope in that function, as
- described in section 10.1.3. Otherwise, they are defined with global
- scope, that is, they are created as members of the global object, as
- described in section 0. Variables are created when the execution scope
- is entered. A Block does not define a new execution scope. Only Program and
- FunctionDeclaration produce a new scope. Variables are initialized to the
- undefined value when created. A variable with an Initializer is assigned
- the value of its AssignmentExpression when the VariableStatement is executed,
- not when the variable is created.
+ If the variable statement occurs inside a FunctionDeclaration, the
+ variables are defined with function-local scope in that function, as
+ described in section 10.1.3. Otherwise, they are defined with global
+ scope, that is, they are created as members of the global object, as
+ described in section 0. Variables are created when the execution scope
+ is entered. A Block does not define a new execution scope. Only Program and
+ FunctionDeclaration produce a new scope. Variables are initialized to the
+ undefined value when created. A variable with an Initializer is assigned
+ the value of its AssignmentExpression when the VariableStatement is executed,
+ not when the variable is created.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The variable statement";
+var SECTION = "12.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The variable statement";
- writeHeaderToLog( SECTION +" "+ TITLE);
+writeHeaderToLog( SECTION +" "+ TITLE);
- var testcases = new Array();
+new TestCase( "SECTION",
+ "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
+ void 0,
+ eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
- testcases[tc] = new TestCase( "SECTION",
- "var x = 3; function f() { var a = x; var x = 23; return a; }; f()",
- void 0,
- eval("var x = 3; function f() { var a = x; var x = 23; return a; }; f()") );
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.5-1.js b/mozilla/js/tests/ecma/Statements/12.5-1.js
index 5da2b3f6e1d..3d8d601ff60 100644
--- a/mozilla/js/tests/ecma/Statements/12.5-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,80 +35,66 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.5-1.js
- ECMA Section: The if statement
- Description:
+ File Name: 12.5-1.js
+ ECMA Section: The if statement
+ Description:
- The production IfStatement : if ( Expression ) Statement else Statement
- is evaluated as follows:
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
- 1.Evaluate Expression.
- 2.Call GetValue(Result(1)).
- 3.Call ToBoolean(Result(2)).
- 4.If Result(3) is false, go to step 7.
- 5.Evaluate the first Statement.
- 6.Return Result(5).
- 7.Evaluate the second Statement.
- 8.Return Result(7).
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The if statment";
+var SECTION = "12.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The if statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
- "PASSED",
- eval("var MYVAR; if ( true ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
- "PASSED",
- eval("var MYVAR; if ( false ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
- "PASSED",
- eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
- "PASSED",
- eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';",
- "PASSED",
- eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; else MYVAR= 'FAILED';") );
+new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
+ "PASSED",
+ eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';",
- "PASSED",
- eval("var MYVAR; if ( 0 ) MYVAR='FAILED'; else MYVAR= 'PASSED';") );
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.5-2.js b/mozilla/js/tests/ecma/Statements/12.5-2.js
index 22bfc8ab483..02acbf1da5a 100644
--- a/mozilla/js/tests/ecma/Statements/12.5-2.js
+++ b/mozilla/js/tests/ecma/Statements/12.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,63 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.5-2.js
- ECMA Section: The if statement
- Description:
+ File Name: 12.5-2.js
+ ECMA Section: The if statement
+ Description:
- The production IfStatement : if ( Expression ) Statement else Statement
- is evaluated as follows:
+ The production IfStatement : if ( Expression ) Statement else Statement
+ is evaluated as follows:
- 1.Evaluate Expression.
- 2.Call GetValue(Result(1)).
- 3.Call ToBoolean(Result(2)).
- 4.If Result(3) is false, go to step 7.
- 5.Evaluate the first Statement.
- 6.Return Result(5).
- 7.Evaluate the second Statement.
- 8.Return Result(7).
+ 1.Evaluate Expression.
+ 2.Call GetValue(Result(1)).
+ 3.Call ToBoolean(Result(2)).
+ 4.If Result(3) is false, go to step 7.
+ 5.Evaluate the first Statement.
+ 6.Return Result(5).
+ 7.Evaluate the second Statement.
+ 8.Return Result(7).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The if statement" ;
+var SECTION = "12.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The if statement" ;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR",
- "PASSED",
- eval("var MYVAR; if ( true ) MYVAR='PASSED'; MYVAR") );
+new TestCase( SECTION,
+ "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( false ) MYVAR='FAILED'; MYVAR;",
- "PASSED",
- eval("var MYVAR=\"PASSED\"; if ( false ) MYVAR='FAILED'; MYVAR;") );
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR",
- "PASSED",
- eval("var MYVAR; if ( new Boolean(true) ) MYVAR='PASSED'; MYVAR") );
+new TestCase( SECTION,
+ "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR",
- "PASSED",
- eval("var MYVAR; if ( new Boolean(false) ) MYVAR='PASSED'; MYVAR") );
+new TestCase( SECTION,
+ "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR",
+ "PASSED",
+ eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR",
- "PASSED",
- eval("var MYVAR; if ( 1 ) MYVAR='PASSED'; MYVAR") );
+new TestCase( SECTION,
+ "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;",
+ "PASSED",
+ eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") );
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR; if ( 0 ) MYVAR='FAILED'; MYVAR;",
- "PASSED",
- eval("var MYVAR=\"PASSED\"; if ( 0 ) MYVAR='FAILED'; MYVAR;") );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.6.1-1.js b/mozilla/js/tests/ecma/Statements/12.6.1-1.js
index 5a2ba4d3520..1746b688acb 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.1-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.1-1.js
- ECMA Section: The while statement
- Description:
+ File Name: 12.6.1-1.js
+ ECMA Section: The while statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.6.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The While statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+var SECTION = "12.6.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The While statement";
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ",
- 1,
- eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR "));
+new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR ",
+ 1,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) break; } MYVAR "));
- testcases[tc++] = new TestCase( SECTION,
- "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ",
- 100,
- eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR "));
+new TestCase( SECTION,
+ "var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR ",
+ 100,
+ eval("var MYVAR = 0; while( MYVAR++ < 100) { if ( MYVAR < 100 ) continue; else break; } MYVAR "));
- testcases[tc++] = new TestCase( SECTION,
- "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)",
- 2,
- eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)"));
- test();
+new TestCase( SECTION,
+ "function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)",
+ 2,
+ eval("function MYFUN( arg1 ) { while ( arg1++ < 100 ) { if ( arg1 < 100 ) return arg1; } }; MYFUN(1)"));
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-1.js b/mozilla/js/tests/ecma/Statements/12.6.2-1.js
index 1a7c5a74916..963e954ce0d 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-1.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-1.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is not present
- 3. third expression is not present
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new getTestCases();
+new TestCase( "12.6.2-1", "for statement", 99, testprogram() );
- test();
+test();
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( "12.6.2-1", "for statement", 99, "" );
- return ( array );
-}
function testprogram() {
- myVar = 0;
+ myVar = 0;
- for ( ; ; ) {
- if ( ++myVar == 99 )
- break;
- }
+ for ( ; ; ) {
+ if ( ++myVar == 99 )
+ break;
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
-
- stopTest();
-
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-2.js b/mozilla/js/tests/ecma/Statements/12.6.2-2.js
index 7f62388ebb3..33720b6da4f 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-2.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,58 +35,40 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-2.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-2.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is not present
- 3. third expression is present
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "for statement", 99, testprogram() );
- test();
-
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( SECTION, "for statement", 99, "" );
- return ( array );
-}
+test();
function testprogram() {
- myVar = 0;
+ myVar = 0;
- for ( ; ; myVar++ ) {
- if ( myVar < 99 ) {
- continue;
- } else {
- break;
- }
+ for ( ; ; myVar++ ) {
+ if ( myVar < 99 ) {
+ continue;
+ } else {
+ break;
}
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
-
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-3.js b/mozilla/js/tests/ecma/Statements/12.6.2-3.js
index 2672f165a83..bcf477c5796 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-3.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-3.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-3.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is present
- 3. third expression is present
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- testcases[0] = new TestCase( SECTION, "for statement", 100, "" );
+new TestCase( SECTION, "for statement", 100, testprogram() );
- test();
+test();
function testprogram() {
- myVar = 0;
+ myVar = 0;
- for ( ; myVar < 100 ; myVar++ ) {
- continue;
- }
+ for ( ; myVar < 100 ; myVar++ ) {
+ continue;
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
- stopTest();
-
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-4.js b/mozilla/js/tests/ecma/Statements/12.6.2-4.js
index d1b97ba5cee..66e32df4ab3 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-4.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-4.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-4.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is present
- 3. third expression is present
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION, "for statement", 100, testprogram() );
- testcases[testcases.length] = new TestCase( SECTION,
- "for statement", 100, testprogram() );
-
- test();
+test();
function testprogram() {
- myVar = 0;
+ myVar = 0;
- for ( ; myVar < 100 ; myVar++ ) {
- }
+ for ( ; myVar < 100 ; myVar++ ) {
+ }
- return myVar;
-}
-function test() {
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-5.js b/mozilla/js/tests/ecma/Statements/12.6.2-5.js
index 74610555117..53d6f3146ce 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-5.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-5.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-5.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is present
- 3. third expression is present
+ 1. first expression is not present.
+ 2. second expression is present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "for statement", 99, testprogram() );
- test();
-
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( SECTION, "for statement", 99, "" );
- return ( array );
-}
+test();
function testprogram() {
- myVar = 0;
+ myVar = 0;
- for ( ; myVar < 100 ; myVar++ ) {
- if (myVar == 99)
- break;
- }
+ for ( ; myVar < 100 ; myVar++ ) {
+ if (myVar == 99)
+ break;
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-6.js b/mozilla/js/tests/ecma/Statements/12.6.2-6.js
index ed67b89bdbb..ca066af5f7a 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-6.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,57 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-6.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-6.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is present.
- 2. second expression is not present
- 3. third expression is present
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( "12.6.2-6", "for statement", 256, testprogram() );
- test();
-
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( "12.6.2-6", "for statement", 256, "" );
- return ( array );
-}
+test();
function testprogram() {
- var myVar;
+ var myVar;
- for ( myVar=2; ; myVar *= myVar ) {
+ for ( myVar=2; ; myVar *= myVar ) {
- if (myVar > 100)
- break;
- continue;
- }
+ if (myVar > 100)
+ break;
+ continue;
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
-
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-7.js b/mozilla/js/tests/ecma/Statements/12.6.2-7.js
index 0584681f7bc..9803f4b2b12 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-7.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-7.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-7.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is present.
- 2. second expression is not present
- 3. third expression is present
+ 1. first expression is present.
+ 2. second expression is not present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-7";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-7";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "for statement", 256, testprogram() );
- test();
-
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( SECTION, "for statement", 256, "" );
- return ( array );
-}
+test();
function testprogram() {
- var myVar;
+ var myVar;
- for ( myVar=2; myVar < 100 ; myVar *= myVar ) {
+ for ( myVar=2; myVar < 100 ; myVar *= myVar ) {
- continue;
- }
+ continue;
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-8.js b/mozilla/js/tests/ecma/Statements/12.6.2-8.js
index d0ee79c6cf6..e5835c5aa00 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-8.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-8.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-8.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-8.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is present.
- 2. second expression is present
- 3. third expression is present
+ 1. first expression is present.
+ 2. second expression is present
+ 3. third expression is present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-8";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-8";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION, "for statement", 256, testprogram() );
- test();
+test();
-function getTestCases() {
- var array = new Array();
- array[0] = new TestCase( SECTION, "for statement", 256, "" );
- return ( array );
-}
function testprogram() {
- var myVar;
+ var myVar;
- for ( myVar=2; myVar < 256; myVar *= myVar ) {
- }
+ for ( myVar=2; myVar < 256; myVar *= myVar ) {
+ }
- return myVar;
-}
-function test() {
- testcases[0].actual = testprogram();
-
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
- stopTest();
- return ( testcases );
+ return myVar;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.2-9-n.js b/mozilla/js/tests/ecma/Statements/12.6.2-9-n.js
index b0282b4935c..4b7dbf98cce 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.2-9-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.2-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,47 +35,40 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.2-9-n.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is not present
- 3. third expression is not present
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "12.6.2-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for statment";
+var SECTION = "12.6.2-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+DESCRIPTION = "for (i)";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "for (i)",
- "error",
- "" );
+new TestCase( SECTION,
+ "for (i)",
+ "error",
+ eval("for (i) { }") );
- for (i) {
- }
+/*
+ for (i) {
+ }
- test();
+*/
+test();
-function test() {
- testcases[0].passed = writeTestCaseResult(
- testcases[0].expect,
- testcases[0].actual,
- testcases[0].description +" = "+ testcases[0].actual );
-
- testcases[0].reason += ( testcases[0].passed ) ? "" : "wrong value ";
-
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-1.js b/mozilla/js/tests/ecma/Statements/12.6.3-1.js
index f6b23a7db47..43ebcac8f09 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-1.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+/**
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION,
+ "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x",
+ "foo",
+ eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") );
- test();
+test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var x; Number.prototype.foo = 34; for ( j in 7 ) x = j; x",
- "foo",
- eval("var x; Number.prototype.foo = 34; for ( j in 7 ){x = j;} x") );
-
- return ( array );
-}
-
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function MyObject(a, b, c, d, e) {
-
-
-}
\ No newline at end of file
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-10.js b/mozilla/js/tests/ecma/Statements/12.6.3-10.js
index 4f4363f1951..3194a60d772 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-10.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-10.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,94 +35,79 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-10.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-10.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-10";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-10";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+var count = 0;
+function f() { count++; return new Array("h","e","l","l","o"); }
- var count = 0;
- function f() { count++; return new Array("h","e","l","l","o"); }
+var result = "";
+for ( p in f() ) { result += f()[p] };
- var result = "";
- for ( p in f() ) { result += f()[p] };
+new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
- testcases[testcases.length] = new TestCase( SECTION,
- "count = 0; result = \"\"; "+
- "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
- "for ( p in f() ) { result += f()[p] }; count",
- 6,
- count );
+new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
- testcases[testcases.length] = new TestCase( SECTION,
- "result",
- "hello",
- result );
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
- // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
- // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
- // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
- // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
- // LeftHandSideExpression:CallExpression:MemberExpression Arguments
- // LeftHandSideExpression:CallExpression Arguments
- // LeftHandSideExpression:CallExpression [ Expression ]
- // LeftHandSideExpression:CallExpression . Identifier
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-11.js b/mozilla/js/tests/ecma/Statements/12.6.3-11.js
index c6382359bd9..8d58550609a 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-11.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-11.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,75 +35,62 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-11.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-11.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-11";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-11";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
// 5. Get the name of the next property of Result(3) that doesn't have the
// DontEnum attribute. If there is no such property, go to step 14.
- var result = "";
+var result = "";
- for ( p in Number ) { result += String(p) };
+for ( p in Number ) { result += String(p) };
- testcases[testcases.length] = new TestCase( SECTION,
- "result = \"\"; for ( p in Number ) { result += String(p) };",
- "",
- result );
+new TestCase( SECTION,
+ "result = \"\"; for ( p in Number ) { result += String(p) };",
+ "",
+ result );
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-12.js b/mozilla/js/tests/ecma/Statements/12.6.3-12.js
index 3ed0197bc50..b2cc65be26c 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-12.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-12.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,81 +36,65 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 12.6.3-12.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
+ File Name: 12.6.3-12.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
- This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802.
+ This is a regression test for http://bugzilla.mozilla.org/show_bug.cgi?id=9802.
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-12";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-12";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var result = "PASSED";
- var result = "PASSED";
+for ( aVar in this ) {
+ if (aVar == "aVar") {
+ result = "FAILED"
+ }
+};
- for ( aVar in this ) {
- if (aVar == "aVar") {
- result = "FAILED"
- }
- };
+new TestCase(
+ SECTION,
+ "var result=''; for ( aVar in this ) { " +
+ "if (aVar == 'aVar') {return a failure}; result",
+ "PASSED",
+ result );
- testcases[testcases.length] = new TestCase(
- SECTION,
- "var result=''; for ( aVar in this ) { " +
- "if (aVar == 'aVar') {return a failure}; result",
- "PASSED",
- result );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-19.js b/mozilla/js/tests/ecma/Statements/12.6.3-19.js
index 3f4aea45da2..8d0e1e41679 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-19.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-19.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,96 +35,81 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+var count = 0;
+function f() { count++; return new Array("h","e","l","l","o"); }
- var count = 0;
- function f() { count++; return new Array("h","e","l","l","o"); }
+var result = "";
+for ( p in f() ) { result += f()[p] };
- var result = "";
- for ( p in f() ) { result += f()[p] };
+new TestCase( SECTION,
+ "count = 0; result = \"\"; "+
+ "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
+ "for ( p in f() ) { result += f()[p] }; count",
+ 6,
+ count );
- testcases[testcases.length] = new TestCase( SECTION,
- "count = 0; result = \"\"; "+
- "function f() { count++; return new Array(\"h\",\"e\",\"l\",\"l\",\"o\"); }"+
- "for ( p in f() ) { result += f()[p] }; count",
- 6,
- count );
-
- testcases[testcases.length] = new TestCase( SECTION,
- "result",
- "hello",
- result );
+new TestCase( SECTION,
+ "result",
+ "hello",
+ result );
- // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
- // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
- // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
- // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
- // LeftHandSideExpression:CallExpression:MemberExpression Arguments
- // LeftHandSideExpression:CallExpression Arguments
- // LeftHandSideExpression:CallExpression [ Expression ]
- // LeftHandSideExpression:CallExpression . Identifier
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-2.js b/mozilla/js/tests/ecma/Statements/12.6.3-2.js
index de7ba5217e2..0c958c0d093 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-2.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-2.js
- ECMA Section: 12.6.3 The for...in Statement
- Description: Check the Boolean Object
+ File Name: 12.6.3-2.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description: Check the Boolean Object
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+new TestCase( SECTION,
+ "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]",
+ 34,
+ eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j]",
- 34,
- eval("Boolean.prototype.foo = 34; for ( j in Boolean ) Boolean[j] ") );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-3.js b/mozilla/js/tests/ecma/Statements/12.6.3-3.js
index f537715759a..caa750f0b52 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-3.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-3.js
- ECMA Section: for..in loops
- Description:
+ File Name: 12.6.3-3.js
+ ECMA Section: for..in loops
+ Description:
- This verifies the fix to
- http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156
- for..in should take general lvalue for first argument
+ This verifies the fix to
+ http://scopus.mcom.com/bugsplat/show_bug.cgi?id=112156
+ for..in should take general lvalue for first argument
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.6.3-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
+var SECTION = "12.6.3-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+var o = {};
+var result = "";
- var o = {};
+for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); }
- var result = "";
+new TestCase( SECTION,
+ "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result",
+ "123",
+ result );
- for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); }
+test();
- testcases[testcases.length] = new TestCase( SECTION,
- "for ( o.a in [1,2,3] ) { result += String( [1,2,3][o.a] ); } result",
- "123",
- result );
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-4.js b/mozilla/js/tests/ecma/Statements/12.6.3-4.js
index d5eccc9e258..3d89dbc2850 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-4.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,175 +35,166 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression (it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=344855";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+var o = new MyObject();
+var result = 0;
- var o = new MyObject();
- var result = 0;
-
- for ( MyObject in o ) {
- result += o[MyObject];
- }
-
- testcases[testcases.length] = new TestCase( SECTION,
- "for ( MyObject in o ) { result += o[MyObject] }",
- 6,
- result );
-
- var result = 0;
-
- for ( value in o ) {
- result += o[value];
- }
-
- testcases[testcases.length] = new TestCase( SECTION,
- "for ( value in o ) { result += o[value]",
- 6,
- result );
-
- var value = "value";
- var result = 0;
- for ( value in o ) {
- result += o[value];
- }
-
- testcases[testcases.length] = new TestCase( SECTION,
- "value = \"value\"; for ( value in o ) { result += o[value]",
- 6,
- result );
-
- var value = 0;
- var result = 0;
- for ( value in o ) {
- result += o[value];
- }
-
- testcases[testcases.length] = new TestCase( SECTION,
- "value = 0; for ( value in o ) { result += o[value]",
- 6,
- result );
-
- // this causes a segv
-
- var ob = { 0:"hello" };
- var result = 0;
- for ( ob[0] in o ) {
- result += o[ob[0]];
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]",
- 6,
- result );
-
- var result = 0;
- for ( ob["0"] in o ) {
- result += o[ob["0"]];
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]",
- 6,
- result );
-
- var result = 0;
- var ob = { value:"hello" };
- for ( ob[value] in o ) {
- result += o[ob[value]];
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]",
- 6,
- result );
-
- var result = 0;
- for ( ob["value"] in o ) {
- result += o[ob["value"]];
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]",
- 6,
- result );
-
- var result = 0;
- for ( ob.value in o ) {
- result += o[ob.value];
- }
- testcases[testcases.length] = new TestCase( SECTION,
- "value = 0; for ( ob.value in o ) { result += o[ob.value]",
- 6,
- result );
-
- // LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
- // LeftHandSideExpression:NewExpression:MemberExpression . Identifier
- // LeftHandSideExpression:NewExpression:new MemberExpression Arguments
- // LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
- // LeftHandSideExpression:CallExpression:MemberExpression Arguments
- // LeftHandSideExpression:CallExpression Arguments
- // LeftHandSideExpression:CallExpression [ Expression ]
- // LeftHandSideExpression:CallExpression . Identifier
-
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+for ( MyObject in o ) {
+ result += o[MyObject];
}
+
+new TestCase( SECTION,
+ "for ( MyObject in o ) { result += o[MyObject] }",
+ 6,
+ result );
+
+var result = 0;
+
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+var value = "value";
+var result = 0;
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "value = \"value\"; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+var value = 0;
+var result = 0;
+for ( value in o ) {
+ result += o[value];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( value in o ) { result += o[value]",
+ 6,
+ result );
+
+// this causes a segv
+
+var ob = { 0:"hello" };
+var result = 0;
+for ( ob[0] in o ) {
+ result += o[ob[0]];
+}
+
+new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[0] in o ) { result += o[ob[0]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob["0"] in o ) {
+ result += o[ob["0"]];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob[\"0\"] in o ) { result += o[o[\"0\"]]",
+ 6,
+ result );
+
+var result = 0;
+var ob = { value:"hello" };
+for ( ob[value] in o ) {
+ result += o[ob[value]];
+}
+
+new TestCase( SECTION,
+ "ob = { 0:\"hello\" }; for ( ob[value] in o ) { result += o[ob[value]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob["value"] in o ) {
+ result += o[ob["value"]];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob[\"value\"] in o ) { result += o[ob[\"value\"]]",
+ 6,
+ result );
+
+var result = 0;
+for ( ob.value in o ) {
+ result += o[ob.value];
+}
+
+new TestCase( SECTION,
+ "value = 0; for ( ob.value in o ) { result += o[ob.value]",
+ 6,
+ result );
+
+// LeftHandSideExpression:NewExpression:MemberExpression [ Expression ]
+// LeftHandSideExpression:NewExpression:MemberExpression . Identifier
+// LeftHandSideExpression:NewExpression:new MemberExpression Arguments
+// LeftHandSideExpression:NewExpression:PrimaryExpression:( Expression )
+// LeftHandSideExpression:CallExpression:MemberExpression Arguments
+// LeftHandSideExpression:CallExpression Arguments
+// LeftHandSideExpression:CallExpression [ Expression ]
+// LeftHandSideExpression:CallExpression . Identifier
+
+test();
+
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
+ this.value = 2;
+ this[0] = 4;
+ return this;
}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-5-n.js b/mozilla/js/tests/ecma/Statements/12.6.3-5-n.js
index 9e2d88a8484..3eeb56faef3 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-5-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var error = err;
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var error = err;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+DESCRIPTION = "more than one member expression";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "more than one member expression",
- "error",
- "" );
+new TestCase( SECTION,
+ "more than one member expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( var i, p in this) { result += this[p]; }") );
- var o = new MyObject();
- var result = 0;
+/*
+ var o = new MyObject();
+ var result = 0;
- for ( var i, p in this) {
- result += this[p];
- }
+ for ( var i, p in this) {
+ result += this[p];
+ }
+*/
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-6-n.js b/mozilla/js/tests/ecma/Statements/12.6.3-6-n.js
index 5db04edac24..0e6a12da653 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-6-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-6-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var error = err;
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var error = err;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "bad left-hand side expression",
- "error",
- "" );
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( this in o) { result += this[p]; }") );
+/*
+ var o = new MyObject();
+ var result = 0;
- var o = new MyObject();
- var result = 0;
+ for ( this in o) {
+ result += this[p];
+ }
+*/
- for ( this in o) {
- result += this[p];
- }
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-7-n.js b/mozilla/js/tests/ecma/Statements/12.6.3-7-n.js
index 0f91d3c40f1..7718ceb73de 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-7-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-7-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var error = err;
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var error = err;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "bad left-hand side expression",
- "error",
- "" );
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( \"a\" in o) { result += this[p]; } ") );
- var o = new MyObject();
- var result = 0;
+/*
+ var o = new MyObject();
+ var result = 0;
- for ( "a" in o) {
- result += this[p];
- }
+ for ( "a" in o) {
+ result += this[p];
+ }
+*/
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-8-n.js b/mozilla/js/tests/ecma/Statements/12.6.3-8-n.js
index be11cf809a2..d35dcf801df 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-8-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-8-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-8-n.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var error = err;
+var SECTION = "12.6.3-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var error = err;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+DESCRIPTION = "bad left-hand side expression";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "bad left-hand side expression",
- "error",
- "" );
+new TestCase( SECTION,
+ "bad left-hand side expression",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( 1 in o) { result += this[p]; } ") );
- var o = new MyObject();
- var result = 0;
+/*
+ var o = new MyObject();
+ var result = 0;
- for ( 1 in o) {
- result += this[p];
- }
+ for ( 1 in o) {
+ result += this[p];
+ }
+*/
- test();
+test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Statements/12.6.3-9-n.js b/mozilla/js/tests/ecma/Statements/12.6.3-9-n.js
index f06936b4f40..bc1e560e78b 100644
--- a/mozilla/js/tests/ecma/Statements/12.6.3-9-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.6.3-9-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,84 +35,74 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.6.3-9-n.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "12.6.3-9-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The for..in statment";
- var error = err;
+var SECTION = "12.6.3-9-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The for..in statement";
+var error = err;
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// for ( LeftHandSideExpression in Expression )
+// LeftHandSideExpression:NewExpression:MemberExpression
- // for ( LeftHandSideExpression in Expression )
- // LeftHandSideExpression:NewExpression:MemberExpression
+DESCRIPTION = "object is not defined";
+EXPECTED = "error";
- testcases[testcases.length] = new TestCase( SECTION,
- "object is not defined",
- "error",
- "" );
+new TestCase( SECTION,
+ "object is not defined",
+ "error",
+ eval("var o = new MyObject(); var result = 0; for ( var o in foo) { result += this[o]; } ") );
+/*
+ var o = new MyObject();
+ var result = 0;
- var o = new MyObject();
- var result = 0;
+ for ( var o in foo) {
+ result += this[o];
+ }
+*/
- for ( var o in foo) {
- result += this[o];
- }
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma/Statements/12.7-1-n.js b/mozilla/js/tests/ecma/Statements/12.7-1-n.js
index 8cffef5eb00..f0b7f757bfc 100644
--- a/mozilla/js/tests/ecma/Statements/12.7-1-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.7-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,28 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.7-1-n.js
- ECMA Section: 12.7 The continue statement
- Description:
+ File Name: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.7.1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The continue statment";
+var SECTION = "12.7.1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The continue statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+DESCRIPTION = "continue";
+EXPECTED = "error";
- test();
+new TestCase( SECTION,
+ "continue",
+ "error",
+ eval("continue") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
-
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "continue",
- "error",
- "continue" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.8-1-n.js b/mozilla/js/tests/ecma/Statements/12.8-1-n.js
index ff1ad1c4941..04b22528c34 100644
--- a/mozilla/js/tests/ecma/Statements/12.8-1-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.8-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,51 +35,31 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 12.8-1-n.js
- ECMA Section: 12.8 The break statement
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+/**
+ File Name: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.8-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The break in statment";
+var SECTION = "12.8-1-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The break in statement";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
+DESCRIPTION = "break";
+EXPECTED = "error";
- test();
+new TestCase( SECTION,
+ "break",
+ "error",
+ eval("break") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval( testcases[tc].actual );
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "break",
- "error",
- "break" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/12.9-1-n.js b/mozilla/js/tests/ecma/Statements/12.9-1-n.js
index 1a3cc7f1de9..d1d9384af68 100644
--- a/mozilla/js/tests/ecma/Statements/12.9-1-n.js
+++ b/mozilla/js/tests/ecma/Statements/12.9-1-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,46 +35,27 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 12.9-1-n.js
- ECMA Section: 12.9 The return statement
- Description:
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.9-1-n";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "12.9-1-n";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " The return statement");
- test();
+writeHeaderToLog( SECTION + " The return statement");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+DESCRIPTION = "return";
+EXPECTED = "error";
- testcases[tc].actual = eval( testcases[tc].actual );
+new TestCase( SECTION,
+ "return",
+ "error",
+ eval("return") );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "return",
- "error",
- "return" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/Statements/browser.js b/mozilla/js/tests/ecma/Statements/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Statements/shell.js b/mozilla/js/tests/ecma/Statements/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/String/15.5.1.js b/mozilla/js/tests/ecma/String/15.5.1.js
index 53826d513d7..7cb5c93fe2b 100644
--- a/mozilla/js/tests/ecma/String/15.5.1.js
+++ b/mozilla/js/tests/ecma/String/15.5.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,118 +35,98 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.1.js
- ECMA Section: 15.5.1 The String Constructor called as a Function
- 15.5.1.1 String(value)
- 15.5.1.2 String()
+ File Name: 15.5.1.js
+ ECMA Section: 15.5.1 The String Constructor called as a Function
+ 15.5.1.1 String(value)
+ 15.5.1.2 String()
- Description:
When String is called as a function rather than as
- a constructor, it performs a type conversion.
- - String(value) returns a string value (not a String
- object) computed by ToString(value)
- - String() returns the empty string ""
+ Description: When String is called as a function rather than as
+ a constructor, it performs a type conversion.
+ - String(value) returns a string value (not a String
+ object) computed by ToString(value)
+ - String() returns the empty string ""
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The String Constructor Called as a Function";
+var SECTION = "15.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String Constructor Called as a Function";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') );
- array[item++] = new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) );
- array[item++] = new TestCase( SECTION, "String(null)", "null", String( null ) );
- array[item++] = new TestCase( SECTION, "String(true)", "true", String( true) );
- array[item++] = new TestCase( SECTION, "String(false)", "false", String( false ) );
- array[item++] = new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) );
- array[item++] = new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) );
- array[item++] = new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) );
- array[item++] = new TestCase( SECTION, "String(new Array())", "", String( new Array()) );
- array[item++] = new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) );
+new TestCase( SECTION, "String('string primitive')", "string primitive", String('string primitive') );
+new TestCase( SECTION, "String(void 0)", "undefined", String( void 0) );
+new TestCase( SECTION, "String(null)", "null", String( null ) );
+new TestCase( SECTION, "String(true)", "true", String( true) );
+new TestCase( SECTION, "String(false)", "false", String( false ) );
+new TestCase( SECTION, "String(Boolean(true))", "true", String(Boolean(true)) );
+new TestCase( SECTION, "String(Boolean(false))", "false", String(Boolean(false)) );
+new TestCase( SECTION, "String(Boolean())", "false", String(Boolean(false)) );
+new TestCase( SECTION, "String(new Array())", "", String( new Array()) );
+new TestCase( SECTION, "String(new Array(1,2,3))", "1,2,3", String( new Array(1,2,3)) );
- array[item++] = new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) );
- array[item++] = new TestCase( SECTION, "String( 0 )", "0", String( 0 ) );
- array[item++] = new TestCase( SECTION, "String( -0 )", "0", String( -0 ) );
- array[item++] = new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) );
- array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+new TestCase( SECTION, "String( Number.NaN )", "NaN", String( Number.NaN ) );
+new TestCase( SECTION, "String( 0 )", "0", String( 0 ) );
+new TestCase( SECTION, "String( -0 )", "0", String( -0 ) );
+new TestCase( SECTION, "String( Number.POSITIVE_INFINITY )", "Infinity", String( Number.POSITIVE_INFINITY ) );
+new TestCase( SECTION, "String( Number.NEGATIVE_INFINITY )", "-Infinity", String( Number.NEGATIVE_INFINITY ) );
+new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
- // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+// cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
- array[item++] = new TestCase( SECTION, "String( 1 )", "1", String( 1 ) );
- array[item++] = new TestCase( SECTION, "String( 10 )", "10", String( 10 ) );
- array[item++] = new TestCase( SECTION, "String( 100 )", "100", String( 100 ) );
- array[item++] = new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) );
- array[item++] = new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) );
- array[item++] = new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) );
- array[item++] = new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) );
+new TestCase( SECTION, "String( 1 )", "1", String( 1 ) );
+new TestCase( SECTION, "String( 10 )", "10", String( 10 ) );
+new TestCase( SECTION, "String( 100 )", "100", String( 100 ) );
+new TestCase( SECTION, "String( 1000 )", "1000", String( 1000 ) );
+new TestCase( SECTION, "String( 10000 )", "10000", String( 10000 ) );
+new TestCase( SECTION, "String( 10000000000 )", "10000000000", String( 10000000000 ) );
+new TestCase( SECTION, "String( 10000000000000000000 )", "10000000000000000000", String( 10000000000000000000 ) );
+new TestCase( SECTION, "String( 100000000000000000000 )","100000000000000000000",String( 100000000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) );
- array[item++] = new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) );
+new TestCase( SECTION, "String( 12345 )", "12345", String( 12345 ) );
+new TestCase( SECTION, "String( 1234567890 )", "1234567890", String( 1234567890 ) );
- array[item++] = new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
- array[item++] = new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) );
- array[item++] = new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) );
- array[item++] = new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) );
- array[item++] = new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) );
- array[item++] = new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) );
+new TestCase( SECTION, "String( -1 )", "-1", String( -1 ) );
+new TestCase( SECTION, "String( -10 )", "-10", String( -10 ) );
+new TestCase( SECTION, "String( -100 )", "-100", String( -100 ) );
+new TestCase( SECTION, "String( -1000 )", "-1000", String( -1000 ) );
+new TestCase( SECTION, "String( -1000000000 )", "-1000000000", String( -1000000000 ) );
+new TestCase( SECTION, "String( -1000000000000000 )", "-1000000000000000", String( -1000000000000000 ) );
+new TestCase( SECTION, "String( -100000000000000000000 )", "-100000000000000000000", String( -100000000000000000000 ) );
+new TestCase( SECTION, "String( -1000000000000000000000 )", "-1e+21", String( -1000000000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) );
- array[item++] = new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) );
+new TestCase( SECTION, "String( -12345 )", "-12345", String( -12345 ) );
+new TestCase( SECTION, "String( -1234567890 )", "-1234567890", String( -1234567890 ) );
- // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
- array[item++] = new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) );
+// cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+new TestCase( SECTION, "String( 1.0000001 )", "1.0000001", String( 1.0000001 ) );
- // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+// cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
- // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+// cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
- array[item++] = new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) );
- array[item++] = new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) );
+new TestCase( SECTION, "String( 1000000000000000000000 )", "1e+21", String( 1000000000000000000000 ) );
+new TestCase( SECTION, "String( 10000000000000000000000 )", "1e+22", String( 10000000000000000000000 ) );
- // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
- array[item++] = new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345));
- array[item++] = new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 ));
+// cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
+new TestCase( SECTION, "String( 1.2345 )", "1.2345", String( 1.2345));
+new TestCase( SECTION, "String( 1.234567890 )", "1.23456789", String( 1.234567890 ));
- array[item++] = new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) );
- array[item++] = new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) );
- array[item++] = new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) );
- array[item++] = new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) );
- array[item++] = new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) );
- array[item++] = new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) );
- array[item++] = new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345));
+new TestCase( SECTION, "String( .12345 )", "0.12345", String(.12345 ) );
+new TestCase( SECTION, "String( .012345 )", "0.012345", String(.012345) );
+new TestCase( SECTION, "String( .0012345 )", "0.0012345", String(.0012345) );
+new TestCase( SECTION, "String( .00012345 )", "0.00012345", String(.00012345) );
+new TestCase( SECTION, "String( .000012345 )", "0.000012345", String(.000012345) );
+new TestCase( SECTION, "String( .0000012345 )", "0.0000012345", String(.0000012345) );
+new TestCase( SECTION, "String( .00000012345 )", "1.2345e-7", String(.00000012345));
- array[item++] = new TestCase( "15.5.2", "String()", "", String() );
+new TestCase( "15.5.2", "String()", "", String() );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.2.js b/mozilla/js/tests/ecma/String/15.5.2.js
index c48e8f82c0f..5bf0c5d3190 100644
--- a/mozilla/js/tests/ecma/String/15.5.2.js
+++ b/mozilla/js/tests/ecma/String/15.5.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,94 +35,73 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.2.js
- ECMA Section: 15.5.2 The String Constructor
- 15.5.2.1 new String(value)
- 15.5.2.2 new String()
-
- Description: When String is called as part of a new expression, it
- is a constructor; it initializes the newly constructed
- object.
-
- - The prototype property of the newly constructed
- object is set to the original String prototype object,
- the one that is the intial value of String.prototype
- - The internal [[Class]] property of the object is "String"
- - The value of the object is ToString(value).
- - If no value is specified, its value is the empty string.
-
- Author: christine@netscape.com
- Date: 1 october 1997
-*/
-
- var SECTION = "15.5.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The String Constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring );
-
- array[item++] = new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString );
-
- array[item++] = new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf );
-
- array[item++] = new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt );
-
- array[item++] = new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt );
-
- array[item++] = new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf );
-
- array[item++] = new TestCase( SECTION, "typeof new String()", "object", typeof new String() );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf );
-
- array[item++] = new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') );
- array[item++] = new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split );
-
- return ( array );
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.2.js
+ ECMA Section: 15.5.2 The String Constructor
+ 15.5.2.1 new String(value)
+ 15.5.2.2 new String()
+
+ Description: When String is called as part of a new expression, it
+ is a constructor; it initializes the newly constructed
+ object.
+
+ - The prototype property of the newly constructed
+ object is set to the original String prototype object,
+ the one that is the intial value of String.prototype
+ - The internal [[Class]] property of the object is "String"
+ - The value of the object is ToString(value).
+ - If no value is specified, its value is the empty string.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+
+new TestCase( SECTION, "typeof new String('string primitive')", "object", typeof new String('string primitive') );
+new TestCase( SECTION, "var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String('string primitive'); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String('string primitive')).valueOf()", 'string primitive', (new String('string primitive')).valueOf() );
+new TestCase( SECTION, "(new String('string primitive')).substring", String.prototype.substring, (new String('string primitive')).substring );
+
+new TestCase( SECTION, "typeof new String(void 0)", "object", typeof new String(void 0) );
+new TestCase( SECTION, "var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(void 0); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(void 0)).valueOf()", "undefined", (new String(void 0)).valueOf() );
+new TestCase( SECTION, "(new String(void 0)).toString", String.prototype.toString, (new String(void 0)).toString );
+
+new TestCase( SECTION, "typeof new String(null)", "object", typeof new String(null) );
+new TestCase( SECTION, "var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(null); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(null)).valueOf()", "null", (new String(null)).valueOf() );
+new TestCase( SECTION, "(new String(null)).valueOf", String.prototype.valueOf, (new String(null)).valueOf );
+
+new TestCase( SECTION, "typeof new String(true)", "object", typeof new String(true) );
+new TestCase( SECTION, "var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(true); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(true)).valueOf()", "true", (new String(true)).valueOf() );
+new TestCase( SECTION, "(new String(true)).charAt", String.prototype.charAt, (new String(true)).charAt );
+
+new TestCase( SECTION, "typeof new String(false)", "object", typeof new String(false) );
+new TestCase( SECTION, "var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(false); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(false)).valueOf()", "false", (new String(false)).valueOf() );
+new TestCase( SECTION, "(new String(false)).charCodeAt", String.prototype.charCodeAt, (new String(false)).charCodeAt );
+
+new TestCase( SECTION, "typeof new String(new Boolean(true))", "object", typeof new String(new Boolean(true)) );
+new TestCase( SECTION, "var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(new Boolean(true)); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String(new Boolean(true))).valueOf()", "true", (new String(new Boolean(true))).valueOf() );
+new TestCase( SECTION, "(new String(new Boolean(true))).indexOf", String.prototype.indexOf, (new String(new Boolean(true))).indexOf );
+
+new TestCase( SECTION, "typeof new String()", "object", typeof new String() );
+new TestCase( SECTION, "var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String()).valueOf()", '', (new String()).valueOf() );
+new TestCase( SECTION, "(new String()).lastIndexOf", String.prototype.lastIndexOf, (new String()).lastIndexOf );
+
+new TestCase( SECTION, "typeof new String('')", "object", typeof new String('') );
+new TestCase( SECTION, "var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()", "[object String]", eval("var TESTSTRING = new String(''); TESTSTRING.toString=Object.prototype.toString;TESTSTRING.toString()") );
+new TestCase( SECTION, "(new String('')).valueOf()", '', (new String('')).valueOf() );
+new TestCase( SECTION, "(new String('')).split", String.prototype.split, (new String('')).split );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.1-1.js b/mozilla/js/tests/ecma/String/15.5.3.1-1.js
index 51c0caf7992..9cf08c02d2f 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.1-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,55 +35,35 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.3.1-1.js
- ECMA Section: 15.5.3.1 Properties of the String Constructor
+ File Name: 15.5.3.1-1.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
- Description: The initial value of String.prototype is the built-in
- String prototype object.
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete, ReadOnly]
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
- This tests the DontEnum attribute.
+ This tests the DontEnum attribute.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.3.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the String Constructor";
+var SECTION = "15.5.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
+new TestCase( SECTION,
+ "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str",
+ "",
+ eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
-
- array[item++] = new TestCase( SECTION,
- "var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str",
- "",
- eval("var str='';for ( p in String ) { if ( p == 'prototype' ) str += p; } str") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.1-2.js b/mozilla/js/tests/ecma/String/15.5.3.1-2.js
index cff00045a0a..8d69bf8efdc 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.1-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.3.1-2.js
- ECMA Section: 15.5.3.1 Properties of the String Constructor
-
- Description: The initial value of String.prototype is the built-in
- String prototype object.
-
- This property shall have the attributes [ DontEnum,
- DontDelete, ReadOnly]
-
- This tests the ReadOnly attribute.
-
- Author: christine@netscape.com
- Date: 1 october 1997
-*/
-
- var SECTION = "15.5.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the String Constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "String.prototype=null;String.prototype",
- String.prototype,
- eval("String.prototype=null;String.prototype") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.3.1-2.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the ReadOnly attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "String.prototype=null;String.prototype",
+ String.prototype,
+ eval("String.prototype=null;String.prototype") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.1-3.js b/mozilla/js/tests/ecma/String/15.5.3.1-3.js
index f1a7d649340..05cff4fdd11 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.1-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,49 +35,29 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.3.1-3.js
- ECMA Section: 15.5.3.1 Properties of the String Constructor
-
- Description: The initial value of String.prototype is the built-in
- String prototype object.
-
- This property shall have the attributes [ DontEnum,
- DontDelete, ReadOnly]
-
- This tests the DontDelete attribute.
-
- Author: christine@netscape.com
- Date: 1 october 1997
-*/
-
- var SECTION = "15.5.3.1-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the String Constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.3.1-3.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
+
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
+
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
+
+ This tests the DontDelete attribute.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+var SECTION = "15.5.3.1-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "delete( String.prototype )", false, eval("delete ( String.prototype )") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.1-4.js b/mozilla/js/tests/ecma/String/15.5.3.1-4.js
index 572e6140a19..e9a3eb3b77f 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.1-4.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.1-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,50 +35,30 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.3.1-4.js
- ECMA Section: 15.5.3.1 Properties of the String Constructor
+ File Name: 15.5.3.1-4.js
+ ECMA Section: 15.5.3.1 Properties of the String Constructor
- Description: The initial value of String.prototype is the built-in
- String prototype object.
+ Description: The initial value of String.prototype is the built-in
+ String prototype object.
- This property shall have the attributes [ DontEnum,
- DontDelete, ReadOnly]
+ This property shall have the attributes [ DontEnum,
+ DontDelete, ReadOnly]
- This tests the DontDelete attribute.
+ This tests the DontDelete attribute.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.3.1-4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the String Constructor";
+var SECTION = "15.5.3.1-4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Constructor";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "delete( String.prototype );String.prototype", String.prototype, eval("delete ( String.prototype );String.prototype") );
- return ( array );
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.2-1.js b/mozilla/js/tests/ecma/String/15.5.3.2-1.js
index c15cca56979..ba831884e47 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.2-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,177 +35,154 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.3.2-1.js
- ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
- Description: Return a string value containing as many characters
- as the number of arguments. Each argument specifies
- one character of the resulting string, with the first
- argument specifying the first character, and so on,
- from left to right. An argument is converted to a
- character by applying the operation ToUint16 and
- regarding the resulting 16bit integeras the Unicode
- encoding of a character. If no arguments are supplied,
- the result is the empty string.
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
- This test covers Basic Latin (range U+0020 - U+007F)
+ This test covers Basic Latin (range U+0020 - U+007F)
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.3.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.fromCharCode()";
+var SECTION = "15.5.3.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode );
+new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode );
+new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") );
+new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length );
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() );
+new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) );
+new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) );
+new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) );
+new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) );
+new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) );
+new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) );
+new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) );
+new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) );
+new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) );
+new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) );
+new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) );
+new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) );
+new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) );
+new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) );
+new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) );
+new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) );
+new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) );
+new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) );
+new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) );
+new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) );
+new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) );
+new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) );
+new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) );
+new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) );
+new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) );
+new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) );
+new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) );
+new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) );
+new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) );
+new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) );
+new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) );
- array[item++] = new TestCase( SECTION, "typeof String.fromCharCode", "function", typeof String.fromCharCode );
- array[item++] = new TestCase( SECTION, "typeof String.prototype.fromCharCode", "undefined", typeof String.prototype.fromCharCode );
- array[item++] = new TestCase( SECTION, "var x = new String(); typeof x.fromCharCode", "undefined", eval("var x = new String(); typeof x.fromCharCode") );
- array[item++] = new TestCase( SECTION, "String.fromCharCode.length", 1, String.fromCharCode.length );
+new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode()", "", String.fromCharCode() );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020)", " ", String.fromCharCode(0x0020) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0021)", "!", String.fromCharCode(0x0021) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0022)", "\"", String.fromCharCode(0x0022) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0023)", "#", String.fromCharCode(0x0023) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0024)", "$", String.fromCharCode(0x0024) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0025)", "%", String.fromCharCode(0x0025) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0026)", "&", String.fromCharCode(0x0026) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0027)", "\'", String.fromCharCode(0x0027) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0028)", "(", String.fromCharCode(0x0028) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0029)", ")", String.fromCharCode(0x0029) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002A)", "*", String.fromCharCode(0x002A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002B)", "+", String.fromCharCode(0x002B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002C)", ",", String.fromCharCode(0x002C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002D)", "-", String.fromCharCode(0x002D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002E)", ".", String.fromCharCode(0x002E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x002F)", "/", String.fromCharCode(0x002F) );
+new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
+new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
+new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
+new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
+new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
+new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
+new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
+new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
+new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
+new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
+new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
+new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
+new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
+new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
+new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
+new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0030)", "0", String.fromCharCode(0x0030) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0031)", "1", String.fromCharCode(0x0031) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0032)", "2", String.fromCharCode(0x0032) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0033)", "3", String.fromCharCode(0x0033) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0034)", "4", String.fromCharCode(0x0034) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0035)", "5", String.fromCharCode(0x0035) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0036)", "6", String.fromCharCode(0x0036) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0037)", "7", String.fromCharCode(0x0037) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0038)", "8", String.fromCharCode(0x0038) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0039)", "9", String.fromCharCode(0x0039) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003A)", ":", String.fromCharCode(0x003A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003B)", ";", String.fromCharCode(0x003B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003C)", "<", String.fromCharCode(0x003C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003D)", "=", String.fromCharCode(0x003D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003E)", ">", String.fromCharCode(0x003E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x003F)", "?", String.fromCharCode(0x003F) );
+new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) );
+new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) );
+new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) );
+new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) );
+new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) );
+new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) );
+new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) );
+new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) );
+new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) );
+new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) );
+new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) );
+new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) );
+new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) );
+new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) );
+new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) );
+new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) );
+new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) );
+new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) );
+new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) );
+new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) );
+new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) );
+new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) );
+new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) );
+new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) );
+new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) );
+new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) );
+new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) );
+new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) );
+new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) );
+new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) );
+new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0040)", "@", String.fromCharCode(0x0040) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0041)", "A", String.fromCharCode(0x0041) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0042)", "B", String.fromCharCode(0x0042) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0043)", "C", String.fromCharCode(0x0043) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0044)", "D", String.fromCharCode(0x0044) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0045)", "E", String.fromCharCode(0x0045) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0046)", "F", String.fromCharCode(0x0046) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0047)", "G", String.fromCharCode(0x0047) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0048)", "H", String.fromCharCode(0x0048) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0049)", "I", String.fromCharCode(0x0049) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004A)", "J", String.fromCharCode(0x004A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004B)", "K", String.fromCharCode(0x004B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004C)", "L", String.fromCharCode(0x004C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004D)", "M", String.fromCharCode(0x004D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004E)", "N", String.fromCharCode(0x004E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x004F)", "O", String.fromCharCode(0x004F) );
+new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) );
+new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) );
+new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) );
+new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) );
+new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) );
+new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) );
+new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) );
+new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) );
+new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) );
+new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) );
+new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) );
+new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) );
+new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) );
+new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) );
+new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) );
+// new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0050)", "P", String.fromCharCode(0x0050) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0051)", "Q", String.fromCharCode(0x0051) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0052)", "R", String.fromCharCode(0x0052) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0053)", "S", String.fromCharCode(0x0053) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0054)", "T", String.fromCharCode(0x0054) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0055)", "U", String.fromCharCode(0x0055) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0056)", "V", String.fromCharCode(0x0056) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0057)", "W", String.fromCharCode(0x0057) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0058)", "X", String.fromCharCode(0x0058) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0059)", "Y", String.fromCharCode(0x0059) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005A)", "Z", String.fromCharCode(0x005A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005B)", "[", String.fromCharCode(0x005B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005C)", "\\", String.fromCharCode(0x005C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005D)", "]", String.fromCharCode(0x005D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005E)", "^", String.fromCharCode(0x005E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x005F)", "_", String.fromCharCode(0x005F) );
-
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0060)", "`", String.fromCharCode(0x0060) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0061)", "a", String.fromCharCode(0x0061) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0062)", "b", String.fromCharCode(0x0062) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0063)", "c", String.fromCharCode(0x0063) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0064)", "d", String.fromCharCode(0x0064) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0065)", "e", String.fromCharCode(0x0065) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0066)", "f", String.fromCharCode(0x0066) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0067)", "g", String.fromCharCode(0x0067) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0068)", "h", String.fromCharCode(0x0068) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0069)", "i", String.fromCharCode(0x0069) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006A)", "j", String.fromCharCode(0x006A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006B)", "k", String.fromCharCode(0x006B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006C)", "l", String.fromCharCode(0x006C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006D)", "m", String.fromCharCode(0x006D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006E)", "n", String.fromCharCode(0x006E) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x006F)", "o", String.fromCharCode(0x006F) );
-
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0070)", "p", String.fromCharCode(0x0070) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0071)", "q", String.fromCharCode(0x0071) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0072)", "r", String.fromCharCode(0x0072) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0073)", "s", String.fromCharCode(0x0073) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0074)", "t", String.fromCharCode(0x0074) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0075)", "u", String.fromCharCode(0x0075) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0076)", "v", String.fromCharCode(0x0076) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0077)", "w", String.fromCharCode(0x0077) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0078)", "x", String.fromCharCode(0x0078) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0079)", "y", String.fromCharCode(0x0079) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007A)", "z", String.fromCharCode(0x007A) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007B)", "{", String.fromCharCode(0x007B) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007C)", "|", String.fromCharCode(0x007C) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007D)", "}", String.fromCharCode(0x007D) );
- array[item++] = new TestCase( SECTION, "String.fromCharCode(0x007E)", "~", String.fromCharCode(0x007E) );
-// array[item++] = new TestCase( SECTION, "String.fromCharCode(0x0020, 0x007F)", "", String.fromCharCode(0x0040, 0x007F) );
-
- return array;
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.2-2.js b/mozilla/js/tests/ecma/String/15.5.3.2-2.js
index 4eb5f0eb2ff..53248fc3f12 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.2-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.2-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,40 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.3.2-2.js
- ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
- Description: Return a string value containing as many characters
- as the number of arguments. Each argument specifies
- one character of the resulting string, with the first
- argument specifying the first character, and so on,
- from left to right. An argument is converted to a
- character by applying the operation ToUint16 and
- regarding the resulting 16bit integeras the Unicode
- encoding of a character. If no arguments are supplied,
- the result is the empty string.
-
- This tests String.fromCharCode with multiple arguments.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
-
- var SECTION = "15.5.3.2-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.fromCharCode()";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING",
- " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
- eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" ));
-
- array[item++] = new TestCase( SECTION,
- "MYSTRING.length",
- 0x007f - 0x0020,
- MYSTRING.length );
- return array;
-}
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.3.2-2.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
+
+ This tests String.fromCharCode with multiple arguments.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+
+var SECTION = "15.5.3.2-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var MYSTRING = String.fromCharCode(eval(\"var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;\")); MYSTRING",
+ " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~",
+ eval( "var MYSTRING = String.fromCharCode(" + eval("var args=''; for ( i = 0x0020; i < 0x007f; i++ ) { args += ( i == 0x007e ) ? i : i + ', '; } args;") +"); MYSTRING" ));
+
+new TestCase( SECTION,
+ "MYSTRING.length",
+ 0x007f - 0x0020,
+ MYSTRING.length );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.3.2-3.js b/mozilla/js/tests/ecma/String/15.5.3.2-3.js
index 049ff205987..55aad4e4f5a 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.2-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,104 +35,85 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.3.2-1.js
- ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
- Description: Return a string value containing as many characters
- as the number of arguments. Each argument specifies
- one character of the resulting string, with the first
- argument specifying the first character, and so on,
- from left to right. An argument is converted to a
- character by applying the operation ToUint16 and
- regarding the resulting 16bit integeras the Unicode
- encoding of a character. If no arguments are supplied,
- the result is the empty string.
+ File Name: 15.5.3.2-1.js
+ ECMA Section: 15.5.3.2 String.fromCharCode( char0, char1, ... )
+ Description: Return a string value containing as many characters
+ as the number of arguments. Each argument specifies
+ one character of the resulting string, with the first
+ argument specifying the first character, and so on,
+ from left to right. An argument is converted to a
+ character by applying the operation ToUint16 and
+ regarding the resulting 16bit integeras the Unicode
+ encoding of a character. If no arguments are supplied,
+ the result is the empty string.
- This test covers Basic Latin (range U+0020 - U+007F)
+ This test covers Basic Latin (range U+0020 - U+007F)
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.3.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.fromCharCode()";
+var SECTION = "15.5.3.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.fromCharCode()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
- ToUint16(CHARCODE),
- (String.fromCharCode(CHARCODE)).charCodeAt(0)
- );
- }
- for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
- ToUint16(CHARCODE),
- (String.fromCharCode(CHARCODE)).charCodeAt(0)
- );
- }
- for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
- ToUint16(CHARCODE),
- (String.fromCharCode(CHARCODE)).charCodeAt(0)
- );
- }
- for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
- ToUint16(CHARCODE),
- (String.fromCharCode(CHARCODE)).charCodeAt(0)
- );
- }
- for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
- ToUint16(CHARCODE),
- (String.fromCharCode(CHARCODE)).charCodeAt(0)
- );
- }
- array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) );
-
- return array;
+for ( CHARCODE = 0; CHARCODE < 256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
}
+for ( CHARCODE = 256; CHARCODE < 65536; CHARCODE+=333 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = 65535; CHARCODE < 65538; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = Math.pow(2,32)-1; CHARCODE < Math.pow(2,32)+1; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+for ( CHARCODE = 0; CHARCODE > -65536; CHARCODE-=3333 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode(" + CHARCODE +")).charCodeAt(0)",
+ ToUint16(CHARCODE),
+ (String.fromCharCode(CHARCODE)).charCodeAt(0)
+ );
+}
+new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+new TestCase( SECTION, "(String.fromCharCode(65536)).charCodeAt(0)", 0, (String.fromCharCode(65536)).charCodeAt(0) );
+new TestCase( SECTION, "(String.fromCharCode(65537)).charCodeAt(0)", 1, (String.fromCharCode(65537)).charCodeAt(0) );
+
+test();
+
function ToUint16( num ) {
- num = Number( num );
- if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
- return 0;
- }
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
- var sign = ( num < 0 ) ? -1 : 1;
+ var sign = ( num < 0 ) ? -1 : 1;
- num = sign * Math.floor( Math.abs( num ) );
- num = num % Math.pow(2,16);
- num = ( num > -65536 && num < 0) ? 65536 + num : num;
- return num;
+ num = sign * Math.floor( Math.abs( num ) );
+ num = num % Math.pow(2,16);
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+ return num;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/String/15.5.3.js b/mozilla/js/tests/ecma/String/15.5.3.js
index a19558c6342..b916ceb4396 100644
--- a/mozilla/js/tests/ecma/String/15.5.3.js
+++ b/mozilla/js/tests/ecma/String/15.5.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,32 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.3.1.js
- ECMA Section: 15.5.3 Properties of the String Constructor
+ File Name: 15.5.3.1.js
+ ECMA Section: 15.5.3 Properties of the String Constructor
- Description: The value of the internal [[Prototype]] property of
- the String constructor is the Function prototype
- object.
+ Description: The value of the internal [[Prototype]] property of
+ the String constructor is the Function prototype
+ object.
- In addition to the internal [[Call]] and [[Construct]]
- properties, the String constructor also has the length
- property, as well as properties described in 15.5.3.1
- and 15.5.3.2.
+ In addition to the internal [[Call]] and [[Construct]]
+ properties, the String constructor also has the length
+ property, as well as properties described in 15.5.3.1
+ and 15.5.3.2.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.3";
- var VERSION = "ECMA_2";
- startTest();
- var passed = true;
- writeHeaderToLog( SECTION + " Properties of the String Constructor" );
+var SECTION = "15.5.3";
+var VERSION = "ECMA_2";
+startTest();
+var passed = true;
+writeHeaderToLog( SECTION + " Properties of the String Constructor" );
- var testcases = getTestCases();
- var tc= 0;
+new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ );
-// all tests must call a function that returns an array of TestCase objects.
- test( testcases );
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype", Function.prototype, String.__proto__ );
- array[item++] = new TestCase( SECTION, "String.length", 1, String.length );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
+new TestCase( SECTION, "String.length", 1, String.length );
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.1.js b/mozilla/js/tests/ecma/String/15.5.4.1.js
index f745952ee42..39fc412ac3d 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,48 +35,26 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.1.js
- ECMA Section: 15.5.4.1 String.prototype.constructor
-
- Description:
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var SECTION = "15.5.4.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.constructor";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String );
- array[item++] = new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()",
- "[object String]",
- eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") );
- return ( array );
-}
-function test( array ) {
- for ( ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.1.js
+ ECMA Section: 15.5.4.1 String.prototype.constructor
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.constructor";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.constructor == String", true, String.prototype.constructor == String );
+
+new TestCase( SECTION, "var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()",
+ "[object String]",
+ eval("var STRING = new String.prototype.constructor('hi'); STRING.getClass = Object.prototype.toString; STRING.getClass()") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.10-1.js b/mozilla/js/tests/ecma/String/15.5.4.10-1.js
index c2bb005f55a..b93236b96a5 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.10-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.10-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,200 +35,181 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.10-1.js
- ECMA Section: 15.5.4.10 String.prototype.substring( start, end )
- Description:
+ File Name: 15.5.4.10-1.js
+ ECMA Section: 15.5.4.10 String.prototype.substring( start, end )
+ Description:
- 15.5.4.10 String.prototype.substring(start, end)
+ 15.5.4.10 String.prototype.substring(start, end)
- Returns a substring of the result of converting this object to a string,
- starting from character position start and running to character position
- end of the string. The result is a string value, not a String object.
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to character position
+ end of the string. The result is a string value, not a String object.
- If either argument is NaN or negative, it is replaced with zero; if either
- argument is larger than the length of the string, it is replaced with the
- length of the string.
+ If either argument is NaN or negative, it is replaced with zero; if either
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
- If start is larger than end, they are swapped.
+ If start is larger than end, they are swapped.
- When the substring method is called with two arguments start and end, the
- following steps are taken:
+ When the substring method is called with two arguments start and end, the
+ following steps are taken:
- 1. Call ToString, giving it the this value as its argument.
- 2. Call ToInteger(start).
- 3. Call ToInteger (end).
- 4. Compute the number of characters in Result(1).
- 5. Compute min(max(Result(2), 0), Result(4)).
- 6. Compute min(max(Result(3), 0), Result(4)).
- 7. Compute min(Result(5), Result(6)).
- 8. Compute max(Result(5), Result(6)).
- 9. Return a string whose length is the difference between Result(8) and
- Result(7), containing characters from Result(1), namely the characters
- with indices Result(7) through Result(8)1, in ascending order.
+ 1. Call ToString, giving it the this value as its argument.
+ 2. Call ToInteger(start).
+ 3. Call ToInteger (end).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(2), 0), Result(4)).
+ 6. Compute min(max(Result(3), 0), Result(4)).
+ 7. Compute min(Result(5), Result(6)).
+ 8. Compute max(Result(5), Result(6)).
+ 9. Return a string whose length is the difference between Result(8) and
+ Result(7), containing characters from Result(1), namely the characters
+ with indices Result(7) through Result(8)1, in ascending order.
- Note that the substring function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the substring function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.10-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.substring( start, end )";
+var SECTION = "15.5.4.10-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.substring( start, end )";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// test cases for when substring is called with no arguments.
- array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+// this is a string object
- // test cases for when substring is called with no arguments.
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
- // this is a string object
+new TestCase( SECTION,
+ "var s = new String(''); s.substring(1,0)",
+ "",
+ eval("var s = new String(''); s.substring(1,0)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); typeof s.substring()",
- "string",
- eval("var s = new String('this is a string object'); typeof s.substring()") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(true, false)",
+ "t",
+ eval("var s = new String('this is a string object'); s.substring(false, true)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(''); s.substring(1,0)",
- "",
- eval("var s = new String(''); s.substring(1,0)") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(true, false)",
- "t",
- eval("var s = new String('this is a string object'); s.substring(false, true)") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(NaN, Infinity)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN, Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN, Infinity)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(Infinity, NaN)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, NaN)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(Infinity, Infinity)",
- "",
- eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity, Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity, Infinity)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(-0.01, 0)",
- "",
- eval("var s = new String('this is a string object'); s.substring(-0.01,0)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01, 0)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-0.01,0)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(s.length, s.length)",
- "",
- eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length, s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length, s.length)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(s.length+1, 0)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1, 0)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1, 0)") );
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)",
- "",
- eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") );
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity, -Infinity)") );
- // this is not a String object, start is not an integer
+// this is not a String object, start is not an integer
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)",
- "1,2,3,4,5",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") );
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(Infinity,-Infinity)") );
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)",
- "1",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") );
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)",
+ "1",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true, false)") );
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')",
- "3",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") );
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')",
+ "3",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4', '5')") );
- // this is an object object
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)",
- "[object ",
- eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") );
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)",
+ "[object ",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,0)") );
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)",
- "Object]",
- eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") );
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8,obj.toString().length)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8, obj.toString().length)") );
- // this is a function object
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)",
- "Function]",
- eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") );
- // this is a number object
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)",
- "NaN",
- eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") );
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8, Infinity)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8,Infinity)") );
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(Infinity, NaN)") );
- // this is the Math object
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)",
- "[ob",
- eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") );
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)",
+ "[ob",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI, -10)") );
- // this is a Boolean object
+// this is a Boolean object
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))",
- "f",
- eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") );
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))",
+ "f",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array(), new Boolean(1))") );
- // this is a user defined object
+// this is a user defined object
- array[item++] = new TestCase( SECTION,
- "var obj = new MyObject( void 0 ); obj.substring(0, 100)",
- "undefined",
- eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") );
+new TestCase( SECTION,
+ "var obj = new MyObject( void 0 ); obj.substring(0, 100)",
+ "undefined",
+ eval( "var obj = new MyObject( void 0 ); obj.substring(0,100)") );
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
-}
\ No newline at end of file
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-1.js b/mozilla/js/tests/ecma/String/15.5.4.11-1.js
index 4cf10671bd5..559febc131b 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,500 +36,480 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-1.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-1.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
-
- // Basic Latin, Latin-1 Supplement, Latin Extended A
- for ( var i = 0; i <= 0x017f; i++ ) {
- var U = new Unicode(i);
+// Basic Latin, Latin-1 Supplement, Latin Extended A
+for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode(i);
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
- }
-
- return array;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-2.js b/mozilla/js/tests/ecma/String/15.5.4.11-2.js
index 570154e6ef1..08d1888d740 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,497 +36,477 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-2.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Georgian
- // Range: U+10A0 to U+10FF
- for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
- var U = new Unicode( i );
+// Georgian
+// Range: U+10A0 to U+10FF
+for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
- }
-
- return array;
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-3.js b/mozilla/js/tests/ecma/String/15.5.4.11-3.js
index ba0bbab65b9..b6757ce2f4a 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,495 +36,476 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-2.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
- for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
- var U = new Unicode(i);
+// Halfwidth and Fullwidth Forms
+// Range: U+FF00 to U+FFEF
+for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ var U = new Unicode(i);
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
- }
-
- return array;
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-4.js b/mozilla/js/tests/ecma/String/15.5.4.11-4.js
index 7c6a662a725..b0c6b510ec2 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-4.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,489 +36,469 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-2.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-2.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// Hiragana (no upper / lower case)
+// Range: U+3040 to U+309F
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Hiragana (no upper / lower case)
- // Range: U+3040 to U+309F
-
- for ( var i = 0x3040; i <= 0x309F; i++ ) {
- var U = new Unicode( i );
+for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
- }
-
- return array;
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
+ this.upper = c;
+ this.lower = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+ if ( c == 0x00FF ) {
+ this.upper = 0x0178;
+ this.lower = c;
+ return this;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ this.upper = c;
+ this.lower = 0x0069;
+ return this;
+ }
+ if ( c == 0x0131 ) {
+ this.upper = 0x0049;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x0178 ) {
+ this.upper = c;
+ this.lower = 0x00FF;
+ return this;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+ if ( c == 0x017F ) {
+ this.upper = 0x0053;
+ this.lower = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c+1;
+ } else {
+ this.upper = c-1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ this.upper = c;
+ this.lower = c + 80;
+ return this;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ this.upper = c -80;
+ this.lower = c;
+ return this;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ this.upper = c;
+ this.lower = c +1;
+ } else {
+ this.upper = c - 1;
+ this.lower = c;
+ }
+ return this;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ this.upper = c - 48;
+ this.lower = c;
+ return this;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ this.upper = c;
+ this.lower = c + 48;
+ return this;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
this.upper = c;
this.lower = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- this.upper = c;
- this.lower = c + 32;
- return this;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- this.upper = c - 32;
- this.lower = c;
- return this;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- this.upper = c;
- this.lower = c + 32;
- return this;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- this.upper = c - 32;
- this.lower = c;
- return this;
- }
- if ( c == 0x00FF ) {
- this.upper = 0x0178;
- this.lower = c;
- return this;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- this.upper = c;
- this.lower = 0x0069;
- return this;
- }
- if ( c == 0x0131 ) {
- this.upper = 0x0049;
- this.lower = c;
- return this;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- this.upper = c;
- this.lower = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- this.upper = c-1;
- this.lower = c;
- }
- return this;
- }
- if ( c == 0x0178 ) {
- this.upper = c;
- this.lower = 0x00FF;
- return this;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- this.upper = c;
- this.lower = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- this.upper = c-1;
- this.lower = c;
- }
- return this;
- }
- if ( c == 0x017F ) {
- this.upper = 0x0053;
- this.lower = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- this.upper = c;
- this.lower = c+1;
- } else {
- this.upper = c-1;
- this.lower = c;
- }
- return this;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- this.upper = c;
- this.lower = c + 80;
- return this;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- this.upper = c;
- this.lower = c + 32;
- return this;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- this.upper = c - 32;
- this.lower = c;
- return this;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- this.upper = c -80;
- this.lower = c;
- return this;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- this.upper = c;
- this.lower = c +1;
- } else {
- this.upper = c - 1;
- this.lower = c;
- }
- return this;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- this.upper = c;
- this.lower = c + 48;
- return this;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- this.upper = c - 48;
- this.lower = c;
- return this;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- this.upper = c;
- this.lower = c + 48;
- return this;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- this.upper = c;
- this.lower = c;
- return this;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- this.upper = c;
- this.lower = c + 32;
- return this;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- this.upper = c - 32;
- this.lower = c;
- return this;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return this;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ this.upper = c;
+ this.lower = c + 32;
+ return this;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ this.upper = c - 32;
+ this.lower = c;
+ return this;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return this;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-5.js b/mozilla/js/tests/ecma/String/15.5.4.11-5.js
index 6167eccba8a..ef42eccacd3 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-5.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,500 +36,482 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-5.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-5.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
- array[item++] = new TestCase( SECTION, "String.prototype.toLowerCase.length", 0, String.prototype.toLowerCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length", false, delete String.prototype.toLowerCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
+new TestCase( SECTION, "delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length", 0, eval("delete String.prototype.toLowerCase.length; String.prototype.toLowerCase.length") );
- // Cyrillic (part)
- // Range: U+0400 to U+04FF
- for ( var i = 0x0400; i <= 0x047F; i++ ) {
- var U = new Unicode( i );
+// Cyrillic (part)
+// Range: U+0400 to U+04FF
+for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
-
- }
- return array;
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.11-6.js b/mozilla/js/tests/ecma/String/15.5.4.11-6.js
index d1faa89fecd..84e8e20893a 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.11-6.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.11-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,497 +36,478 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.11-6.js
- ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
- Description:
+ File Name: 15.5.4.11-6.js
+ ECMA Section: 15.5.4.11 String.prototype.toLowerCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toLowerCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toLowerCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.11-6";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toLowerCase()";
+var SECTION = "15.5.4.11-6";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toLowerCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// Armenian
+// Range: U+0530 to U+058F
+for ( var i = 0x0530; i <= 0x058F; i++ ) {
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Armenian
- // Range: U+0530 to U+058F
- for ( var i = 0x0530; i <= 0x058F; i++ ) {
-
- var U = new Unicode( i );
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
- String.fromCharCode(U.lower),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()",
+ String.fromCharCode(U.lower),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toLowerCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
- U.lower,
- eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toLowerCase().charCodeAt(0)",
+ U.lower,
+ eval("var s = new String( String.fromCharCode(i) ); s.toLowerCase().charCodeAt(0)") );
- }
- return array;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.12-1.js b/mozilla/js/tests/ecma/String/15.5.4.12-1.js
index 2f1f17ef5dd..a728cc16a90 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.12-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.12-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,501 +36,482 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.12-1.js
- ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
- Description:
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toUpperCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.12-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toUpperCase()";
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length );
+new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length );
+new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// Basic Latin, Latin-1 Supplement, Latin Extended A
+for ( var i = 0; i <= 0x017f; i++ ) {
+ var U = new Unicode( i );
- array[item++] = new TestCase( SECTION, "String.prototype.toUpperCase.length", 0, String.prototype.toUpperCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toUpperCase.length", false, delete String.prototype.toUpperCase.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.toupperCase.length; String.prototype.toupperCase.length", 0, eval("delete String.prototype.toUpperCase.length; String.prototype.toUpperCase.length") );
+ // XXX DF fails in java
- // Basic Latin, Latin-1 Supplement, Latin Extended A
- for ( var i = 0; i <= 0x017f; i++ ) {
- var U = new Unicode( i );
-
- // XXX DF fails in java
-
- if ( i == 0x00DF ) {
- continue;
- }
+ if ( i == 0x00DF ) {
+ continue;
+ }
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- U.upper,
- eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
- }
-
- return array;
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.12-2.js b/mozilla/js/tests/ecma/String/15.5.4.12-2.js
index d0294565788..7fe8fbc0d87 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.12-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.12-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,500 +36,480 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.12-2.js
- ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
- Description:
+ File Name: 15.5.4.12-2.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toUpperCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.12-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toUpperCase()";
+var SECTION = "15.5.4.12-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var TEST_STRING = "";
+var EXPECT_STRING = "";
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// basic latin test
- var TEST_STRING = "";
- var EXPECT_STRING = "";
-
- // basic latin test
-
- for ( var i = 0; i < 0x007A; i++ ) {
- var u = new Unicode(i);
- TEST_STRING += String.fromCharCode(i);
- EXPECT_STRING += String.fromCharCode( u.upper );
- }
-
- // don't print out the value of the strings since they contain control
- // characters that break the driver
- var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase();
-
- array[item++] = new TestCase( SECTION,
- "isEqual",
- true,
- isEqual);
- return array;
+for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+// don't print out the value of the strings since they contain control
+// characters that break the driver
+var isEqual = EXPECT_STRING == (new String( TEST_STRING )).toUpperCase();
+
+new TestCase( SECTION,
+ "isEqual",
+ true,
+ isEqual);
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
+ return h;
}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.12-3.js b/mozilla/js/tests/ecma/String/15.5.4.12-3.js
index 24ef4a103ae..8c0d3833be8 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.12-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.12-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,542 +36,521 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.12-3.js
- ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
- Description:
+ File Name: 15.5.4.12-3.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toUpperCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.12-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toUpperCase()";
+var SECTION = "15.5.4.12-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Georgian
- // Range: U+10A0 to U+10FF
- for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
- var U = new Unicode( i );
+// Georgian
+// Range: U+10A0 to U+10FF
+for ( var i = 0x10A0; i <= 0x10FF; i++ ) {
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
- String.fromCharCode(U.upper),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- U.upper,
- eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
- }
+}
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
- for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
- eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+// Halfwidth and Fullwidth Forms
+// Range: U+FF00 to U+FFEF
+for ( var i = 0xFF00; i <= 0xFFEF; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- eval( "var u = new Unicode( i ); u.upper" ),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
- }
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+}
- // Hiragana (no upper / lower case)
- // Range: U+3040 to U+309F
+// Hiragana (no upper / lower case)
+// Range: U+3040 to U+309F
- for ( var i = 0x3040; i <= 0x309F; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
- eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+for ( var i = 0x3040; i <= 0x309F; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ eval( "var u = new Unicode( i ); String.fromCharCode(u.upper)" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- eval( "var u = new Unicode( i ); u.upper" ),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
- }
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ eval( "var u = new Unicode( i ); u.upper" ),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)") );
+}
/*
- var TEST_STRING = "";
- var EXPECT_STRING = "";
+ var TEST_STRING = "";
+ var EXPECT_STRING = "";
- // basic latin test
+ // basic latin test
- for ( var i = 0; i < 0x007A; i++ ) {
- var u = new Unicode(i);
- TEST_STRING += String.fromCharCode(i);
- EXPECT_STRING += String.fromCharCode( u.upper );
- }
+ for ( var i = 0; i < 0x007A; i++ ) {
+ var u = new Unicode(i);
+ TEST_STRING += String.fromCharCode(i);
+ EXPECT_STRING += String.fromCharCode( u.upper );
+ }
*/
+test();
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.12-4.js b/mozilla/js/tests/ecma/String/15.5.4.12-4.js
index fa891f357d1..61f9d7b3f74 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.12-4.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.12-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,497 +36,477 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.12-1.js
- ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
- Description:
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toUpperCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.12-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toUpperCase()";
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Cyrillic (part)
- // Range: U+0400 to U+04FF
- for ( var i = 0x0400; i <= 0x047F; i++ ) {
- var U =new Unicode( i );
+// Cyrillic (part)
+// Range: U+0400 to U+04FF
+for ( var i = 0x0400; i <= 0x047F; i++ ) {
+ var U =new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
- U.upper,
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ U.upper,
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- U.upper,
- eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
- }
-
- return array;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.12-5.js b/mozilla/js/tests/ecma/String/15.5.4.12-5.js
index 6d4ff0da59b..a7588ef0a84 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.12-5.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.12-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,497 +36,477 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.12-1.js
- ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
- Description:
+ File Name: 15.5.4.12-1.js
+ ECMA Section: 15.5.4.12 String.prototype.toUpperCase()
+ Description:
- Returns a string equal in length to the length of the result of converting
- this object to a string. The result is a string value, not a String object.
+ Returns a string equal in length to the length of the result of converting
+ this object to a string. The result is a string value, not a String object.
- Every character of the result is equal to the corresponding character of the
- string, unless that character has a Unicode 2.0 uppercase equivalent, in which
- case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
- mapping shall be used, which does not depend on implementation or locale.)
+ Every character of the result is equal to the corresponding character of the
+ string, unless that character has a Unicode 2.0 uppercase equivalent, in which
+ case the uppercase equivalent is used instead. (The canonical Unicode 2.0 case
+ mapping shall be used, which does not depend on implementation or locale.)
- Note that the toUpperCase function is intentionally generic; it does not require
- that its this value be a String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the toUpperCase function is intentionally generic; it does not require
+ that its this value be a String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.12-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toUpperCase()";
+var SECTION = "15.5.4.12-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toUpperCase()";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // Armenian
- // Range: U+0530 to U+058F
- for ( var i = 0x0530; i <= 0x058F; i++ ) {
- var U = new Unicode( i );
+// Armenian
+// Range: U+0530 to U+058F
+for ( var i = 0x0530; i <= 0x058F; i++ ) {
+ var U = new Unicode( i );
/*
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
- String.fromCharCode(U.upper),
- eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()",
+ String.fromCharCode(U.upper),
+ eval("var s = new String( String.fromCharCode("+i+") ); s.toUpperCase()") );
*/
- array[item++] = new TestCase( SECTION,
- "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
- U.upper,
- eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
+ new TestCase( SECTION,
+ "var s = new String( String.fromCharCode("+i+") ); s.toUpperCase().charCodeAt(0)",
+ U.upper,
+ eval("var s = new String( String.fromCharCode(i) ); s.toUpperCase().charCodeAt(0)") );
- }
-
- return array;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+test();
+
function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
}
function Unicode( c ) {
- u = GetUnicodeValues( c );
- this.upper = u[0];
- this.lower = u[1]
+ u = GetUnicodeValues( c );
+ this.upper = u[0];
+ this.lower = u[1]
return this;
}
function GetUnicodeValues( c ) {
- u = new Array();
+ u = new Array();
+ u[0] = c;
+ u[1] = c;
+
+ // upper case Basic Latin
+
+ if ( c >= 0x0041 && c <= 0x005A) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Basic Latin
+ if ( c >= 0x0061 && c <= 0x007a ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // upper case Latin-1 Supplement
+ if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ // lower case Latin-1 Supplement
+ if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+ if ( c == 0x00FF ) {
+ u[0] = 0x0178;
+ u[1] = c;
+ return u;
+ }
+ // Latin Extended A
+ if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
+ // special case for capital I
+ if ( c == 0x0130 ) {
+ u[0] = c;
+ u[1] = 0x0069;
+ return u;
+ }
+ if ( c == 0x0131 ) {
+ u[0] = 0x0049;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c % 2 == 0 ) {
+ // if it's even, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's odd, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x0178 ) {
+ u[0] = c;
+ u[1] = 0x00FF;
+ return u;
+ }
+
+ if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
+ if ( c % 2 == 1 ) {
+ // if it's odd, it's a capital and the lower case is c +1
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ // if it's even, it's a lower case and upper case is c-1
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+ if ( c == 0x017F ) {
+ u[0] = 0x0053;
+ u[1] = c;
+ }
+
+ // Latin Extended B
+ // need to improve this set
+
+ if ( c >= 0x0200 && c <= 0x0217 ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c+1;
+ } else {
+ u[0] = c-1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Latin Extended Additional
+ // Range: U+1E00 to U+1EFF
+ // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
+
+ // Spacing Modifier Leters
+ // Range: U+02B0 to U+02FF
+
+ // Combining Diacritical Marks
+ // Range: U+0300 to U+036F
+
+ // skip Greek for now
+ // Greek
+ // Range: U+0370 to U+03FF
+
+ // Cyrillic
+ // Range: U+0400 to U+04FF
+
+ if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
+ u[0] = c;
+ u[1] = c + 80;
+ return u;
+ }
+
+
+ if ( c >= 0x0410 && c <= 0x042F ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0x0430 && c<= 0x044F ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+
+ }
+ if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
+ u[0] = c -80;
+ u[1] = c;
+ return u;
+ }
+
+ if ( c >= 0x0460 && c <= 0x047F ) {
+ if ( c % 2 == 0 ) {
+ u[0] = c;
+ u[1] = c +1;
+ } else {
+ u[0] = c - 1;
+ u[1] = c;
+ }
+ return u;
+ }
+
+ // Armenian
+ // Range: U+0530 to U+058F
+ if ( c >= 0x0531 && c <= 0x0556 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x0561 && c < 0x0587 ) {
+ u[0] = c - 48;
+ u[1] = c;
+ return u;
+ }
+
+ // Hebrew
+ // Range: U+0590 to U+05FF
+
+
+ // Arabic
+ // Range: U+0600 to U+06FF
+
+ // Devanagari
+ // Range: U+0900 to U+097F
+
+
+ // Bengali
+ // Range: U+0980 to U+09FF
+
+
+ // Gurmukhi
+ // Range: U+0A00 to U+0A7F
+
+
+ // Gujarati
+ // Range: U+0A80 to U+0AFF
+
+
+ // Oriya
+ // Range: U+0B00 to U+0B7F
+ // no capital / lower case
+
+
+ // Tamil
+ // Range: U+0B80 to U+0BFF
+ // no capital / lower case
+
+
+ // Telugu
+ // Range: U+0C00 to U+0C7F
+ // no capital / lower case
+
+
+ // Kannada
+ // Range: U+0C80 to U+0CFF
+ // no capital / lower case
+
+
+ // Malayalam
+ // Range: U+0D00 to U+0D7F
+
+ // Thai
+ // Range: U+0E00 to U+0E7F
+
+
+ // Lao
+ // Range: U+0E80 to U+0EFF
+
+
+ // Tibetan
+ // Range: U+0F00 to U+0FBF
+
+ // Georgian
+ // Range: U+10A0 to U+10F0
+ if ( c >= 0x10A0 && c <= 0x10C5 ) {
+ u[0] = c;
+ u[1] = c + 48;
+ return u;
+ }
+ if ( c >= 0x10D0 && c <= 0x10F5 ) {
u[0] = c;
u[1] = c;
-
- // upper case Basic Latin
-
- if ( c >= 0x0041 && c <= 0x005A) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Basic Latin
- if ( c >= 0x0061 && c <= 0x007a ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // upper case Latin-1 Supplement
- if ( (c >= 0x00C0 && c <= 0x00D6) || (c >= 0x00D8 && c<=0x00DE) ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- // lower case Latin-1 Supplement
- if ( (c >= 0x00E0 && c <= 0x00F6) || (c >= 0x00F8 && c <= 0x00FE) ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
- if ( c == 0x00FF ) {
- u[0] = 0x0178;
- u[1] = c;
- return u;
- }
- // Latin Extended A
- if ( (c >= 0x0100 && c < 0x0138) || (c > 0x0149 && c < 0x0178) ) {
- // special case for capital I
- if ( c == 0x0130 ) {
- u[0] = c;
- u[1] = 0x0069;
- return u;
- }
- if ( c == 0x0131 ) {
- u[0] = 0x0049;
- u[1] = c;
- return u;
- }
-
- if ( c % 2 == 0 ) {
- // if it's even, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's odd, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x0178 ) {
- u[0] = c;
- u[1] = 0x00FF;
- return u;
- }
-
- if ( (c >= 0x0139 && c < 0x0149) || (c > 0x0178 && c < 0x017F) ) {
- if ( c % 2 == 1 ) {
- // if it's odd, it's a capital and the lower case is c +1
- u[0] = c;
- u[1] = c+1;
- } else {
- // if it's even, it's a lower case and upper case is c-1
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
- if ( c == 0x017F ) {
- u[0] = 0x0053;
- u[1] = c;
- }
-
- // Latin Extended B
- // need to improve this set
-
- if ( c >= 0x0200 && c <= 0x0217 ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c+1;
- } else {
- u[0] = c-1;
- u[1] = c;
- }
- return u;
- }
-
- // Latin Extended Additional
- // Range: U+1E00 to U+1EFF
- // http://www.unicode.org/Unicode.charts/glyphless/U1E00.html
-
- // Spacing Modifier Leters
- // Range: U+02B0 to U+02FF
-
- // Combining Diacritical Marks
- // Range: U+0300 to U+036F
-
- // skip Greek for now
- // Greek
- // Range: U+0370 to U+03FF
-
- // Cyrillic
- // Range: U+0400 to U+04FF
-
- if ( (c >= 0x0401 && c <= 0x040C) || ( c>= 0x040E && c <= 0x040F ) ) {
- u[0] = c;
- u[1] = c + 80;
- return u;
- }
-
-
- if ( c >= 0x0410 && c <= 0x042F ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0x0430 && c<= 0x044F ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
-
- }
- if ( (c >= 0x0451 && c <= 0x045C) || (c >=0x045E && c<= 0x045F) ) {
- u[0] = c -80;
- u[1] = c;
- return u;
- }
-
- if ( c >= 0x0460 && c <= 0x047F ) {
- if ( c % 2 == 0 ) {
- u[0] = c;
- u[1] = c +1;
- } else {
- u[0] = c - 1;
- u[1] = c;
- }
- return u;
- }
-
- // Armenian
- // Range: U+0530 to U+058F
- if ( c >= 0x0531 && c <= 0x0556 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x0561 && c < 0x0587 ) {
- u[0] = c - 48;
- u[1] = c;
- return u;
- }
-
- // Hebrew
- // Range: U+0590 to U+05FF
-
-
- // Arabic
- // Range: U+0600 to U+06FF
-
- // Devanagari
- // Range: U+0900 to U+097F
-
-
- // Bengali
- // Range: U+0980 to U+09FF
-
-
- // Gurmukhi
- // Range: U+0A00 to U+0A7F
-
-
- // Gujarati
- // Range: U+0A80 to U+0AFF
-
-
- // Oriya
- // Range: U+0B00 to U+0B7F
- // no capital / lower case
-
-
- // Tamil
- // Range: U+0B80 to U+0BFF
- // no capital / lower case
-
-
- // Telugu
- // Range: U+0C00 to U+0C7F
- // no capital / lower case
-
-
- // Kannada
- // Range: U+0C80 to U+0CFF
- // no capital / lower case
-
-
- // Malayalam
- // Range: U+0D00 to U+0D7F
-
- // Thai
- // Range: U+0E00 to U+0E7F
-
-
- // Lao
- // Range: U+0E80 to U+0EFF
-
-
- // Tibetan
- // Range: U+0F00 to U+0FBF
-
- // Georgian
- // Range: U+10A0 to U+10F0
- if ( c >= 0x10A0 && c <= 0x10C5 ) {
- u[0] = c;
- u[1] = c + 48;
- return u;
- }
- if ( c >= 0x10D0 && c <= 0x10F5 ) {
- u[0] = c;
- u[1] = c;
- return u;
- }
-
- // Hangul Jamo
- // Range: U+1100 to U+11FF
-
- // Greek Extended
- // Range: U+1F00 to U+1FFF
- // skip for now
-
-
- // General Punctuation
- // Range: U+2000 to U+206F
-
- // Superscripts and Subscripts
- // Range: U+2070 to U+209F
-
- // Currency Symbols
- // Range: U+20A0 to U+20CF
-
-
- // Combining Diacritical Marks for Symbols
- // Range: U+20D0 to U+20FF
- // skip for now
-
-
- // Number Forms
- // Range: U+2150 to U+218F
- // skip for now
-
-
- // Arrows
- // Range: U+2190 to U+21FF
-
- // Mathematical Operators
- // Range: U+2200 to U+22FF
-
- // Miscellaneous Technical
- // Range: U+2300 to U+23FF
-
- // Control Pictures
- // Range: U+2400 to U+243F
-
- // Optical Character Recognition
- // Range: U+2440 to U+245F
-
- // Enclosed Alphanumerics
- // Range: U+2460 to U+24FF
-
- // Box Drawing
- // Range: U+2500 to U+257F
-
- // Block Elements
- // Range: U+2580 to U+259F
-
- // Geometric Shapes
- // Range: U+25A0 to U+25FF
-
- // Miscellaneous Symbols
- // Range: U+2600 to U+26FF
-
- // Dingbats
- // Range: U+2700 to U+27BF
-
- // CJK Symbols and Punctuation
- // Range: U+3000 to U+303F
-
- // Hiragana
- // Range: U+3040 to U+309F
-
- // Katakana
- // Range: U+30A0 to U+30FF
-
- // Bopomofo
- // Range: U+3100 to U+312F
-
- // Hangul Compatibility Jamo
- // Range: U+3130 to U+318F
-
- // Kanbun
- // Range: U+3190 to U+319F
-
-
- // Enclosed CJK Letters and Months
- // Range: U+3200 to U+32FF
-
- // CJK Compatibility
- // Range: U+3300 to U+33FF
-
- // Hangul Syllables
- // Range: U+AC00 to U+D7A3
-
- // High Surrogates
- // Range: U+D800 to U+DB7F
-
- // Private Use High Surrogates
- // Range: U+DB80 to U+DBFF
-
- // Low Surrogates
- // Range: U+DC00 to U+DFFF
-
- // Private Use Area
- // Range: U+E000 to U+F8FF
-
- // CJK Compatibility Ideographs
- // Range: U+F900 to U+FAFF
-
- // Alphabetic Presentation Forms
- // Range: U+FB00 to U+FB4F
-
- // Arabic Presentation Forms-A
- // Range: U+FB50 to U+FDFF
-
- // Combining Half Marks
- // Range: U+FE20 to U+FE2F
-
- // CJK Compatibility Forms
- // Range: U+FE30 to U+FE4F
-
- // Small Form Variants
- // Range: U+FE50 to U+FE6F
-
- // Arabic Presentation Forms-B
- // Range: U+FE70 to U+FEFF
-
- // Halfwidth and Fullwidth Forms
- // Range: U+FF00 to U+FFEF
-
- if ( c >= 0xFF21 && c <= 0xFF3A ) {
- u[0] = c;
- u[1] = c + 32;
- return u;
- }
-
- if ( c >= 0xFF41 && c <= 0xFF5A ) {
- u[0] = c - 32;
- u[1] = c;
- return u;
- }
-
- // Specials
- // Range: U+FFF0 to U+FFFF
-
return u;
+ }
+
+ // Hangul Jamo
+ // Range: U+1100 to U+11FF
+
+ // Greek Extended
+ // Range: U+1F00 to U+1FFF
+ // skip for now
+
+
+ // General Punctuation
+ // Range: U+2000 to U+206F
+
+ // Superscripts and Subscripts
+ // Range: U+2070 to U+209F
+
+ // Currency Symbols
+ // Range: U+20A0 to U+20CF
+
+
+ // Combining Diacritical Marks for Symbols
+ // Range: U+20D0 to U+20FF
+ // skip for now
+
+
+ // Number Forms
+ // Range: U+2150 to U+218F
+ // skip for now
+
+
+ // Arrows
+ // Range: U+2190 to U+21FF
+
+ // Mathematical Operators
+ // Range: U+2200 to U+22FF
+
+ // Miscellaneous Technical
+ // Range: U+2300 to U+23FF
+
+ // Control Pictures
+ // Range: U+2400 to U+243F
+
+ // Optical Character Recognition
+ // Range: U+2440 to U+245F
+
+ // Enclosed Alphanumerics
+ // Range: U+2460 to U+24FF
+
+ // Box Drawing
+ // Range: U+2500 to U+257F
+
+ // Block Elements
+ // Range: U+2580 to U+259F
+
+ // Geometric Shapes
+ // Range: U+25A0 to U+25FF
+
+ // Miscellaneous Symbols
+ // Range: U+2600 to U+26FF
+
+ // Dingbats
+ // Range: U+2700 to U+27BF
+
+ // CJK Symbols and Punctuation
+ // Range: U+3000 to U+303F
+
+ // Hiragana
+ // Range: U+3040 to U+309F
+
+ // Katakana
+ // Range: U+30A0 to U+30FF
+
+ // Bopomofo
+ // Range: U+3100 to U+312F
+
+ // Hangul Compatibility Jamo
+ // Range: U+3130 to U+318F
+
+ // Kanbun
+ // Range: U+3190 to U+319F
+
+
+ // Enclosed CJK Letters and Months
+ // Range: U+3200 to U+32FF
+
+ // CJK Compatibility
+ // Range: U+3300 to U+33FF
+
+ // Hangul Syllables
+ // Range: U+AC00 to U+D7A3
+
+ // High Surrogates
+ // Range: U+D800 to U+DB7F
+
+ // Private Use High Surrogates
+ // Range: U+DB80 to U+DBFF
+
+ // Low Surrogates
+ // Range: U+DC00 to U+DFFF
+
+ // Private Use Area
+ // Range: U+E000 to U+F8FF
+
+ // CJK Compatibility Ideographs
+ // Range: U+F900 to U+FAFF
+
+ // Alphabetic Presentation Forms
+ // Range: U+FB00 to U+FB4F
+
+ // Arabic Presentation Forms-A
+ // Range: U+FB50 to U+FDFF
+
+ // Combining Half Marks
+ // Range: U+FE20 to U+FE2F
+
+ // CJK Compatibility Forms
+ // Range: U+FE30 to U+FE4F
+
+ // Small Form Variants
+ // Range: U+FE50 to U+FE6F
+
+ // Arabic Presentation Forms-B
+ // Range: U+FE70 to U+FEFF
+
+ // Halfwidth and Fullwidth Forms
+ // Range: U+FF00 to U+FFEF
+
+ if ( c >= 0xFF21 && c <= 0xFF3A ) {
+ u[0] = c;
+ u[1] = c + 32;
+ return u;
+ }
+
+ if ( c >= 0xFF41 && c <= 0xFF5A ) {
+ u[0] = c - 32;
+ u[1] = c;
+ return u;
+ }
+
+ // Specials
+ // Range: U+FFF0 to U+FFFF
+
+ return u;
}
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "0x";
+ n = Number( n );
+ var h = "0x";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
-}
\ No newline at end of file
+ return h;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.2-1.js b/mozilla/js/tests/ecma/String/15.5.4.2-1.js
index 6797d0b6803..c3b97b415b9 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.2-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.2-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.2-1.js
- ECMA Section: 15.5.4.2 String.prototype.toString()
+ File Name: 15.5.4.2-1.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
- Description: Returns this string value. Note that, for a String
- object, the toString() method happens to return the same
- thing as the valueOf() method.
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
- The toString function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.4.2-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toString";
+var SECTION = "15.5.4.2-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() );
+new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() );
+new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() );
+new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() );
+new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() );
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
- array[item++] = new TestCase( SECTION, "(new String()).toString()", "", (new String()).toString() );
- array[item++] = new TestCase( SECTION, "(new String(\"\")).toString()", "", (new String("")).toString() );
- array[item++] = new TestCase( SECTION, "(new String( String() )).toString()","", (new String(String())).toString() );
- array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).toString()", "h e l l o", (new String("h e l l o")).toString() );
- array[item++] = new TestCase( SECTION, "(new String( 0 )).toString()", "0", (new String(0)).toString() );
- return ( array );
-}
-function test( array ) {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.2-2-n.js b/mozilla/js/tests/ecma/String/15.5.4.2-2-n.js
index 023d93ad9e9..1447e659fec 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.2-2-n.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.2-2-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,37 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.2-2-n.js
- ECMA Section: 15.5.4.2 String.prototype.toString()
+ File Name: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
- Description: Returns this string value. Note that, for a String
- object, the toString() method happens to return the same
- thing as the valueOf() method.
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
- The toString function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.4.2-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toString";
+var SECTION = "15.5.4.2-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()",
+ "error",
+ eval("var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()") );
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()",
- "error",
- "var tostr=String.prototype.toString; astring=new Number(); astring.toString = tostr; astring.toString()" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.2-3.js b/mozilla/js/tests/ecma/String/15.5.4.2-3.js
index bce392116c1..7ff264fce96 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.2-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.2-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,69 +35,47 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.2-3.js
- ECMA Section: 15.5.4.2 String.prototype.toString()
+ File Name: 15.5.4.2-3.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
- Description: Returns this string value. Note that, for a String
- object, the toString() method happens to return the same
- thing as the valueOf() method.
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
- The toString function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.4.2-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.toString";
+var SECTION = "15.5.4.2-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.toString";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()",
+ "",
+ eval("var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()",
+ "0",
+ eval("var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()",
+ "hello",
+ eval("var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()") );
+new TestCase( SECTION,
+ "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()",
+ "",
+ eval("var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()") );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
-
- testcases[tc].actual = eval( testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()",
- "",
- "var tostr=String.prototype.toString; astring=new String(); astring.toString = tostr; astring.toString()" );
- array[item++] = new TestCase( SECTION,
- "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()",
- "0",
- "var tostr=String.prototype.toString; astring=new String(0); astring.toString = tostr; astring.toString()" );
- array[item++] = new TestCase( SECTION,
- "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()",
- "hello",
- "var tostr=String.prototype.toString; astring=new String('hello'); astring.toString = tostr; astring.toString()" );
- array[item++] = new TestCase( SECTION,
- "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()",
- "",
- "var tostr=String.prototype.toString; astring=new String(''); astring.toString = tostr; astring.toString()" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.2.js b/mozilla/js/tests/ecma/String/15.5.4.2.js
index 9d1ff32a405..60b380db006 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,74 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.2.js
- ECMA Section: 15.5.4.2 String.prototype.toString
-
- Description:
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var SECTION = "15.5.4.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.tostring";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ );
- array[item++] = new TestCase( SECTION,
- "String.prototype.toString() == String.prototype.valueOf()",
- true,
- String.prototype.toString() == String.prototype.valueOf() );
-
- array[item++] = new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
- array[item++] = new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length );
-
-
- array[item++] = new TestCase( SECTION,
- "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
- true,
- eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION,
- "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()",
- true,
- eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION,
- "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()",
- true,
- eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION,
- "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()",
- true,
- eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") );
- array[item++] = new TestCase( SECTION,
- "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
- true,
- eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
-
- return ( array );
-}
-function test( array ) {
- for ( ; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
-
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.2.js
+ ECMA Section: 15.5.4.2 String.prototype.toString
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var SECTION = "15.5.4.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.tostring";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.toString.__proto__", Function.prototype, String.prototype.toString.__proto__ );
+new TestCase( SECTION,
+ "String.prototype.toString() == String.prototype.valueOf()",
+ true,
+ String.prototype.toString() == String.prototype.valueOf() );
+
+new TestCase( SECTION, "String.prototype.toString()", "", String.prototype.toString() );
+new TestCase( SECTION, "String.prototype.toString.length", 0, String.prototype.toString.length );
+
+
+new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(true);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(false);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String(Math.PI);TESTSTRING.valueOf() == TESTSTRING.toString()") );
+new TestCase( SECTION,
+ "TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()",
+ true,
+ eval("TESTSTRING = new String();TESTSTRING.valueOf() == TESTSTRING.toString()") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.3-1.js b/mozilla/js/tests/ecma/String/15.5.4.3-1.js
index 8a1e742fb84..9abd617fc7f 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.3-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,52 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.3-1.js
- ECMA Section: 15.5.4.3 String.prototype.valueOf()
+ File Name: 15.5.4.3-1.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
- Description: Returns this string value.
+ Description: Returns this string value.
- The valueOf function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.4.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.valueOf";
+var SECTION = "15.5.4.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
+new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() );
+new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() );
+new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() );
+new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() );
+new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() );
- array[item++] = new TestCase( SECTION, "String.prototype.valueOf.length", 0, String.prototype.valueOf.length );
-
- array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
- array[item++] = new TestCase( SECTION, "(new String()).valueOf()", "", (new String()).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String(\"\")).valueOf()", "", (new String("")).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String( String() )).valueOf()","", (new String(String())).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String( \"h e l l o\" )).valueOf()", "h e l l o", (new String("h e l l o")).valueOf() );
- array[item++] = new TestCase( SECTION, "(new String( 0 )).valueOf()", "0", (new String(0)).valueOf() );
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.3-2.js b/mozilla/js/tests/ecma/String/15.5.4.3-2.js
index 123adfb78c6..f7172e9ce55 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.3-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.3-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,53 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.3-2.js
- ECMA Section: 15.5.4.3 String.prototype.valueOf()
-
- Description: Returns this string value.
-
- The valueOf function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
-
- Author: christine@netscape.com
- Date: 1 october 1997
-*/
-
-
- var SECTION = "15.5.4.3-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.valueOf";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()",
- "",
- "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()" );
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()",
- "0",
- "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()" );
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()",
- "hello",
- "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()" );
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()",
- "",
- "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()" );
-/*
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
- "error",
- "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" );
-*/
- return ( array );
-}
+/**
+ File Name: 15.5.4.3-2.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
+
+ Description: Returns this string value.
+
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 1 october 1997
+*/
+
+
+var SECTION = "15.5.4.3-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valof()",
+ "",
+ eval("var valof=String.prototype.valueOf; astring=new String(); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valof()",
+ "0",
+ eval("var valof=String.prototype.valueOf; astring=new String(0); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valof()",
+ "hello",
+ eval("var valof=String.prototype.valueOf; astring=new String('hello'); astring.valueOf = valof; astring.valueOf()") );
+
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valof()",
+ "",
+ eval("var valof=String.prototype.valueOf; astring=new String(''); astring.valueOf = valof; astring.valueOf()") );
+/*
+ new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") );
+*/
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.3-3-n.js b/mozilla/js/tests/ecma/String/15.5.4.3-3-n.js
index 09b6f762ce4..5c7a61ba1de 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.3-3-n.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.3-3-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,54 +35,36 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.3-3-n.js
- ECMA Section: 15.5.4.3 String.prototype.valueOf()
+ File Name: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
- Description: Returns this string value.
+ Description: Returns this string value.
- The valueOf function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "15.5.4.3-3-n";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.valueOf";
+var SECTION = "15.5.4.3-3-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.valueOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+DESCRIPTION = "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()";
+EXPECTED = "error";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].actual = eval(testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION,
+ "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
+ "error",
+ eval("var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valof()",
- "error",
- "var valof=String.prototype.valueOf; astring=new Number(); astring.valueOf = valof; astring.valueOf()" );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.4-1.js b/mozilla/js/tests/ecma/String/15.5.4.4-1.js
index 0410e264e9b..de1073d5d56 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.4-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,69 +35,56 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.4-1.js
- ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
- Description: Returns a string containing the character at position
- pos in the string. If there is no character at that
- string, the result is the empty string. The result is
- a string value, not a String object.
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
- When the charAt method is called with one argument,
- pos, the following steps are taken:
- 1. Call ToString, with this value as its argument
- 2. Call ToInteger pos
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
- In this test, this is a String, pos is an integer, and
- all pos are in range.
+ In this test, this is a String, pos is an integer, and
+ all pos are in range.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charAt";
+var SECTION = "15.5.4.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
- var testcases = getTestCases();
- test();
+var item = 0;
+var i;
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- for ( i = 0x0020; i < 0x007e; i++, item++) {
- array[item] = new TestCase( SECTION,
- "TEST_STRING.charAt("+item+")",
- String.fromCharCode( i ),
- TEST_STRING.charAt( item ) );
- }
- for ( i = 0x0020; i < 0x007e; i++, item++) {
- array[item] = new TestCase( SECTION,
- "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")",
- true,
- TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 )
- );
- }
- array[item++] = new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length );
-
- return array;
+for ( i = 0x0020; i < 0x007e; i++, item++) {
+ new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+")",
+ String.fromCharCode( i ),
+ TEST_STRING.charAt( item ) );
}
-function test() {
- writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
-
- return ( testcases );
+for ( i = 0x0020; i < 0x007e; i++, item++) {
+ new TestCase( SECTION,
+ "TEST_STRING.charAt("+item+") == TEST_STRING.substring( "+item +", "+ (item+1) + ")",
+ true,
+ TEST_STRING.charAt( item ) == TEST_STRING.substring( item, item+1 )
+ );
}
+
+new TestCase( SECTION, "String.prototype.charAt.length", 1, String.prototype.charAt.length );
+
+writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+test();
+
diff --git a/mozilla/js/tests/ecma/String/15.5.4.4-2.js b/mozilla/js/tests/ecma/String/15.5.4.4-2.js
index 4845afbace1..1a905ff72e1 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.4-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,123 +35,99 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.4-1.js
- ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
- Description: Returns a string containing the character at position
- pos in the string. If there is no character at that
- string, the result is the empty string. The result is
- a string value, not a String object.
-
- When the charAt method is called with one argument,
- pos, the following steps are taken:
- 1. Call ToString, with this value as its argument
- 2. Call ToInteger pos
- 3. Compute the number of characters in Result(1)
- 4. If Result(2) is less than 0 is or not less than
- Result(3), return the empty string
- 5. Return a string of length 1 containing one character
- from result (1), the character at position Result(2).
-
- Note that the charAt function is intentionally generic;
- it does not require that its this value be a String
- object. Therefore it can be transferred to other kinds
- of objects for use as a method.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
- var SECTION = "15.5.4.4-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charAt";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") );
-
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") );
-
- array[item++] = new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") );
-
- // MyOtherObject.toString will return "[object Object]
-
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") );
- array[item++] = new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") );
-
- return (array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
-
- stopTest();
- return ( testcases );
-}
-
-function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value;" );
- this.toString = new Function( "return this.value +''" );
- this.charAt = String.prototype.charAt;
-}
-function MyOtherObject(value) {
- this.value = value;
- this.valueOf = new Function( "return this.value;" );
- this.charAt = String.prototype.charAt;
-}
+/**
+ File Name: 15.5.4.4-1.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)", "u", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)", "e", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)", "", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(-1)") );
+
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)", "r", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)", "t", eval("x = new Boolean(true); x.charAt=String.prototype.charAt;x.charAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charAt(0)", "", eval("x=new String();x.charAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charAt(1)", "", eval("x=new String();x.charAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charAt(-1)", "", eval("x=new String();x.charAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charAt(NaN)", "", eval("x=new String();x.charAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charAt(Number.POSITIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charAt(Number.NEGATIVE_INFINITY)", "", eval("x=new String();x.charAt(Number.NEGATIVE_INFINITY)") );
+
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(0)", "1", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(0)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(1)", "2", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(1)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(2)", "3", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(2)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(3)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(3)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(4)", "5", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(4)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(5)", "6", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(5)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(6)", "7", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(6)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(7)", "8", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(7)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(8)", "9", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(8)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(9)", "0", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(9)") );
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(10)", "", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(10)") );
+
+new TestCase( SECTION, "var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)", "4", eval("var MYOB = new MyObject(1234567890); MYOB.charAt(Math.PI)") );
+
+// MyOtherObject.toString will return "[object Object]
+
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)", "[", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(0)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)", "o", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(1)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(2)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(3)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(4)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(5)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(6)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)", " ", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(7)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)", "O", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(8)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)", "b", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(9)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)", "j", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(10)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)", "e", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(11)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)", "c", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(12)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)", "t", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(13)") );
+new TestCase( SECTION, "var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)", "]", eval("var MYOB = new MyOtherObject(1234567890); MYOB.charAt(14)") );
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return this.value +''" );
+ this.charAt = String.prototype.charAt;
+}
+function MyOtherObject(value) {
+ this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.charAt = String.prototype.charAt;
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.4-3.js b/mozilla/js/tests/ecma/String/15.5.4.4-3.js
index c98aa4e9fc9..5ffd0909dff 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.4-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.4-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,99 +35,75 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.4-3.js
- ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
- Description: Returns a string containing the character at position
- pos in the string. If there is no character at that
- string, the result is the empty string. The result is
- a string value, not a String object.
-
- When the charAt method is called with one argument,
- pos, the following steps are taken:
- 1. Call ToString, with this value as its argument
- 2. Call ToInteger pos
- 3. Compute the number of characters in Result(1)
- 4. If Result(2) is less than 0 is or not less than
- Result(3), return the empty string
- 5. Return a string of length 1 containing one character
- from result (1), the character at position Result(2).
-
- Note that the charAt function is intentionally generic;
- it does not require that its this value be a String
- object. Therefore it can be transferred to other kinds
- of objects for use as a method.
-
- This tests assiging charAt to a user-defined function.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
- var SECTION = "15.5.4.4-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charAt";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function MyObject (v) {
- this.value = v;
- this.toString = new Function( "return this.value +'';" );
- this.valueOf = new Function( "return this.value" );
- this.charAt = String.prototype.charAt;
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var foo = new MyObject('hello');
-
-
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) );
-
- var boo = new MyObject(true);
-
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) );
-
- var noo = new MyObject( Math.PI );
-
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) );
-
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.4-3.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
+
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
+
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
+
+ This tests assiging charAt to a user-defined function.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.4-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var foo = new MyObject('hello');
+
+
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "h", foo.charAt(0) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "e", foo.charAt(1) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(2) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "l", foo.charAt(3) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "o", foo.charAt(4) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(-1) );
+new TestCase( SECTION, "var foo = new MyObject('hello'); ", "", foo.charAt(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true); ", "t", boo.charAt(0) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "r", boo.charAt(1) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "u", boo.charAt(2) );
+new TestCase( SECTION, "var boo = new MyObject(true); ", "e", boo.charAt(3) );
+
+var noo = new MyObject( Math.PI );
+
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "3", noo.charAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", ".", noo.charAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "4", noo.charAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "1", noo.charAt(4) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "5", noo.charAt(5) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); ", "9", noo.charAt(6) );
+
+test();
+
+function MyObject (v) {
+ this.value = v;
+ this.toString = new Function( "return this.value +'';" );
+ this.valueOf = new Function( "return this.value" );
+ this.charAt = String.prototype.charAt;
+}
+
diff --git a/mozilla/js/tests/ecma/String/15.5.4.4-4.js b/mozilla/js/tests/ecma/String/15.5.4.4-4.js
index feeb7630c9e..d4d178030d1 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.4-4.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.4-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,141 +35,119 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.4-4.js
- ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
- Description: Returns a string containing the character at position
- pos in the string. If there is no character at that
- string, the result is the empty string. The result is
- a string value, not a String object.
+ File Name: 15.5.4.4-4.js
+ ECMA Section: 15.5.4.4 String.prototype.charAt(pos)
+ Description: Returns a string containing the character at position
+ pos in the string. If there is no character at that
+ string, the result is the empty string. The result is
+ a string value, not a String object.
- When the charAt method is called with one argument,
- pos, the following steps are taken:
- 1. Call ToString, with this value as its argument
- 2. Call ToInteger pos
- 3. Compute the number of characters in Result(1)
- 4. If Result(2) is less than 0 is or not less than
- Result(3), return the empty string
- 5. Return a string of length 1 containing one character
- from result (1), the character at position Result(2).
+ When the charAt method is called with one argument,
+ pos, the following steps are taken:
+ 1. Call ToString, with this value as its argument
+ 2. Call ToInteger pos
+ 3. Compute the number of characters in Result(1)
+ 4. If Result(2) is less than 0 is or not less than
+ Result(3), return the empty string
+ 5. Return a string of length 1 containing one character
+ from result (1), the character at position Result(2).
- Note that the charAt function is intentionally generic;
- it does not require that its this value be a String
- object. Therefore it can be transferred to other kinds
- of objects for use as a method.
+ Note that the charAt function is intentionally generic;
+ it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds
+ of objects for use as a method.
- This tests assiging charAt to primitive types..
+ This tests assiging charAt to primitive types..
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.4-4";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "String.prototype.charAt";
+var SECTION = "15.5.4.4-4";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.prototype.charAt";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
/*
- array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "n", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "u", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ new TestCase( SECTION, "x = null; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "l", eval("x=null; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "u", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "n", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "d", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+ new TestCase( SECTION, "x = undefined; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=undefined; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
*/
- array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "f", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "l", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "s", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = false; x.__proto.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=false; x.__proto__.charAt = String.prototype.charAt; x.charAt(4)") );
- array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "t", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "r", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "u", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = true; x.__proto.charAt = String.prototype.charAt; x.charAt(3)", "e", eval("x=true; x.__proto__.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "a", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = NaN; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "N", eval("x=NaN; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = 123; x.__proto.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=123; x.__proto__.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)", "2", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)", ",", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)", "3", eval("x=new Array(1,2,3); x.charAt = String.prototype.charAt; x.charAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)", "", eval("x = new Array(); x.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)", "1", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)", "2", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)", "3", eval("x=new Number(123); x.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") );
- array[item++] = new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(5)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(6)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(7)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(8)", "O", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(8)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(9)", "b", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(9)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(10)", "j", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(10)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(11)", "e", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(11)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(12)", "c", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(12)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(13)", "t", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(13)") );
+new TestCase( SECTION, "x = new Object(); x.charAt = String.prototype.charAt; x.charAt(14)", "]", eval("x=new Object(); x.charAt = String.prototype.charAt; x.charAt(14)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") );
- array[item++] = new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)", "[", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(0)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(1)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)", "b", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(2)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)", "j", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(3)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)", "e", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(4)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(5)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(6)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)", " ", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(7)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)", "F", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(8)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)", "u", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(9)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(10)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)", "c", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(11)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)", "t", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(12)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)", "i", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(13)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)", "o", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(14)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)", "n", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(15)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)", "]", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(16)") );
+new TestCase( SECTION, "x = new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)", "", eval("x=new Function(); x.toString = Object.prototype.toString; x.charAt = String.prototype.charAt; x.charAt(17)") );
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-1.js b/mozilla/js/tests/ecma/String/15.5.4.5-1.js
index 96ba4d975de..7b4bb68964f 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,50 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.5.1.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
- Description: Returns a number (a nonnegative integer less than 2^16)
- representing the Unicode encoding of the character at
- position pos in this string. If there is no character
- at that position, the number is NaN.
-
- When the charCodeAt method is called with one argument
- pos, the following steps are taken:
- 1. Call ToString, giving it the theis value as its
- argument
- 2. Call ToInteger(pos)
- 3. Compute the number of characters in result(1).
- 4. If Result(2) is less than 0 or is not less than
- Result(3), return NaN.
- 5. Return a value of Number type, of positive sign, whose
- magnitude is the Unicode encoding of one character
- from result 1, namely the characer at position Result
- (2), where the first character in Result(1) is
- considered to be at position 0.
-
- Note that the charCodeAt funciton is intentionally
- generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
- var SECTION = "15.5.4.5-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charCodeAt";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
-
- for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) {
- array[j] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) );
- }
-
- item = array.length;
-
- array[item++] = new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) );
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
-
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+for ( j = 0, i = 0x0020; i < 0x007e; i++, j++ ) {
+ new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", i, TEST_STRING.charCodeAt( j ) );
+}
+
+new TestCase( SECTION, 'TEST_STRING.charCodeAt('+i+')', NaN, TEST_STRING.charCodeAt( i ) );
+
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-2.js b/mozilla/js/tests/ecma/String/15.5.4.5-2.js
index b3e57381e19..2f6f1963049 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,110 +35,84 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.5.1.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
- Description: Returns a number (a nonnegative integer less than 2^16)
- representing the Unicode encoding of the character at
- position pos in this string. If there is no character
- at that position, the number is NaN.
-
- When the charCodeAt method is called with one argument
- pos, the following steps are taken:
- 1. Call ToString, giving it the theis value as its
- argument
- 2. Call ToInteger(pos)
- 3. Compute the number of characters in result(1).
- 4. If Result(2) is less than 0 or is not less than
- Result(3), return NaN.
- 5. Return a value of Number type, of positive sign, whose
- magnitude is the Unicode encoding of one character
- from result 1, namely the characer at position Result
- (2), where the first character in Result(1) is
- considered to be at position 0.
-
- Note that the charCodeAt funciton is intentionally
- generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
- var SECTION = "15.5.4.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charCodeAt";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
-
- var testcases = getTestCases();
-
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var x;
-
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
-
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") );
-
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") );
-
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") );
-
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") );
- array[item++] = new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") );
-
- return (array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
+
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
+
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.5-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+var x;
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)", 0x0031, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)", 0x0032, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)", 0x002C, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)", 0x0033, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)", NaN, eval("x = new Array(1,2,3); x.charCodeAt = String.prototype.charCodeAt; x.charCodeAt(5)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)", 0x005B, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)", 0x006F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)", 0x0065, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)", 0x0063, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(5)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)", 0x0074, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(6)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)", 0x0020, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(7)") );
+
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)", 0x004F, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(8)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)", 0x0062, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(9)") );
+new TestCase( SECTION, "x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)", 0x006A, eval("x = new Function( 'this.charCodeAt = String.prototype.charCodeAt' ); f = new x(); f.charCodeAt(10)") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-3.js b/mozilla/js/tests/ecma/String/15.5.4.5-3.js
index be178efdad8..0afa91ce548 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,118 +35,95 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.5-3.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
- Description: Returns a number (a nonnegative integer less than 2^16)
- representing the Unicode encoding of the character at
- position pos in this string. If there is no character
- at that position, the number is NaN.
+ File Name: 15.5.4.5-3.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
- When the charCodeAt method is called with one argument
- pos, the following steps are taken:
- 1. Call ToString, giving it the theis value as its
- argument
- 2. Call ToInteger(pos)
- 3. Compute the number of characters in result(1).
- 4. If Result(2) is less than 0 or is not less than
- Result(3), return NaN.
- 5. Return a value of Number type, of positive sign, whose
- magnitude is the Unicode encoding of one character
- from result 1, namely the characer at position Result
- (2), where the first character in Result(1) is
- considered to be at position 0.
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
- Note that the charCodeAt funciton is intentionally
- generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.5-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charCodeAt";
+var SECTION = "15.5.4.5-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+
+var foo = new MyObject('hello');
+
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) );
+
+var noo = new MyObject( Math.PI );
+
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) );
+
+var noo = new MyObject( null );
+
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) );
+
+var noo = new MyObject( void 0 );
+
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) );
+new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) );
+
+test();
- var testcases = getTestCases();
- test();
function MyObject (v) {
- this.value = v;
- this.toString = new Function ( "return this.value +\"\"" );
- this.charCodeAt = String.prototype.charCodeAt;
-}
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- var foo = new MyObject('hello');
-
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(0)", 0x0068, foo.charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(1)", 0x0065, foo.charCodeAt(1) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(2)", 0x006c, foo.charCodeAt(2) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(3)", 0x006c, foo.charCodeAt(3) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(4)", 0x006f, foo.charCodeAt(4) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(-1)", Number.NaN, foo.charCodeAt(-1) );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.charCodeAt(5)", Number.NaN, foo.charCodeAt(5) );
-
- var boo = new MyObject(true);
-
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(0)", 0x0074, boo.charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(1)", 0x0072, boo.charCodeAt(1) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(2)", 0x0075, boo.charCodeAt(2) );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.charCodeAt(3)", 0x0065, boo.charCodeAt(3) );
-
- var noo = new MyObject( Math.PI );
-
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(0)", 0x0033, noo.charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(1)", 0x002E, noo.charCodeAt(1) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(2)", 0x0031, noo.charCodeAt(2) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(3)", 0x0034, noo.charCodeAt(3) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(4)", 0x0031, noo.charCodeAt(4) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(5)", 0x0035, noo.charCodeAt(5) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI);noo.charCodeAt(6)", 0x0039, noo.charCodeAt(6) );
-
- var noo = new MyObject( null );
-
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(0)", 0x006E, noo.charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(1)", 0x0075, noo.charCodeAt(1) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(2)", 0x006C, noo.charCodeAt(2) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(3)", 0x006C, noo.charCodeAt(3) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(null);noo.charCodeAt(4)", NaN, noo.charCodeAt(4) );
-
- var noo = new MyObject( void 0 );
-
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(0)", 0x0075, noo.charCodeAt(0) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(1)", 0x006E, noo.charCodeAt(1) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(2)", 0x0064, noo.charCodeAt(2) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(3)", 0x0065, noo.charCodeAt(3) );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(void 0);noo.charCodeAt(4)", 0x0066, noo.charCodeAt(4) );
-
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value ";
-
- }
- stopTest();
- return ( testcases );
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"" );
+ this.charCodeAt = String.prototype.charCodeAt;
}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-4.js b/mozilla/js/tests/ecma/String/15.5.4.5-4.js
index 918999ee645..00d0e24690f 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-4.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,62 +35,38 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.5-4.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
-
- Description: Returns a nonnegative integer less than 2^16.
-
- Author: christine@netscape.com
- Date: 28 october 1997
-
-*/
- var VERSION = "0697";
- startTest();
- var SECTION = "15.5.4.5-4";
-
- writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" );
- var tc= 0;
- var testcases = getTestCases();
-
-// all tests must call a function that returns an array of TestCase objects.
- test();
-
-function getTestCases() {
- var array = new Array();
- var MAXCHARCODE = Math.pow(2,16);
- var item=0, CHARCODE;
-
- for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
- CHARCODE,
- (String.fromCharCode(CHARCODE)).charCodeAt(0) );
- }
- for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) {
- array[item++] = new TestCase( SECTION,
- "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
- CHARCODE,
- (String.fromCharCode(CHARCODE)).charCodeAt(0) );
- }
-
- array[item++] = new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
-
- return ( array );
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
-
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.5-4.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+
+ Description: Returns a nonnegative integer less than 2^16.
+
+ Author: christine@netscape.com
+ Date: 28 october 1997
+
+*/
+var VERSION = "0697";
+startTest();
+var SECTION = "15.5.4.5-4";
+
+writeHeaderToLog( SECTION + " String.prototype.charCodeAt(pos)" );
+
+var MAXCHARCODE = Math.pow(2,16);
+var item=0, CHARCODE;
+
+for ( CHARCODE=0; CHARCODE <256; CHARCODE++ ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+}
+for ( CHARCODE=256; CHARCODE < 65536; CHARCODE+=999 ) {
+ new TestCase( SECTION,
+ "(String.fromCharCode("+CHARCODE+")).charCodeAt(0)",
+ CHARCODE,
+ (String.fromCharCode(CHARCODE)).charCodeAt(0) );
+}
+
+new TestCase( SECTION, "(String.fromCharCode(65535)).charCodeAt(0)", 65535, (String.fromCharCode(65535)).charCodeAt(0) );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-5.js b/mozilla/js/tests/ecma/String/15.5.4.5-5.js
index 7d3b60c1173..89c47d76f98 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-5.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-5.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,70 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.5.1.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
- Description: Returns a number (a nonnegative integer less than 2^16)
- representing the Unicode encoding of the character at
- position pos in this string. If there is no character
- at that position, the number is NaN.
+ File Name: 15.5.4.5.1.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
- When the charCodeAt method is called with one argument
- pos, the following steps are taken:
- 1. Call ToString, giving it the theis value as its
- argument
- 2. Call ToInteger(pos)
- 3. Compute the number of characters in result(1).
- 4. If Result(2) is less than 0 or is not less than
- Result(3), return NaN.
- 5. Return a value of Number type, of positive sign, whose
- magnitude is the Unicode encoding of one character
- from result 1, namely the characer at position Result
- (2), where the first character in Result(1) is
- considered to be at position 0.
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
- Note that the charCodeAt funciton is intentionally
- generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.5-5";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.charCodeAt";
+var SECTION = "15.5.4.5-5";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var TEST_STRING = "";
+var TEST_STRING = "";
- for ( var i = 0x0000; i < 255; i++ ) {
- TEST_STRING += String.fromCharCode( i );
- }
-
-
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
- array[item++] = new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
-
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
- array[item++] = new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
-
- for ( var j = 0; j < 255; j++ ) {
- array[item++] = new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) );
- }
- return (array );
+for ( var i = 0x0000; i < 255; i++ ) {
+ TEST_STRING += String.fromCharCode( i );
}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)", 0x0075, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(2)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)", 0x0065, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(3)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(4)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)", Number.NaN, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(-1)") );
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
- return ( testcases );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)", 0x0072, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(true)") );
+new TestCase( SECTION, "x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)", 0x0074, eval("x = new Boolean(true); x.charCodeAt=String.prototype.charCodeAt;x.charCodeAt(false)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(0)", Number.NaN, eval("x=new String();x.charCodeAt(0)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(1)", Number.NaN, eval("x=new String();x.charCodeAt(1)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(-1)", Number.NaN, eval("x=new String();x.charCodeAt(-1)") );
+
+new TestCase( SECTION, "x = new String(); x.charCodeAt(NaN)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NaN)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.POSITIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.POSITIVE_INFINITY)") );
+new TestCase( SECTION, "x = new String(); x.charCodeAt(Number.NEGATIVE_INFINITY)", Number.NaN, eval("x=new String();x.charCodeAt(Number.NEGATIVE_INFINITY)") );
+
+for ( var j = 0; j < 255; j++ ) {
+ new TestCase( SECTION, "TEST_STRING.charCodeAt("+j+")", j, TEST_STRING.charCodeAt(j) );
}
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.5-6.js b/mozilla/js/tests/ecma/String/15.5.4.5-6.js
index f0db4bdb842..aee62d51bfd 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.5-6.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.5-6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,79 +35,58 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.5-6.js
- ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
- Description: Returns a number (a nonnegative integer less than 2^16)
- representing the Unicode encoding of the character at
- position pos in this string. If there is no character
- at that position, the number is NaN.
+ File Name: 15.5.4.5-6.js
+ ECMA Section: 15.5.4.5 String.prototype.charCodeAt(pos)
+ Description: Returns a number (a nonnegative integer less than 2^16)
+ representing the Unicode encoding of the character at
+ position pos in this string. If there is no character
+ at that position, the number is NaN.
- When the charCodeAt method is called with one argument
- pos, the following steps are taken:
- 1. Call ToString, giving it the theis value as its
- argument
- 2. Call ToInteger(pos)
- 3. Compute the number of characters in result(1).
- 4. If Result(2) is less than 0 or is not less than
- Result(3), return NaN.
- 5. Return a value of Number type, of positive sign, whose
- magnitude is the Unicode encoding of one character
- from result 1, namely the characer at position Result
- (2), where the first character in Result(1) is
- considered to be at position 0.
+ When the charCodeAt method is called with one argument
+ pos, the following steps are taken:
+ 1. Call ToString, giving it the theis value as its
+ argument
+ 2. Call ToInteger(pos)
+ 3. Compute the number of characters in result(1).
+ 4. If Result(2) is less than 0 or is not less than
+ Result(3), return NaN.
+ 5. Return a value of Number type, of positive sign, whose
+ magnitude is the Unicode encoding of one character
+ from result 1, namely the characer at position Result
+ (2), where the first character in Result(1) is
+ considered to be at position 0.
- Note that the charCodeAt funciton is intentionally
- generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other
- kinds of objects for use as a method.
+ Note that the charCodeAt funciton is intentionally
+ generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.5-6";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "String.prototype.charCodeAt";
+var SECTION = "15.5.4.5-6";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.prototype.charCodeAt";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "true",
+ eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
- array[item++] = new TestCase( SECTION,
- "var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
- "true",
- eval("var obj = true; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+new TestCase( SECTION,
+ "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "1234",
+ eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
- array[item++] = new TestCase( SECTION,
- "var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
- "1234",
- eval("var obj = 1234; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 4; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
+new TestCase( SECTION,
+ "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
+ "hello",
+ eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
- array[item++] = new TestCase( SECTION,
- "var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s",
- "hello",
- eval("var obj = 'hello'; obj.__proto__.charCodeAt = String.prototype.charCodeAt; var s = ''; for ( var i = 0; i < 5; i++ ) s+= String.fromCharCode( obj.charCodeAt(i) ); s") );
- return (array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.6-1.js b/mozilla/js/tests/ecma/String/15.5.4.6-1.js
index 2b4c6e374c8..6494c10fb9f 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.6-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.6-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,140 +35,118 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.6-1.js
- ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
- Description: If the given searchString appears as a substring of the
- result of converting this object to a string, at one or
- more positions that are at or to the right of the
- specified position, then the index of the leftmost such
- position is returned; otherwise -1 is returned. If
- positionis undefined or not supplied, 0 is assumed, so
- as to search all of the string.
-
- When the indexOf method is called with two arguments,
- searchString and pos, the following steps are taken:
-
- 1. Call ToString, giving it the this value as its
- argument.
- 2. Call ToString(searchString).
- 3. Call ToInteger(position). (If position is undefined
- or not supplied, this step produces the value 0).
- 4. Compute the number of characters in Result(1).
- 5. Compute min(max(Result(3), 0), Result(4)).
- 6. Compute the number of characters in the string that
- is Result(2).
- 7. Compute the smallest possible integer k not smaller
- than Result(5) such that k+Result(6) is not greater
- than Result(4), and for all nonnegative integers j
- less than Result(6), the character at position k+j
- of Result(1) is the same as the character at position
- j of Result(2); but if there is no such integer k,
- then compute the value -1.
- 8. Return Result(7).
-
- Note that the indexOf function is intentionally generic;
- it does not require that its this value be a String object.
- Therefore it can be transferred to other kinds of objects
- for use as a method.
-
- Author: christine@netscape.com
- Date: 2 october 1997
-*/
- var SECTION = "15.5.4.6-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.protoype.indexOf";
-
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-
-function getTestCases() {
- var array = new Array();
- var j = 0;
-
- for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf(" +String.fromCharCode(i)+ ", 0)",
- k,
- TEST_STRING.indexOf( String.fromCharCode(i), 0 ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")",
- k,
- TEST_STRING.indexOf( String.fromCharCode(i), k ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")",
- -1,
- TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+0+")",
- k,
- TEST_STRING.indexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- 0 ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ k +")",
- k,
- TEST_STRING.indexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- k ) );
- }
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.indexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ k+1 +")",
- -1,
- TEST_STRING.indexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- k+1 ) );
- }
-
- array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) );
- array[j++] = new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 ));
-
- return array;
-}
-
-function test() {
- writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
-
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
-
- }
- stopTest();
-
- return ( testcases );
-}
-
+/**
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
+
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
+
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
+
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
+
+ Author: christine@netscape.com
+ Date: 2 october 1997
+*/
+var SECTION = "15.5.4.6-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.indexOf";
+
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+var j = 0;
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf(" +String.fromCharCode(i)+ ", 0)",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.indexOf( String.fromCharCode(i), k ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ -1,
+ TEST_STRING.indexOf( String.fromCharCode(i), k+1 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+0+")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.indexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ -1,
+ TEST_STRING.indexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+}
+
+new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.indexOf( TEST_STRING, 0 ) );
+
+new TestCase( SECTION, "String.indexOf(" +TEST_STRING + ", 1 )", -1, TEST_STRING.indexOf( TEST_STRING, 1 ));
+
+writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.6-2.js b/mozilla/js/tests/ecma/String/15.5.4.6-2.js
index 251f469d791..22bf8ebffd6 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.6-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.6-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,240 +36,213 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 15.5.4.6-1.js
- ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
- Description: If the given searchString appears as a substring of the
- result of converting this object to a string, at one or
- more positions that are at or to the right of the
- specified position, then the index of the leftmost such
- position is returned; otherwise -1 is returned. If
- positionis undefined or not supplied, 0 is assumed, so
- as to search all of the string.
+ File Name: 15.5.4.6-1.js
+ ECMA Section: 15.5.4.6 String.prototype.indexOf( searchString, pos)
+ Description: If the given searchString appears as a substring of the
+ result of converting this object to a string, at one or
+ more positions that are at or to the right of the
+ specified position, then the index of the leftmost such
+ position is returned; otherwise -1 is returned. If
+ positionis undefined or not supplied, 0 is assumed, so
+ as to search all of the string.
- When the indexOf method is called with two arguments,
- searchString and pos, the following steps are taken:
+ When the indexOf method is called with two arguments,
+ searchString and pos, the following steps are taken:
- 1. Call ToString, giving it the this value as its
- argument.
- 2. Call ToString(searchString).
- 3. Call ToInteger(position). (If position is undefined
- or not supplied, this step produces the value 0).
- 4. Compute the number of characters in Result(1).
- 5. Compute min(max(Result(3), 0), Result(4)).
- 6. Compute the number of characters in the string that
- is Result(2).
- 7. Compute the smallest possible integer k not smaller
- than Result(5) such that k+Result(6) is not greater
- than Result(4), and for all nonnegative integers j
- less than Result(6), the character at position k+j
- of Result(1) is the same as the character at position
- j of Result(2); but if there is no such integer k,
- then compute the value -1.
- 8. Return Result(7).
+ 1. Call ToString, giving it the this value as its
+ argument.
+ 2. Call ToString(searchString).
+ 3. Call ToInteger(position). (If position is undefined
+ or not supplied, this step produces the value 0).
+ 4. Compute the number of characters in Result(1).
+ 5. Compute min(max(Result(3), 0), Result(4)).
+ 6. Compute the number of characters in the string that
+ is Result(2).
+ 7. Compute the smallest possible integer k not smaller
+ than Result(5) such that k+Result(6) is not greater
+ than Result(4), and for all nonnegative integers j
+ less than Result(6), the character at position k+j
+ of Result(1) is the same as the character at position
+ j of Result(2); but if there is no such integer k,
+ then compute the value -1.
+ 8. Return Result(7).
- Note that the indexOf function is intentionally generic;
- it does not require that its this value be a String object.
- Therefore it can be transferred to other kinds of objects
- for use as a method.
+ Note that the indexOf function is intentionally generic;
+ it does not require that its this value be a String object.
+ Therefore it can be transferred to other kinds of objects
+ for use as a method.
- Author: christine@netscape.com, pschwartau@netscape.com
- Date: 02 October 1997
- Modified: 14 July 2002
- Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
- ECMA-262 Ed.3 Section 15.5.4.7
- The length property of the indexOf method is 1
-*
-*/
- var SECTION = "15.5.4.6-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.protoype.indexOf";
- var BUGNUMBER="105721";
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.7
+ The length property of the indexOf method is 1
+ *
+ */
+var SECTION = "15.5.4.6-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.indexOf";
+var BUGNUMBER="105721";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
+writeHeaderToLog( SECTION + " "+ TITLE);
// the following test regresses http://scopus/bugsplat/show_bug.cgi?id=105721
+// regress http://scopus/bugsplat/show_bug.cgi?id=105721
+
+new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() );
+
+
+new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length );
+new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") );
+new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length );
+new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") );
+
+new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") );
+
+// some Unicode tests.
+
+// generate a test string.
+
+var TEST_STRING = "";
+
+for ( var u = 0x00A1; u <= 0x00FF; u++ ) {
+ TEST_STRING += String.fromCharCode( u );
+}
+
+for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u) ) );
+}
+for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
+ new TestCase( SECTION,
+ "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )",
+ i,
+ TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) );
+}
+
+
+
+var foo = new MyObject('hello');
+
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") );
+new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) );
+
+var boo = new MyObject(true);
+
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") );
+new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") );
+
+
+var noo = new MyObject( Math.PI );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') );
+new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') );
+
+new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')",
+ 0,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") );
+
+new TestCase( SECTION,
+ "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')",
+ 3,
+ eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')",
+ 0,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')",
+ 2,
+ eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") );
+
+new TestCase( SECTION,
+ "var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')",
+ 0,
+ eval("var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')") );
+
+new TestCase( SECTION,
+ "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')",
+ 0,
+ eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)",
+ -1,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") );
+
+new TestCase( SECTION,
+ "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)",
+ 0,
+ eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") );
+
+new TestCase( SECTION,
+ "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')",
+ 1,
+ eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") );
+
+new TestCase( SECTION,
+ "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')",
+ 0,
+ eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") );
+
+new TestCase( SECTION,
+ "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')",
+ 1,
+ eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") );
+
+new TestCase( SECTION,
+ "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )",
+ 8,
+ eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") );
+
+// new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively
+new TestCase( SECTION,
+ "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')",
+ 8,
+ eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") );
+
+test();
+
function f() {
- return this;
+ return this;
}
function g() {
- var h = f;
- return h();
+ var h = f;
+ return h();
}
function MyObject (v) {
- this.value = v;
- this.toString = new Function ( "return this.value +\"\"");
- this.indexOf = String.prototype.indexOf;
+ this.value = v;
+ this.toString = new Function ( "return this.value +\"\"");
+ this.indexOf = String.prototype.indexOf;
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // regress http://scopus/bugsplat/show_bug.cgi?id=105721
-
- array[item++] = new TestCase( SECTION, "function f() { return this; }; function g() { var h = f; return h(); }; g().toString()", GLOBAL, g().toString() );
-
-
- array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length", 1, String.prototype.indexOf.length );
- array[item++] = new TestCase( SECTION, "String.prototype.indexOf.length = null; String.prototype.indexOf.length", 1, eval("String.prototype.indexOf.length = null; String.prototype.indexOf.length") );
- array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length", false, delete String.prototype.indexOf.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.indexOf.length; String.prototype.indexOf.length", 1, eval("delete String.prototype.indexOf.length; String.prototype.indexOf.length") );
-
- array[item++] = new TestCase( SECTION, "var s = new String(); s.indexOf()", -1, eval("var s = new String(); s.indexOf()") );
-
- // some Unicode tests.
-
- // generate a test string.
-
- var TEST_STRING = "";
-
- for ( var u = 0x00A1; u <= 0x00FF; u++ ) {
- TEST_STRING += String.fromCharCode( u );
- }
-
- for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
- array[item++] = new TestCase( SECTION,
- "TEST_STRING.indexOf( " + String.fromCharCode(u) + " )",
- i,
- TEST_STRING.indexOf( String.fromCharCode(u) ) );
- }
- for ( var u = 0x00A1, i = 0; u <= 0x00FF; u++, i++ ) {
- array[item++] = new TestCase( SECTION,
- "TEST_STRING.indexOf( " + String.fromCharCode(u) + ", void 0 )",
- i,
- TEST_STRING.indexOf( String.fromCharCode(u), void 0 ) );
- }
-
-
-
- var foo = new MyObject('hello');
-
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('h')", 0, foo.indexOf("h") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('e')", 1, foo.indexOf("e") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('l')", 2, foo.indexOf("l") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('o')", 4, foo.indexOf("o") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf('X')", -1, foo.indexOf("X") );
- array[item++] = new TestCase( SECTION, "var foo = new MyObject('hello');foo.indexOf(5) ", -1, foo.indexOf(5) );
-
- var boo = new MyObject(true);
-
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('t')", 0, boo.indexOf("t") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('r')", 1, boo.indexOf("r") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('u')", 2, boo.indexOf("u") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('e')", 3, boo.indexOf("e") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('true')", 0, boo.indexOf("true") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('rue')", 1, boo.indexOf("rue") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('ue')", 2, boo.indexOf("ue") );
- array[item++] = new TestCase( SECTION, "var boo = new MyObject(true);boo.indexOf('oy')", -1, boo.indexOf("oy") );
-
-
- var noo = new MyObject( Math.PI );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('3') ", 0, noo.indexOf('3') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('.') ", 1, noo.indexOf('.') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('4') ", 3, noo.indexOf('4') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('1') ", 2, noo.indexOf('1') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('5') ", 5, noo.indexOf('5') );
- array[item++] = new TestCase( SECTION, "var noo = new MyObject(Math.PI); noo.indexOf('9') ", 6, noo.indexOf('9') );
-
- array[item++] = new TestCase( SECTION,
- "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')",
- 0,
- eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf('new')") );
-
- array[item++] = new TestCase( SECTION,
- "var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')",
- 3,
- eval("var arr = new Array('new','zoo','revue'); arr.indexOf = String.prototype.indexOf; arr.indexOf(',zoo,')") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')",
- 0,
- eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('[object Object]')") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')",
- 2,
- eval("var obj = new Object(); obj.indexOf = String.prototype.indexOf; obj.indexOf('bject')") );
-
- array[item++] = new TestCase( SECTION,
- "var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')",
- 0,
- eval("var f = new Object( String.prototype.indexOf ); f('"+GLOBAL+"')") );
-
- array[item++] = new TestCase( SECTION,
- "var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')",
- 0,
- eval("var f = new Function(); f.toString = Object.prototype.toString; f.indexOf = String.prototype.indexOf; f.indexOf('[object Function]')") );
-
- array[item++] = new TestCase( SECTION,
- "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')",
- -1,
- eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('true')") );
-
- array[item++] = new TestCase( SECTION,
- "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)",
- -1,
- eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 1)") );
-
- array[item++] = new TestCase( SECTION,
- "var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)",
- 0,
- eval("var b = new Boolean(); b.indexOf = String.prototype.indexOf; b.indexOf('false', 0)") );
-
- array[item++] = new TestCase( SECTION,
- "var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')",
- 1,
- eval("var n = new Number(1e21); n.indexOf = String.prototype.indexOf; n.indexOf('e')") );
-
- array[item++] = new TestCase( SECTION,
- "var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')",
- 0,
- eval("var n = new Number(-Infinity); n.indexOf = String.prototype.indexOf; n.indexOf('-')") );
-
- array[item++] = new TestCase( SECTION,
- "var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')",
- 1,
- eval("var n = new Number(0xFF); n.indexOf = String.prototype.indexOf; n.indexOf('5')") );
-
- array[item++] = new TestCase( SECTION,
- "var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )",
- 8,
- eval("var m = Math; m.indexOf = String.prototype.indexOf; m.indexOf( 'Math' )") );
-
- // new Date(0) has '31' or '01' at index 8 depending on whether tester is (GMT-) or (GMT+), respectively
- array[item++] = new TestCase( SECTION,
- "var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')",
- 8,
- eval("var d = new Date(0); d.indexOf = String.prototype.indexOf; d.getTimezoneOffset()>0 ? d.indexOf('31') : d.indexOf('01')") );
-
-
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed )
- ? ""
- : "wrong value "
- }
- stopTest();
-
- // all tests must return a boolean value
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.7-1.js b/mozilla/js/tests/ecma/String/15.5.4.7-1.js
index c9548a6cfc0..831ea11e9c2 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.7-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.7-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,20 +35,21 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.7-1.js
- ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
- Description:
+ File Name: 15.5.4.7-1.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
- If the given searchString appears as a substring of the result of
- converting this object to a string, at one or more positions that are
- at or to the left of the specified position, then the index of the
- rightmost such position is returned; otherwise -1 is returned. If position
- is undefined or not supplied, the length of this string value is assumed,
- so as to search all of the string.
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
- When the lastIndexOf method is called with two arguments searchString and
- position, the following steps are taken:
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
1.Call ToString, giving it the this value as its argument.
2.Call ToString(searchString).
@@ -57,180 +59,159 @@
6.Compute min(max(Result(4), 0), Result(5)).
7.Compute the number of characters in the string that is Result(2).
8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
- than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
- Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
- compute the value -1.
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
1.Return Result(8).
- Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other kinds of objects for use as a method.
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.7-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.protoype.lastIndexOf";
+var SECTION = "15.5.4.7-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
- var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
+var TEST_STRING = new String( " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" );
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var j = 0;
-
-function getTestCases() {
- var array = new Array();
- var j = 0;
-
- for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)",
- -1,
- TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")",
- k,
- TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")",
- k,
- TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) );
- }
-
- for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
-
- "String.lastIndexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ 0 + ")",
- LastIndexOf( TEST_STRING, String.fromCharCode(i) +
- String.fromCharCode(i+1)+String.fromCharCode(i+2), 0),
- TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- 0 ) );
- }
-
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ k +")",
- k,
- TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- k ) );
- }
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf("+(String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ k+1 +")",
- k,
- TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- k+1 ) );
- }
- for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
- array[j] = new TestCase( SECTION,
- "String.lastIndexOf("+
- (String.fromCharCode(i) +
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)) +", "+ (k-1) +")",
- LastIndexOf( TEST_STRING, String.fromCharCode(i) +
- String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1),
- TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
- String.fromCharCode(i+1)+
- String.fromCharCode(i+2)),
- k-1 ) );
- }
-
- array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) );
-// array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 ));
- array[j++] = new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING ));
-
- return array;
+for ( k = 0, i = 0x0021; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf(" +String.fromCharCode(i)+ ", 0)",
+ -1,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), 0 ) );
}
-function test() {
- writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
-
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
-
- }
- stopTest();
-
- return ( testcases );
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k ) );
}
+for ( k = 0, i = 0x0020; i < 0x007e; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+String.fromCharCode(i)+ ", "+k+1+")",
+ k,
+ TEST_STRING.lastIndexOf( String.fromCharCode(i), k+1 ) );
+}
+
+for ( k = 9, i = 0x0021; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ 0 + ")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), 0),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ 0 ) );
+}
+
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+(String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ k+1 +")",
+ k,
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k+1 ) );
+}
+for ( k = 0, i = 0x0020; i < 0x007d; i++, j++, k++ ) {
+ new TestCase( SECTION,
+ "String.lastIndexOf("+
+ (String.fromCharCode(i) +
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)) +", "+ (k-1) +")",
+ LastIndexOf( TEST_STRING, String.fromCharCode(i) +
+ String.fromCharCode(i+1)+String.fromCharCode(i+2), k-1),
+ TEST_STRING.lastIndexOf( (String.fromCharCode(i)+
+ String.fromCharCode(i+1)+
+ String.fromCharCode(i+2)),
+ k-1 ) );
+}
+
+new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 0 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 0 ) );
+
+// new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ", 1 )", 0, TEST_STRING.lastIndexOf( TEST_STRING, 1 ));
+
+new TestCase( SECTION, "String.lastIndexOf(" +TEST_STRING + ")", 0, TEST_STRING.lastIndexOf( TEST_STRING ));
+
+writeLineToLog( "TEST_STRING = new String(\" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\")" );
+
+test();
+
function LastIndexOf( string, search, position ) {
- string = String( string );
- search = String( search );
+ string = String( string );
+ search = String( search );
- position = Number( position )
+ position = Number( position )
if ( isNaN( position ) ) {
- position = Infinity;
+ position = Infinity;
} else {
- position = ToInteger( position );
+ position = ToInteger( position );
}
- result5= string.length;
- result6 = Math.min(Math.max(position, 0), result5);
- result7 = search.length;
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
- if (result7 == 0) {
- return Math.min(position, result5);
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
}
-
- result8 = -1;
-
- for ( k = 0; k <= result6; k++ ) {
- if ( k+ result7 > result5 ) {
- break;
- }
- for ( j = 0; j < result7; j++ ) {
- if ( string.charAt(k+j) != search.charAt(j) ){
- break;
- } else {
- if ( j == result7 -1 ) {
- result8 = k;
- }
- }
- }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
}
+ }
- return result8;
+ return result8;
}
function ToInteger( n ) {
- n = Number( n );
- if ( isNaN(n) ) {
- return 0;
- }
- if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
- return n;
- }
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- return ( sign * Math.floor(Math.abs(n)) );
-}
\ No newline at end of file
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.7-2.js b/mozilla/js/tests/ecma/String/15.5.4.7-2.js
index 74c5a3363d9..5117875c4fa 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.7-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.7-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,20 +35,21 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.7-2.js
- ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
- Description:
+ File Name: 15.5.4.7-2.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
- If the given searchString appears as a substring of the result of
- converting this object to a string, at one or more positions that are
- at or to the left of the specified position, then the index of the
- rightmost such position is returned; otherwise -1 is returned. If position
- is undefined or not supplied, the length of this string value is assumed,
- so as to search all of the string.
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
- When the lastIndexOf method is called with two arguments searchString and
- position, the following steps are taken:
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
1.Call ToString, giving it the this value as its argument.
2.Call ToString(searchString).
@@ -57,179 +59,157 @@
6.Compute min(max(Result(4), 0), Result(5)).
7.Compute the number of characters in the string that is Result(2).
8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
- than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
- Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
- compute the value -1.
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
1.Return Result(8).
- Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other kinds of objects for use as a method.
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
- Author: christine@netscape.com, pschwartau@netscape.com
- Date: 02 October 1997
- Modified: 14 July 2002
- Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
- ECMA-262 Ed.3 Section 15.5.4.8
- The length property of the lastIndexOf method is 1
-*
-*/
- var SECTION = "15.5.4.7-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.protoype.lastIndexOf";
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 02 October 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.8
+ The length property of the lastIndexOf method is 1
+ *
+ */
+var SECTION = "15.5.4.7-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
+writeHeaderToLog( SECTION + " "+ TITLE);
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length );
+new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length );
+new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) );
- array[item++] = new TestCase( SECTION, "String.prototype.lastIndexOf.length", 1, String.prototype.lastIndexOf.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length", false, delete String.prototype.lastIndexOf.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length", 1, eval("delete String.prototype.lastIndexOf.length; String.prototype.lastIndexOf.length" ) );
+new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") );
+new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") );
- array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('', 0)", LastIndexOf("","",0), eval("var s = new String(''); s.lastIndexOf('', 0)") );
- array[item++] = new TestCase( SECTION, "var s = new String(''); s.lastIndexOf('')", LastIndexOf("",""), eval("var s = new String(''); s.lastIndexOf('')") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('', 0)", LastIndexOf("hello","",0), eval("var s = new String('hello'); s.lastIndexOf('',0)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('')", LastIndexOf("hello",""), eval("var s = new String('hello'); s.lastIndexOf('')") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll')", LastIndexOf("hello","ll"), eval("var s = new String('hello'); s.lastIndexOf('ll')") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 0)", LastIndexOf("hello","ll",0), eval("var s = new String('hello'); s.lastIndexOf('ll', 0)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1)", LastIndexOf("hello","ll",1), eval("var s = new String('hello'); s.lastIndexOf('ll', 1)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2)", LastIndexOf("hello","ll",2), eval("var s = new String('hello'); s.lastIndexOf('ll', 2)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 3)", LastIndexOf("hello","ll",3), eval("var s = new String('hello'); s.lastIndexOf('ll', 3)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 4)", LastIndexOf("hello","ll",4), eval("var s = new String('hello'); s.lastIndexOf('ll', 4)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 5)", LastIndexOf("hello","ll",5), eval("var s = new String('hello'); s.lastIndexOf('ll', 5)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 6)", LastIndexOf("hello","ll",6), eval("var s = new String('hello'); s.lastIndexOf('ll', 6)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 1.5)", LastIndexOf('hello','ll', 1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 1.5)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', 2.5)", LastIndexOf('hello','ll', 2.5), eval("var s = new String('hello'); s.lastIndexOf('ll', 2.5)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1)", LastIndexOf('hello','ll', -1), eval("var s = new String('hello'); s.lastIndexOf('ll', -1)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -1.5)",LastIndexOf('hello','ll', -1.5), eval("var s = new String('hello'); s.lastIndexOf('ll', -1.5)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") );
+new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") );
+for ( var i = 0; i < ( "[object Object]" ).length; i++ ) {
+ new TestCase( SECTION,
+ "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")",
+ ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) ,
+ eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") );
+}
+for ( var i = 0; i < 5; i ++ ) {
+ new TestCase( SECTION,
+ "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")",
+ ( i < 2 ? -1 : 2 ),
+ eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") );
+}
+for ( var i = 0; i < 5; i ++ ) {
+ new TestCase( SECTION,
+ "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")",
+ ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ),
+ eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") );
+}
+for ( var i = 0; i < 9; i++ ) {
+ new TestCase( SECTION,
+ "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )",
+ ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ),
+ eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") );
+}
+var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -Infinity)", LastIndexOf("hello","ll",-Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', -Infinity)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', Infinity)", LastIndexOf("hello","ll",Infinity), eval("var s = new String('hello'); s.lastIndexOf('ll', Infinity)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', NaN)", LastIndexOf("hello","ll",NaN), eval("var s = new String('hello'); s.lastIndexOf('ll', NaN)") );
- array[item++] = new TestCase( SECTION, "var s = new String('hello'); s.lastIndexOf('ll', -0)", LastIndexOf("hello","ll",-0), eval("var s = new String('hello'); s.lastIndexOf('ll', -0)") );
- for ( var i = 0; i < ( "[object Object]" ).length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")",
- ( i < 2 ? -1 : ( i < 9 ? 2 : 9 )) ,
- eval("var o = new Object(); o.lastIndexOf = String.prototype.lastIndexOf; o.lastIndexOf('b', "+ i + ")") );
- }
- for ( var i = 0; i < 5; i ++ ) {
- array[item++] = new TestCase( SECTION,
- "var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")",
- ( i < 2 ? -1 : 2 ),
- eval("var b = new Boolean(); b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('l', "+ i + ")") );
- }
- for ( var i = 0; i < 5; i ++ ) {
- array[item++] = new TestCase( SECTION,
- "var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")",
- ( i < 1 ? -1 : ( i < 9 ? 1 : ( i < 10 ? 9 : 10 ) ) ),
- eval("var b = new Boolean(); b.toString = Object.prototype.toString; b.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('o', "+ i + ")") );
- }
- for ( var i = 0; i < 9; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )",
- ( i < 3 ? -1 : ( i < 5 ? 3 : 5 ) ),
- eval("var n = new Number(Infinity); n.lastIndexOf = String.prototype.lastIndexOf; n.lastIndexOf( 'i', " + i + " )") );
- }
- var a = new Array( "abc","def","ghi","jkl","mno","pqr","stu","vwx","yz" );
+for ( var i = 0; i < (a.toString()).length; i++ ) {
+ new TestCase( SECTION,
+ "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )",
+ ( i < 15 ? -1 : 15 ),
+ eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") );
+}
- for ( var i = 0; i < (a.toString()).length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )",
- ( i < 15 ? -1 : 15 ),
- eval("var a = new Array( 'abc','def','ghi','jkl','mno','pqr','stu','vwx','yz' ); a.lastIndexOf = String.prototype.lastIndexOf; a.lastIndexOf( ',mno,p', "+i+" )") );
- }
-
- for ( var i = 0; i < 15; i ++ ) {
- array[item++] = new TestCase( SECTION,
- "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")",
- ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ),
- eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") );
- }
+for ( var i = 0; i < 15; i ++ ) {
+ new TestCase( SECTION,
+ "var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")",
+ ( i < 6 ? -1 : ( i < 10 ? 6 : 10 ) ),
+ eval("var m = Math; m.lastIndexOf = String.prototype.lastIndexOf; m.lastIndexOf('t', "+ i + ")") );
+}
/*
- for ( var i = 0; i < 15; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )",
- )
- }
+ for ( var i = 0; i < 15; i++ ) {
+ new TestCase( SECTION,
+ "var d = new Date(); d.lastIndexOf = String.prototype.lastIndexOf; d.lastIndexOf( '0' )",
+ )
+ }
*/
- return array;
-}
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
-
- return ( testcases );
-}
+test();
function LastIndexOf( string, search, position ) {
- string = String( string );
- search = String( search );
+ string = String( string );
+ search = String( search );
- position = Number( position )
+ position = Number( position )
if ( isNaN( position ) ) {
- position = Infinity;
+ position = Infinity;
} else {
- position = ToInteger( position );
+ position = ToInteger( position );
}
- result5= string.length;
- result6 = Math.min(Math.max(position, 0), result5);
- result7 = search.length;
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
- if (result7 == 0) {
- return Math.min(position, result5);
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
}
-
- result8 = -1;
-
- for ( k = 0; k <= result6; k++ ) {
- if ( k+ result7 > result5 ) {
- break;
- }
- for ( j = 0; j < result7; j++ ) {
- if ( string.charAt(k+j) != search.charAt(j) ){
- break;
- } else {
- if ( j == result7 -1 ) {
- result8 = k;
- }
- }
- }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
}
+ }
- return result8;
+ return result8;
}
function ToInteger( n ) {
- n = Number( n );
- if ( isNaN(n) ) {
- return 0;
- }
- if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
- return n;
- }
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- return ( sign * Math.floor(Math.abs(n)) );
-}
\ No newline at end of file
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.7-3.js b/mozilla/js/tests/ecma/String/15.5.4.7-3.js
index fa9713e79f4..26c2abbae3c 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.7-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.7-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,20 +35,21 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.7-3.js
- ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
- Description:
+ File Name: 15.5.4.7-3.js
+ ECMA Section: 15.5.4.7 String.prototype.lastIndexOf( searchString, pos)
+ Description:
- If the given searchString appears as a substring of the result of
- converting this object to a string, at one or more positions that are
- at or to the left of the specified position, then the index of the
- rightmost such position is returned; otherwise -1 is returned. If position
- is undefined or not supplied, the length of this string value is assumed,
- so as to search all of the string.
+ If the given searchString appears as a substring of the result of
+ converting this object to a string, at one or more positions that are
+ at or to the left of the specified position, then the index of the
+ rightmost such position is returned; otherwise -1 is returned. If position
+ is undefined or not supplied, the length of this string value is assumed,
+ so as to search all of the string.
- When the lastIndexOf method is called with two arguments searchString and
- position, the following steps are taken:
+ When the lastIndexOf method is called with two arguments searchString and
+ position, the following steps are taken:
1.Call ToString, giving it the this value as its argument.
2.Call ToString(searchString).
@@ -57,125 +59,101 @@
6.Compute min(max(Result(4), 0), Result(5)).
7.Compute the number of characters in the string that is Result(2).
8.Compute the largest possible integer k not larger than Result(6) such that k+Result(7) is not greater
- than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
- Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
- compute the value -1.
+ than Result(5), and for all nonnegative integers j less than Result(7), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2); but if there is no such integer k, then
+ compute the value -1.
1.Return Result(8).
- Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
- String object. Therefore it can be transferred to other kinds of objects for use as a method.
+ Note that the lastIndexOf function is intentionally generic; it does not require that its this value be a
+ String object. Therefore it can be transferred to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 2 october 1997
+ Author: christine@netscape.com
+ Date: 2 october 1997
*/
- var SECTION = "15.5.4.7-3";
- var VERSION = "ECMA_2";
- startTest();
- var TITLE = "String.protoype.lastIndexOf";
+var SECTION = "15.5.4.7-3";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "String.protoype.lastIndexOf";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )",
+ -1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") );
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") );
- array[item++] = new TestCase( SECTION,
- "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )",
- -1,
- eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 0 )") );
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") );
- array[item++] = new TestCase( SECTION,
- "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )",
- 1,
- eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 1 )") );
+new TestCase( SECTION,
+ "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )",
+ 1,
+ eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") );
- array[item++] = new TestCase( SECTION,
- "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )",
- 1,
- eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 2 )") );
-
- array[item++] = new TestCase( SECTION,
- "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )",
- 1,
- eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r', 10 )") );
-
- array[item++] = new TestCase( SECTION,
- "var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )",
- 1,
- eval("var b = true; b.__proto__.lastIndexOf = String.prototype.lastIndexOf; b.lastIndexOf('r' )") );
-
- return array;
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value "
- }
- stopTest();
-
- return ( testcases );
-}
+test();
function LastIndexOf( string, search, position ) {
- string = String( string );
- search = String( search );
+ string = String( string );
+ search = String( search );
- position = Number( position )
+ position = Number( position )
if ( isNaN( position ) ) {
- position = Infinity;
+ position = Infinity;
} else {
- position = ToInteger( position );
+ position = ToInteger( position );
}
- result5= string.length;
- result6 = Math.min(Math.max(position, 0), result5);
- result7 = search.length;
+ result5= string.length;
+ result6 = Math.min(Math.max(position, 0), result5);
+ result7 = search.length;
- if (result7 == 0) {
- return Math.min(position, result5);
+ if (result7 == 0) {
+ return Math.min(position, result5);
+ }
+
+ result8 = -1;
+
+ for ( k = 0; k <= result6; k++ ) {
+ if ( k+ result7 > result5 ) {
+ break;
}
-
- result8 = -1;
-
- for ( k = 0; k <= result6; k++ ) {
- if ( k+ result7 > result5 ) {
- break;
- }
- for ( j = 0; j < result7; j++ ) {
- if ( string.charAt(k+j) != search.charAt(j) ){
- break;
- } else {
- if ( j == result7 -1 ) {
- result8 = k;
- }
- }
- }
+ for ( j = 0; j < result7; j++ ) {
+ if ( string.charAt(k+j) != search.charAt(j) ){
+ break;
+ } else {
+ if ( j == result7 -1 ) {
+ result8 = k;
+ }
+ }
}
+ }
- return result8;
+ return result8;
}
function ToInteger( n ) {
- n = Number( n );
- if ( isNaN(n) ) {
- return 0;
- }
- if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
- return n;
- }
+ n = Number( n );
+ if ( isNaN(n) ) {
+ return 0;
+ }
+ if ( Math.abs(n) == 0 || Math.abs(n) == Infinity ) {
+ return n;
+ }
- var sign = ( n < 0 ) ? -1 : 1;
+ var sign = ( n < 0 ) ? -1 : 1;
- return ( sign * Math.floor(Math.abs(n)) );
-}
\ No newline at end of file
+ return ( sign * Math.floor(Math.abs(n)) );
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.8-1.js b/mozilla/js/tests/ecma/String/15.5.4.8-1.js
index 83bf7280555..3b8e2386410 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.8-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.8-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,216 +35,195 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.8-1.js
- ECMA Section: 15.5.4.8 String.prototype.split( separator )
- Description:
-
- Returns an Array object into which substrings of the result of converting
- this object to a string have been stored. The substrings are determined by
- searching from left to right for occurrences of the given separator; these
- occurrences are not part of any substring in the returned array, but serve
- to divide up this string value. The separator may be a string of any length.
-
- As a special case, if the separator is the empty string, the string is split
- up into individual characters; the length of the result array equals the
- length of the string, and each substring contains one character.
-
- If the separator is not supplied, then the result array contains just one
- string, which is the string.
-
- Author: christine@netscape.com, pschwartau@netscape.com
- Date: 12 November 1997
- Modified: 14 July 2002
- Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
- ECMA-262 Ed.3 Section 15.5.4.14
- The length property of the split method is 2
-*
-*/
-
- var SECTION = "15.5.4.8-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.split";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") );
-
- // test cases for when split is called with no arguments.
-
- // this is a string object
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); typeof s.split()",
- "object",
- eval("var s = new String('this is a string object'); typeof s.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()",
- "[object Array]",
- eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.split().length",
- 1,
- eval("var s = new String('this is a string object'); s.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.split()[0]",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.split()[0]") );
-
- // this is an object object
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]",
- "[object Object]",
- eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") );
-
- // this is a function object
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]",
- "[object Function]",
- eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") );
-
- // this is a number object
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]",
- "-1e+21",
- eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") );
-
-
- // this is the Math object
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.split = String.prototype.split; obj.split()[0]",
- "[object Math]",
- eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") );
-
- // this is an array object
- array[item++] = new TestCase( SECTION,
- "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]",
- "1,2,3,4,5",
- eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") );
-
- // this is a Boolean object
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()",
- "object",
- eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
- "[object Array]",
- eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length",
- 1,
- eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") );
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]",
- "false",
- eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") );
-
-
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+/**
+ File Name: 15.5.4.8-1.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
+
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
+
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
+
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
+
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155289
+ ECMA-262 Ed.3 Section 15.5.4.14
+ The length property of the split method is 2
+ *
+ */
+
+var SECTION = "15.5.4.8-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.split.length", 2, String.prototype.split.length );
+new TestCase( SECTION, "delete String.prototype.split.length", false, delete String.prototype.split.length );
+new TestCase( SECTION, "delete String.prototype.split.length; String.prototype.split.length", 2, eval("delete String.prototype.split.length; String.prototype.split.length") );
+
+// test cases for when split is called with no arguments.
+
+// this is a string object
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.split()",
+ "object",
+ eval("var s = new String('this is a string object'); typeof s.split()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()",
+ "[object Array]",
+ eval("var s = new String('this is a string object'); Array.prototype.getClass = Object.prototype.toString; (s.split()).getClass()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split().length",
+ 1,
+ eval("var s = new String('this is a string object'); s.split().length") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.split()[0]",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.split()[0]") );
+
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Object(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]",
+ "[object Object]",
+ eval("var obj = new Object(); obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Function(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]",
+ "[object Function]",
+ eval("var obj = new Function(); obj.split = String.prototype.split; obj.toString = Object.prototype.toString; obj.split()[0]") );
+
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Number(NaN); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Number(Infinity); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Number(-1234567890); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]",
+ "-1e+21",
+ eval("var obj = new Number(-1e21); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = Math; obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = Math; obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = Math; obj.split = String.prototype.split; obj.split()[0]",
+ "[object Math]",
+ eval("var obj = Math; obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is an array object
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]",
+ "1,2,3,4,5",
+ eval("var obj = new Array(1,2,3,4,5); obj.split = String.prototype.split; obj.split()[0]") );
+
+// this is a Boolean object
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()",
+ "object",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; typeof obj.split()") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.getClass()",
+ "[object Array]",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; Array.prototype.getClass = Object.prototype.toString; obj.split().getClass()") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length",
+ 1,
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split().length") );
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]",
+ "false",
+ eval("var obj = new Boolean(); obj.split = String.prototype.split; obj.split()[0]") );
+
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.8-2.js b/mozilla/js/tests/ecma/String/15.5.4.8-2.js
index 64b0bef5fa5..b5fba626512 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.8-2.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.8-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,230 +35,211 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.8-2.js
- ECMA Section: 15.5.4.8 String.prototype.split( separator )
- Description:
+ File Name: 15.5.4.8-2.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
- Returns an Array object into which substrings of the result of converting
- this object to a string have been stored. The substrings are determined by
- searching from left to right for occurrences of the given separator; these
- occurrences are not part of any substring in the returned array, but serve
- to divide up this string value. The separator may be a string of any length.
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
- As a special case, if the separator is the empty string, the string is split
- up into individual characters; the length of the result array equals the
- length of the string, and each substring contains one character.
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
- If the separator is not supplied, then the result array contains just one
- string, which is the string.
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
- When the split method is called with one argument separator, the following steps are taken:
+ When the split method is called with one argument separator, the following steps are taken:
1. Call ToString, giving it the this value as its argument.
2. Create a new Array object of length 0 and call it A.
3. If separator is not supplied, call the [[Put]] method of A with 0 and
- Result(1) as arguments, and then return A.
+ Result(1) as arguments, and then return A.
4. Call ToString(separator).
5. Compute the number of characters in Result(1).
6. Compute the number of characters in the string that is Result(4).
7. Let p be 0.
8. If Result(6) is zero (the separator string is empty), go to step 17.
9. Compute the smallest possible integer k not smaller than p such that
- k+Result(6) is not greater than Result(5), and for all nonnegative
- integers j less than Result(6), the character at position k+j of
- Result(1) is the same as the character at position j of Result(2);
- but if there is no such integer k, then go to step 14.
- 10. Compute a string value equal to the substring of Result(1), consisting
- of the characters at positions p through k1, inclusive.
- 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
- 12. Let p be k+Result(6).
- 13. Go to step 9.
- 14. Compute a string value equal to the substring of Result(1), consisting
- of the characters from position p to the end of Result(1).
- 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
- 16. Return A.
- 17. If p equals Result(5), return A.
- 18. Compute a string value equal to the substring of Result(1), consisting of
- the single character at position p.
- 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
- 20. Increase p by 1.
- 21. Go to step 17.
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
-Note that the split function is intentionally generic; it does not require that its this value be a String
-object. Therefore it can be transferred to other kinds of objects for use as a method.
+ Note that the split function is intentionally generic; it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.8-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.split";
+var SECTION = "15.5.4.8-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// case where separator is the empty string.
-function getTestCases() {
- var array = new Array();
- var item = 0;
+var TEST_STRING = "this is a string object";
- // case where separator is the empty string.
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split('').length",
+ TEST_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split('').length") );
- var TEST_STRING = "this is a string object";
+for ( var i = 0; i < TEST_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split('').length",
- TEST_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split('').length") );
-
- for ( var i = 0; i < TEST_STRING.length; i++ ) {
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]",
- TEST_STRING.charAt(i),
- eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") );
- }
-
- // case where the value of the separator is undefined. in this case. the value of the separator
- // should be ToString( separator ), or "undefined".
-
- var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject";
- var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length",
- EXPECT_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split(void 0).length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") );
- }
-
- // case where the value of the separator is null. in this case the value of the separator is "null".
- TEST_STRING = "thisnullisnullanullstringnullobject";
- var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split(null).length",
- EXPECT_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split(null).length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") );
- }
-
- // case where the value of the separator is a boolean.
- TEST_STRING = "thistrueistrueatruestringtrueobject";
- var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split(true).length",
- EXPECT_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split(true).length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") );
- }
-
- // case where the value of the separator is a number
- TEST_STRING = "this123is123a123string123object";
- var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
- EXPECT_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split(123).length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
- }
-
-
- // case where the value of the separator is a number
- TEST_STRING = "this123is123a123string123object";
- var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
- EXPECT_STRING.length,
- eval("var s = new String( TEST_STRING ); s.split(123).length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
- }
-
- // case where the separator is not in the string
- TEST_STRING = "this is a string";
- EXPECT_STRING = new Array( "this is a string" );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( " + TEST_STRING + " ); s.split(':').length",
- 1,
- eval("var s = new String( TEST_STRING ); s.split(':').length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( " + TEST_STRING + " ); s.split(':')[0]",
- TEST_STRING,
- eval("var s = new String( TEST_STRING ); s.split(':')[0]") );
-
- // case where part but not all of separator is in the string.
- TEST_STRING = "this is a string";
- EXPECT_STRING = new Array( "this is a string" );
- array[item++] = new TestCase( SECTION,
- "var s = new String( " + TEST_STRING + " ); s.split('strings').length",
- 1,
- eval("var s = new String( TEST_STRING ); s.split('strings').length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]",
- TEST_STRING,
- eval("var s = new String( TEST_STRING ); s.split('strings')[0]") );
-
- // case where the separator is at the end of the string
- TEST_STRING = "this is a string";
- EXPECT_STRING = new Array( "this is a " );
- array[item++] = new TestCase( SECTION,
- "var s = new String( " + TEST_STRING + " ); s.split('string').length",
- 2,
- eval("var s = new String( TEST_STRING ); s.split('string').length") );
-
- for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
- array[item++] = new TestCase( SECTION,
- "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]",
- EXPECT_STRING[i],
- eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") );
- }
- return array;
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('')["+i+"]",
+ TEST_STRING.charAt(i),
+ eval("var s = new String( TEST_STRING ); s.split('')["+i+"]") );
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+// case where the value of the separator is undefined. in this case. the value of the separator
+// should be ToString( separator ), or "undefined".
+
+var TEST_STRING = "thisundefinedisundefinedaundefinedstringundefinedobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(void 0).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(void 0).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(void 0)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(void 0)["+i+"]") );
}
+
+// case where the value of the separator is null. in this case the value of the separator is "null".
+TEST_STRING = "thisnullisnullanullstringnullobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(null).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(null).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(null)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(null)["+i+"]") );
+}
+
+// case where the value of the separator is a boolean.
+TEST_STRING = "thistrueistrueatruestringtrueobject";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(true).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(true).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(true)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(true)["+i+"]") );
+}
+
+// case where the value of the separator is a number
+TEST_STRING = "this123is123a123string123object";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+}
+
+
+// case where the value of the separator is a number
+TEST_STRING = "this123is123a123string123object";
+var EXPECT_STRING = new Array( "this", "is", "a", "string", "object" );
+
+new TestCase( SECTION,
+ "var s = new String( "+ TEST_STRING +" ); s.split(123).length",
+ EXPECT_STRING.length,
+ eval("var s = new String( TEST_STRING ); s.split(123).length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split(123)["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split(123)["+i+"]") );
+}
+
+// case where the separator is not in the string
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a string" );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split(':').length") );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split(':')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split(':')[0]") );
+
+// case where part but not all of separator is in the string.
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a string" );
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings').length",
+ 1,
+ eval("var s = new String( TEST_STRING ); s.split('strings').length") );
+
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('strings')[0]",
+ TEST_STRING,
+ eval("var s = new String( TEST_STRING ); s.split('strings')[0]") );
+
+// case where the separator is at the end of the string
+TEST_STRING = "this is a string";
+EXPECT_STRING = new Array( "this is a " );
+new TestCase( SECTION,
+ "var s = new String( " + TEST_STRING + " ); s.split('string').length",
+ 2,
+ eval("var s = new String( TEST_STRING ); s.split('string').length") );
+
+for ( var i = 0; i < EXPECT_STRING.length; i++ ) {
+ new TestCase( SECTION,
+ "var s = new String( "+TEST_STRING+" ); s.split('string')["+i+"]",
+ EXPECT_STRING[i],
+ eval("var s = new String( TEST_STRING ); s.split('string')["+i+"]") );
+}
+
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.4.8-3.js b/mozilla/js/tests/ecma/String/15.5.4.8-3.js
index f5734e8889b..4c26c8364ab 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.8-3.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.8-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,187 +35,168 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 15.5.4.8-3.js
- ECMA Section: 15.5.4.8 String.prototype.split( separator )
- Description:
+ File Name: 15.5.4.8-3.js
+ ECMA Section: 15.5.4.8 String.prototype.split( separator )
+ Description:
- Returns an Array object into which substrings of the result of converting
- this object to a string have been stored. The substrings are determined by
- searching from left to right for occurrences of the given separator; these
- occurrences are not part of any substring in the returned array, but serve
- to divide up this string value. The separator may be a string of any length.
+ Returns an Array object into which substrings of the result of converting
+ this object to a string have been stored. The substrings are determined by
+ searching from left to right for occurrences of the given separator; these
+ occurrences are not part of any substring in the returned array, but serve
+ to divide up this string value. The separator may be a string of any length.
- As a special case, if the separator is the empty string, the string is split
- up into individual characters; the length of the result array equals the
- length of the string, and each substring contains one character.
+ As a special case, if the separator is the empty string, the string is split
+ up into individual characters; the length of the result array equals the
+ length of the string, and each substring contains one character.
- If the separator is not supplied, then the result array contains just one
- string, which is the string.
+ If the separator is not supplied, then the result array contains just one
+ string, which is the string.
- When the split method is called with one argument separator, the following steps are taken:
+ When the split method is called with one argument separator, the following steps are taken:
1. Call ToString, giving it the this value as its argument.
2. Create a new Array object of length 0 and call it A.
3. If separator is not supplied, call the [[Put]] method of A with 0 and
- Result(1) as arguments, and then return A.
+ Result(1) as arguments, and then return A.
4. Call ToString(separator).
5. Compute the number of characters in Result(1).
6. Compute the number of characters in the string that is Result(4).
7. Let p be 0.
8. If Result(6) is zero (the separator string is empty), go to step 17.
9. Compute the smallest possible integer k not smaller than p such that
- k+Result(6) is not greater than Result(5), and for all nonnegative
- integers j less than Result(6), the character at position k+j of
- Result(1) is the same as the character at position j of Result(2);
- but if there is no such integer k, then go to step 14.
- 10. Compute a string value equal to the substring of Result(1), consisting
- of the characters at positions p through k1, inclusive.
- 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
- 12. Let p be k+Result(6).
- 13. Go to step 9.
- 14. Compute a string value equal to the substring of Result(1), consisting
- of the characters from position p to the end of Result(1).
- 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
- 16. Return A.
- 17. If p equals Result(5), return A.
- 18. Compute a string value equal to the substring of Result(1), consisting of
- the single character at position p.
- 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
- 20. Increase p by 1.
- 21. Go to step 17.
+ k+Result(6) is not greater than Result(5), and for all nonnegative
+ integers j less than Result(6), the character at position k+j of
+ Result(1) is the same as the character at position j of Result(2);
+ but if there is no such integer k, then go to step 14.
+ 10. Compute a string value equal to the substring of Result(1), consisting
+ of the characters at positions p through k1, inclusive.
+ 11. Call the [[Put]] method of A with A.length and Result(10) as arguments.
+ 12. Let p be k+Result(6).
+ 13. Go to step 9.
+ 14. Compute a string value equal to the substring of Result(1), consisting
+ of the characters from position p to the end of Result(1).
+ 15. Call the [[Put]] method of A with A.length and Result(14) as arguments.
+ 16. Return A.
+ 17. If p equals Result(5), return A.
+ 18. Compute a string value equal to the substring of Result(1), consisting of
+ the single character at position p.
+ 19. Call the [[Put]] method of A with A.length and Result(18) as arguments.
+ 20. Increase p by 1.
+ 21. Go to step 17.
-Note that the split function is intentionally generic; it does not require that its this value be a String
-object. Therefore it can be transferred to other kinds of objects for use as a method.
+ Note that the split function is intentionally generic; it does not require that its this value be a String
+ object. Therefore it can be transferred to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "15.5.4.8-3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.split";
+var SECTION = "15.5.4.8-3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.split";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+var TEST_STRING = "";
+var EXPECT = new Array();
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// this.toString is the empty string.
- var TEST_STRING = "";
- var EXPECT = new Array();
+new TestCase( SECTION,
+ "var s = new String(); s.split().length",
+ 1,
+ eval("var s = new String(); s.split().length") );
- // this.toString is the empty string.
+new TestCase( SECTION,
+ "var s = new String(); s.split()[0]",
+ "",
+ eval("var s = new String(); s.split()[0]") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.split().length",
- 1,
- eval("var s = new String(); s.split().length") );
+// this.toString() is the empty string, separator is specified.
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.split()[0]",
- "",
- eval("var s = new String(); s.split()[0]") );
+new TestCase( SECTION,
+ "var s = new String(); s.split('').length",
+ 0,
+ eval("var s = new String(); s.split('').length") );
- // this.toString() is the empty string, separator is specified.
+new TestCase( SECTION,
+ "var s = new String(); s.split(' ').length",
+ 1,
+ eval("var s = new String(); s.split(' ').length") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.split('').length",
- 0,
- eval("var s = new String(); s.split('').length") );
+// this to string is " "
+new TestCase( SECTION,
+ "var s = new String(' '); s.split().length",
+ 1,
+ eval("var s = new String(' '); s.split().length") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.split(' ').length",
- 1,
- eval("var s = new String(); s.split(' ').length") );
+new TestCase( SECTION,
+ "var s = new String(' '); s.split()[0]",
+ " ",
+ eval("var s = new String(' '); s.split()[0]") );
- // this to string is " "
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split().length",
- 1,
- eval("var s = new String(' '); s.split().length") );
+new TestCase( SECTION,
+ "var s = new String(' '); s.split('').length",
+ 1,
+ eval("var s = new String(' '); s.split('').length") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split()[0]",
- " ",
- eval("var s = new String(' '); s.split()[0]") );
+new TestCase( SECTION,
+ "var s = new String(' '); s.split('')[0]",
+ " ",
+ eval("var s = new String(' '); s.split('')[0]") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split('').length",
- 1,
- eval("var s = new String(' '); s.split('').length") );
+new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ').length",
+ 2,
+ eval("var s = new String(' '); s.split(' ').length") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split('')[0]",
- " ",
- eval("var s = new String(' '); s.split('')[0]") );
+new TestCase( SECTION,
+ "var s = new String(' '); s.split(' ')[0]",
+ "",
+ eval("var s = new String(' '); s.split(' ')[0]") );
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split(' ').length",
- 2,
- eval("var s = new String(' '); s.split(' ').length") );
+new TestCase( SECTION,
+ "\"\".split(\"\").length",
+ 0,
+ ("".split("")).length );
- array[item++] = new TestCase( SECTION,
- "var s = new String(' '); s.split(' ')[0]",
- "",
- eval("var s = new String(' '); s.split(' ')[0]") );
+new TestCase( SECTION,
+ "\"\".split(\"x\").length",
+ 1,
+ ("".split("x")).length );
- array[item++] = new TestCase( SECTION,
- "\"\".split(\"\").length",
- 0,
- ("".split("")).length );
+new TestCase( SECTION,
+ "\"\".split(\"x\")[0]",
+ "",
+ ("".split("x"))[0] );
- array[item++] = new TestCase( SECTION,
- "\"\".split(\"x\").length",
- 1,
- ("".split("x")).length );
+test();
- array[item++] = new TestCase( SECTION,
- "\"\".split(\"x\")[0]",
- "",
- ("".split("x"))[0] );
-
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function Split( string, separator ) {
- string = String( string );
+ string = String( string );
- var A = new Array();
+ var A = new Array();
- if ( arguments.length < 2 ) {
- A[0] = string;
- return A;
- }
-
- separator = String( separator );
-
- var str_len = String( string ).length;
- var sep_len = String( separator ).length;
-
- var p = 0;
- var k = 0;
-
- if ( sep_len == 0 ) {
- for ( ; p < str_len; p++ ) {
- A[A.length] = String( string.charAt(p) );
- }
- }
+ if ( arguments.length < 2 ) {
+ A[0] = string;
return A;
+ }
+
+ separator = String( separator );
+
+ var str_len = String( string ).length;
+ var sep_len = String( separator ).length;
+
+ var p = 0;
+ var k = 0;
+
+ if ( sep_len == 0 ) {
+ for ( ; p < str_len; p++ ) {
+ A[A.length] = String( string.charAt(p) );
+ }
+ }
+ return A;
}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.9-1.js b/mozilla/js/tests/ecma/String/15.5.4.9-1.js
index 7c3c678a208..0cccf0a315c 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.9-1.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.9-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,184 +35,166 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.9-1.js
- ECMA Section: 15.5.4.9 String.prototype.substring( start )
- Description:
-
- 15.5.4.9 String.prototype.substring(start)
-
- Returns a substring of the result of converting this object to a string,
- starting from character position start and running to the end of the
- string. The result is a string value, not a String object.
-
- If the argument is NaN or negative, it is replaced with zero; if the
- argument is larger than the length of the string, it is replaced with the
- length of the string.
-
- When the substring method is called with one argument start, the following
- steps are taken:
-
- 1.Call ToString, giving it the this value as its argument.
- 2.Call ToInteger(start).
- 3.Compute the number of characters in Result(1).
- 4.Compute min(max(Result(2), 0), Result(3)).
- 5.Return a string whose length is the difference between Result(3) and Result(4),
- containing characters from Result(1), namely the characters with indices Result(4)
- through Result(3)1, in ascending order.
-
- Author: christine@netscape.com
- Date: 12 november 1997
-*/
-
- var SECTION = "15.5.4.9-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.prototype.substring( start )";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
- array[item++] = new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
-
- // test cases for when substring is called with no arguments.
-
- // this is a string object
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); typeof s.substring()",
- "string",
- eval("var s = new String('this is a string object'); typeof s.substring()") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String(''); s.substring()",
- "",
- eval("var s = new String(''); s.substring()") );
-
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring()",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring()") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(NaN)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(NaN)") );
-
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(-0.01)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(-0.01)") );
-
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(s.length)",
- "",
- eval("var s = new String('this is a string object'); s.substring(s.length)") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(s.length+1)",
- "",
- eval("var s = new String('this is a string object'); s.substring(s.length+1)") );
-
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(Infinity)",
- "",
- eval("var s = new String('this is a string object'); s.substring(Infinity)") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('this is a string object'); s.substring(-Infinity)",
- "this is a string object",
- eval("var s = new String('this is a string object'); s.substring(-Infinity)") );
-
- // this is not a String object, start is not an integer
-
-
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()",
- "1,2,3,4,5",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)",
- ",2,3,4,5",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')",
- "3,4,5",
- eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')",
- "",
- eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") );
-
- // this is an object object
- array[item++] = new TestCase( SECTION,
- "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)",
- "Object]",
- eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") );
-
- // this is a function object
- array[item++] = new TestCase( SECTION,
- "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)",
- "Function]",
- eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") );
- // this is a number object
- array[item++] = new TestCase( SECTION,
- "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)",
- "NaN",
- eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") );
-
- // this is the Math object
- array[item++] = new TestCase( SECTION,
- "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)",
- "ject Math]",
- eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") );
-
- // this is a Boolean object
-
- array[item++] = new TestCase( SECTION,
- "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())",
- "false",
- eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") );
-
- // this is a user defined object
-
- array[item++] = new TestCase( SECTION,
- "var obj = new MyObject( null ); obj.substring(0)",
- "null",
- eval( "var obj = new MyObject( null ); obj.substring(0)") );
-
- return array;
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function MyObject( value ) {
- this.value = value;
- this.substring = String.prototype.substring;
- this.toString = new Function ( "return this.value+''" );
-}
\ No newline at end of file
+
+/**
+ File Name: 15.5.4.9-1.js
+ ECMA Section: 15.5.4.9 String.prototype.substring( start )
+ Description:
+
+ 15.5.4.9 String.prototype.substring(start)
+
+ Returns a substring of the result of converting this object to a string,
+ starting from character position start and running to the end of the
+ string. The result is a string value, not a String object.
+
+ If the argument is NaN or negative, it is replaced with zero; if the
+ argument is larger than the length of the string, it is replaced with the
+ length of the string.
+
+ When the substring method is called with one argument start, the following
+ steps are taken:
+
+ 1.Call ToString, giving it the this value as its argument.
+ 2.Call ToInteger(start).
+ 3.Compute the number of characters in Result(1).
+ 4.Compute min(max(Result(2), 0), Result(3)).
+ 5.Return a string whose length is the difference between Result(3) and Result(4),
+ containing characters from Result(1), namely the characters with indices Result(4)
+ through Result(3)1, in ascending order.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.4.9-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.prototype.substring( start )";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION, "String.prototype.substring.length", 2, String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length", false, delete String.prototype.substring.length );
+new TestCase( SECTION, "delete String.prototype.substring.length; String.prototype.substring.length", 2, eval("delete String.prototype.substring.length; String.prototype.substring.length") );
+
+// test cases for when substring is called with no arguments.
+
+// this is a string object
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); typeof s.substring()",
+ "string",
+ eval("var s = new String('this is a string object'); typeof s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new String(''); s.substring()",
+ "",
+ eval("var s = new String(''); s.substring()") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring()",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(NaN)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(NaN)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-0.01)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-0.01)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(s.length+1)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(s.length+1)") );
+
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(Infinity)",
+ "",
+ eval("var s = new String('this is a string object'); s.substring(Infinity)") );
+
+new TestCase( SECTION,
+ "var s = new String('this is a string object'); s.substring(-Infinity)",
+ "this is a string object",
+ eval("var s = new String('this is a string object'); s.substring(-Infinity)") );
+
+// this is not a String object, start is not an integer
+
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()",
+ "1,2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring()") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)",
+ ",2,3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring(true)") );
+
+new TestCase( SECTION,
+ "var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')",
+ "3,4,5",
+ eval("var s = new Array(1,2,3,4,5); s.substring = String.prototype.substring; s.substring('4')") );
+
+new TestCase( SECTION,
+ "var s = new Array(); s.substring = String.prototype.substring; s.substring('4')",
+ "",
+ eval("var s = new Array(); s.substring = String.prototype.substring; s.substring('4')") );
+
+// this is an object object
+new TestCase( SECTION,
+ "var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)",
+ "Object]",
+ eval("var obj = new Object(); obj.substring = String.prototype.substring; obj.substring(8)") );
+
+// this is a function object
+new TestCase( SECTION,
+ "var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)",
+ "Function]",
+ eval("var obj = new Function(); obj.substring = String.prototype.substring; obj.toString = Object.prototype.toString; obj.substring(8)") );
+// this is a number object
+new TestCase( SECTION,
+ "var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)",
+ "NaN",
+ eval("var obj = new Number(NaN); obj.substring = String.prototype.substring; obj.substring(false)") );
+
+// this is the Math object
+new TestCase( SECTION,
+ "var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)",
+ "ject Math]",
+ eval("var obj = Math; obj.substring = String.prototype.substring; obj.substring(Math.PI)") );
+
+// this is a Boolean object
+
+new TestCase( SECTION,
+ "var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())",
+ "false",
+ eval("var obj = new Boolean(); obj.substring = String.prototype.substring; obj.substring(new Array())") );
+
+// this is a user defined object
+
+new TestCase( SECTION,
+ "var obj = new MyObject( null ); obj.substring(0)",
+ "null",
+ eval( "var obj = new MyObject( null ); obj.substring(0)") );
+
+
+test();
+
+function MyObject( value ) {
+ this.value = value;
+ this.substring = String.prototype.substring;
+ this.toString = new Function ( "return this.value+''" );
+}
diff --git a/mozilla/js/tests/ecma/String/15.5.4.js b/mozilla/js/tests/ecma/String/15.5.4.js
index e562550fe1e..2e8b27c1cb0 100644
--- a/mozilla/js/tests/ecma/String/15.5.4.js
+++ b/mozilla/js/tests/ecma/String/15.5.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,56 +35,33 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.4.js
- ECMA Section: 15.5.4 Properties of the String prototype object
- Description:
- Author: christine@netscape.com
- Date: 28 october 1997
+/**
+ File Name: 15.5.4.js
+ ECMA Section: 15.5.4 Properties of the String prototype object
+
+ Description:
+ Author: christine@netscape.com
+ Date: 28 october 1997
*/
- var SECTION = "15.5.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "Properties of the String Prototype objecta";
+var SECTION = "15.5.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "Properties of the String Prototype objecta";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()",
- "[object String]",
- eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") );
-
- array[item++] = new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype );
- array[item++] = new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
- array[item++] = new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' );
- array[item++] = new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
-// array[item++] = new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
+writeHeaderToLog( SECTION + " "+ TITLE);
- return ( array );
-}
-function test( array ) {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION,
+ "String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()",
+ "[object String]",
+ eval("String.prototype.getClass = Object.prototype.toString; String.prototype.getClass()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+new TestCase( SECTION, "typeof String.prototype", "object", typeof String.prototype );
+new TestCase( SECTION, "String.prototype.valueOf()", "", String.prototype.valueOf() );
+new TestCase( SECTION, "String.prototype +''", "", String.prototype + '' );
+new TestCase( SECTION, "String.prototype.length", 0, String.prototype.length );
+// new TestCase( SECTION, "String.prototype.__proto__", Object.prototype, String.prototype.__proto__ );
- }
-
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
+test();
diff --git a/mozilla/js/tests/ecma/String/15.5.5.1.js b/mozilla/js/tests/ecma/String/15.5.5.1.js
index 91eaa5c7921..c9abcf174d0 100644
--- a/mozilla/js/tests/ecma/String/15.5.5.1.js
+++ b/mozilla/js/tests/ecma/String/15.5.5.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,72 +35,52 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 15.5.5.1
- ECMA Section: String.length
- Description:
-
- The number of characters in the String value represented by this String
- object.
-
- Once a String object is created, this property is unchanging. It has the
- attributes { DontEnum, DontDelete, ReadOnly }.
-
- Author: christine@netscape.com
- Date: 12 november 1997
-*/
-
- var SECTION = "15.5.5.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "String.length";
-
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.length",
- 0,
- eval("var s = new String(); s.length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String(); s.length = 10; s.length",
- 0,
- eval("var s = new String(); s.length = 10; s.length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props",
- "",
- eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String(); delete s.length",
- false,
- eval("var s = new String(); delete s.length") );
-
- array[item++] = new TestCase( SECTION,
- "var s = new String('hello'); delete s.length; s.length",
- 5,
- eval("var s = new String('hello'); delete s.length; s.length") );
- return array;
-
-}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+
+/**
+ File Name: 15.5.5.1
+ ECMA Section: String.length
+ Description:
+
+ The number of characters in the String value represented by this String
+ object.
+
+ Once a String object is created, this property is unchanging. It has the
+ attributes { DontEnum, DontDelete, ReadOnly }.
+
+ Author: christine@netscape.com
+ Date: 12 november 1997
+*/
+
+var SECTION = "15.5.5.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "String.length";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+new TestCase( SECTION,
+ "var s = new String(); s.length",
+ 0,
+ eval("var s = new String(); s.length") );
+
+new TestCase( SECTION,
+ "var s = new String(); s.length = 10; s.length",
+ 0,
+ eval("var s = new String(); s.length = 10; s.length") );
+
+new TestCase( SECTION,
+ "var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props",
+ "",
+ eval("var s = new String(); var props = ''; for ( var p in s ) { props += p; }; props") );
+
+new TestCase( SECTION,
+ "var s = new String(); delete s.length",
+ false,
+ eval("var s = new String(); delete s.length") );
+
+new TestCase( SECTION,
+ "var s = new String('hello'); delete s.length; s.length",
+ 5,
+ eval("var s = new String('hello'); delete s.length; s.length") );
+
+test();
diff --git a/mozilla/js/tests/ecma/String/browser.js b/mozilla/js/tests/ecma/String/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/String/shell.js b/mozilla/js/tests/ecma/String/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.2.js b/mozilla/js/tests/ecma/TypeConversion/9.2.js
index 1b927d1eb98..981392287ea 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.2.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,93 +35,79 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.2.js
- ECMA Section: 9.2 Type Conversion: ToBoolean
- Description: rules for converting an argument to a boolean.
- undefined false
- Null false
- Boolean input argument( no conversion )
- Number returns false for 0, -0, and NaN
- otherwise return true
- String return false if the string is empty
- (length is 0) otherwise the result is
- true
- Object all return true
+ File Name: 9.2.js
+ ECMA Section: 9.2 Type Conversion: ToBoolean
+ Description: rules for converting an argument to a boolean.
+ undefined false
+ Null false
+ Boolean input argument( no conversion )
+ Number returns false for 0, -0, and NaN
+ otherwise return true
+ String return false if the string is empty
+ (length is 0) otherwise the result is
+ true
+ Object all return true
- Author: christine@netscape.com
- Date: 14 july 1997
+ Author: christine@netscape.com
+ Date: 14 july 1997
*/
- var SECTION = "9.2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToBoolean";
+var SECTION = "9.2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToBoolean";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+// special cases here
- // special cases here
+new TestCase( SECTION, "Boolean()", false, Boolean() );
+new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) );
+new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) );
+new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
+new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
+new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
+new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
+new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) );
+new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
+new TestCase( SECTION, "Boolean('')", false, Boolean("") );
- testcases[tc++] = new TestCase( SECTION, "Boolean()", false, Boolean() );
- testcases[tc++] = new TestCase( SECTION, "Boolean(var x)", false, Boolean(eval("var x")) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(void 0)", false, Boolean(void 0) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(null)", false, Boolean(null) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(false)", false, Boolean(false) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(true)", true, Boolean(true) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(0)", false, Boolean(0) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(-0)", false, Boolean(-0) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(NaN)", false, Boolean(Number.NaN) );
- testcases[tc++] = new TestCase( SECTION, "Boolean('')", false, Boolean("") );
+// normal test cases here
- // normal test cases here
+new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) );
+new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
+new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
+new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") );
+new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
+new TestCase( SECTION, "Boolean('string')", true, Boolean("string") );
- testcases[tc++] = new TestCase( SECTION, "Boolean(Infinity)", true, Boolean(Number.POSITIVE_INFINITY) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(-Infinity)", true, Boolean(Number.NEGATIVE_INFINITY) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(Math.PI)", true, Boolean(Math.PI) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(1)", true, Boolean(1) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(-1)", true, Boolean(-1) );
- testcases[tc++] = new TestCase( SECTION, "Boolean([tab])", true, Boolean("\t") );
- testcases[tc++] = new TestCase( SECTION, "Boolean('0')", true, Boolean("0") );
- testcases[tc++] = new TestCase( SECTION, "Boolean('string')", true, Boolean("string") );
+// ToBoolean (object) should always return true.
+new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) );
+new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) );
- // ToBoolean (object) should always return true.
- testcases[tc++] = new TestCase( SECTION, "Boolean(new String() )", true, Boolean(new String()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new String('') )", true, Boolean(new String("")) );
+new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) );
+new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) );
+new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(true))", true, Boolean(new Boolean(true)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean(false))", true, Boolean(new Boolean(false)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Boolean() )", true, Boolean(new Boolean()) );
+new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Array())", true, Boolean(new Array()) );
+new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) );
+new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) );
+new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) );
+new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number())", true, Boolean(new Number()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-0))", true, Boolean(new Number(-0)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(0))", true, Boolean(new Number(0)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(NaN))", true, Boolean(new Number(Number.NaN)) );
+new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) );
+new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) );
+new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-1))", true, Boolean(new Number(-1)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(Infinity))", true, Boolean(new Number(Number.POSITIVE_INFINITY)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Number(-Infinity))",true, Boolean(new Number(Number.NEGATIVE_INFINITY)) );
+new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) );
+new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) );
+new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) );
+new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) );
+new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Object())", true, Boolean(new Object()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Function())", true, Boolean(new Function()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Date())", true, Boolean(new Date()) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(new Date(0))", true, Boolean(new Date(0)) );
- testcases[tc++] = new TestCase( SECTION, "Boolean(Math)", true, Boolean(Math) );
+test();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.3-1.js b/mozilla/js/tests/ecma/TypeConversion/9.3-1.js
index 32e22abe663..59b459411b1 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.3-1.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,78 +35,77 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.3-1.js
- ECMA Section: 9.3 Type Conversion: ToNumber
- Description: rules for converting an argument to a number.
- see 9.3.1 for cases for converting strings to numbers.
- special cases:
- undefined NaN
- Null NaN
- Boolean 1 if true; +0 if false
- Number the argument ( no conversion )
- String see test 9.3.1
- Object see test 9.3-1
+ File Name: 9.3-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
- This tests ToNumber applied to the object type, except
- if object is string. See 9.3-2 for
- ToNumber( String object).
+ This tests ToNumber applied to the object type, except
+ if object is string. See 9.3-2 for
+ ToNumber( String object).
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.3-1";
- var VERSION = "ECMA_1";
- startTest();
- var TYPE = "number";
- var testcases = getTestCases();
+var SECTION = "9.3-1";
+var VERSION = "ECMA_1";
+startTest();
+var TYPE = "number";
- writeHeaderToLog( SECTION + " ToNumber");
- test();
+writeHeaderToLog( SECTION + " ToNumber");
+// object is Number
+new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) );
+new TestCase( SECTION, "Number(new Number(Number.NaN))",Number.NaN, Number(new Number(Number.NaN)) );
+new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) );
+new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) );
+// new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) );
+new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) );
+new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) );
+
+// object is boolean
+
+new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) );
+new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) );
+
+// object is array
+new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) );
+
+
+
+
+test();
+
+// XXX bc replace test()
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
- testcases[tc].passed = writeTestCaseResult(
- TYPE,
- typeof(testcases[tc].actual),
- "typeof( " + testcases[tc].description +
- " ) = " + typeof(testcases[tc].actual) )
- ? testcases[tc].passed
- : false;
+ testcases[tc].passed = writeTestCaseResult(
+ TYPE,
+ typeof(testcases[tc].actual),
+ "typeof( " + testcases[tc].description +
+ " ) = " + typeof(testcases[tc].actual) )
+ ? testcases[tc].passed
+ : false;
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // object is Number
- array[item++] = new TestCase( SECTION, "Number(new Number())", 0, Number(new Number()) );
- array[item++] = new TestCase( SECTION, "Number(new Number(Number.NaN))",Number.NaN, Number(new Number(Number.NaN)) );
- array[item++] = new TestCase( SECTION, "Number(new Number(0))", 0, Number(new Number(0)) );
- array[item++] = new TestCase( SECTION, "Number(new Number(null))", 0, Number(new Number(null)) );
-// array[item++] = new TestCase( SECTION, "Number(new Number(void 0))", Number.NaN, Number(new Number(void 0)) );
- array[item++] = new TestCase( SECTION, "Number(new Number(true))", 1, Number(new Number(true)) );
- array[item++] = new TestCase( SECTION, "Number(new Number(false))", 0, Number(new Number(false)) );
-
- // object is boolean
-
- array[item++] = new TestCase( SECTION, "Number(new Boolean(true))", 1, Number(new Boolean(true)) );
- array[item++] = new TestCase( SECTION, "Number(new Boolean(false))", 0, Number(new Boolean(false)) );
-
- // object is array
- array[item++] = new TestCase( SECTION, "Number(new Array(2,4,8,16,32))", Number.NaN, Number(new Array(2,4,8,16,32)) );
-
- return ( array );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ stopTest();
+ return ( testcases );
}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.3.1-1.js b/mozilla/js/tests/ecma/TypeConversion/9.3.1-1.js
index be9e00e6450..48fa6e40c3c 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.3.1-1.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.3.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,304 +36,284 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 9.3.1-1.js
- ECMA Section: 9.3 Type Conversion: ToNumber
- Description: rules for converting an argument to a number.
- see 9.3.1 for cases for converting strings to numbers.
- special cases:
- undefined NaN
- Null NaN
- Boolean 1 if true; +0 if false
- Number the argument ( no conversion )
- String see test 9.3.1
- Object see test 9.3-1
+ File Name: 9.3.1-1.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
- This tests ToNumber applied to the string type
+ This tests ToNumber applied to the string type
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.3.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToNumber applied to the String type";
- var BUGNUMBER="77391";
+var SECTION = "9.3.1-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToNumber applied to the String type";
+var BUGNUMBER="77391";
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var testcases = getTestCases();
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
-
- // StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace:::
- //
- // Name Unicode Value Escape Sequence
- // 0X0009 \t
- // 0X0020
- // 0X000C \f
- // 0X000B
- // 0X000D \r
- // 0X000A \n
- array[item++] = new TestCase( SECTION, "Number('')", 0, Number("") );
- array[item++] = new TestCase( SECTION, "Number(' ')", 0, Number(" ") );
- array[item++] = new TestCase( SECTION, "Number(\\t)", 0, Number("\t") );
- array[item++] = new TestCase( SECTION, "Number(\\n)", 0, Number("\n") );
- array[item++] = new TestCase( SECTION, "Number(\\r)", 0, Number("\r") );
- array[item++] = new TestCase( SECTION, "Number(\\f)", 0, Number("\f") );
-
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) );
-
- // a StringNumericLiteral may be preceeded or followed by whitespace and/or
- // line terminators
-
- array[item++] = new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) );
- array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) );
- array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) );
- array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) );
- array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) );
-
- array[item++] = new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') );
- array[item++] = new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) );
- array[item++] = new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) );
- array[item++] = new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) );
- array[item++] = new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) );
-
- array[item++] = new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) );
-
- array[item++] = new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') );
- array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') );
- array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') );
- array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') );
- array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') );
-
- array[item++] = new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') );
- array[item++] = new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) );
- array[item++] = new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) );
- array[item++] = new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) );
- array[item++] = new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) );
-
- array[item++] = new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) );
- array[item++] = new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) );
-
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) );
-
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
-
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) );
-
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) );
-
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
-
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) );
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) );
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) );
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) );
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) );
- array[item++] = new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) );
+writeHeaderToLog( SECTION + " "+ TITLE);
- // StrNumericLiteral:::StrDecimalLiteral:::Infinity
+// StringNumericLiteral:::StrWhiteSpace:::StrWhiteSpaceChar StrWhiteSpace:::
+//
+// Name Unicode Value Escape Sequence
+// 0X0009 \t
+// 0X0020
+// 0X000C \f
+// 0X000B
+// 0X000D \r
+// 0X000A \n
+new TestCase( SECTION, "Number('')", 0, Number("") );
+new TestCase( SECTION, "Number(' ')", 0, Number(" ") );
+new TestCase( SECTION, "Number(\\t)", 0, Number("\t") );
+new TestCase( SECTION, "Number(\\n)", 0, Number("\n") );
+new TestCase( SECTION, "Number(\\r)", 0, Number("\r") );
+new TestCase( SECTION, "Number(\\f)", 0, Number("\f") );
- array[item++] = new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") );
- array[item++] = new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") );
- array[item++] = new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") );
+new TestCase( SECTION, "Number(String.fromCharCode(0x0009)", 0, Number(String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x0020)", 0, Number(String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000C)", 0, Number(String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000B)", 0, Number(String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000D)", 0, Number(String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number(String.fromCharCode(0x000A)", 0, Number(String.fromCharCode(0x000A)) );
- // StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
+// a StringNumericLiteral may be preceeded or followed by whitespace and/or
+// line terminators
- array[item++] = new TestCase( SECTION, "Number('0')", 0, Number("0") );
- array[item++] = new TestCase( SECTION, "Number('-0')", -0, Number("-0") );
- array[item++] = new TestCase( SECTION, "Number('+0')", 0, Number("+0") );
+new TestCase( SECTION, "Number( ' ' + 999 )", 999, Number( ' '+999) );
+new TestCase( SECTION, "Number( '\\n' + 999 )", 999, Number( '\n' +999) );
+new TestCase( SECTION, "Number( '\\r' + 999 )", 999, Number( '\r' +999) );
+new TestCase( SECTION, "Number( '\\t' + 999 )", 999, Number( '\t' +999) );
+new TestCase( SECTION, "Number( '\\f' + 999 )", 999, Number( '\f' +999) );
- array[item++] = new TestCase( SECTION, "Number('1')", 1, Number("1") );
- array[item++] = new TestCase( SECTION, "Number('-1')", -1, Number("-1") );
- array[item++] = new TestCase( SECTION, "Number('+1')", 1, Number("+1") );
+new TestCase( SECTION, "Number( 999 + ' ' )", 999, Number( 999+' ') );
+new TestCase( SECTION, "Number( 999 + '\\n' )", 999, Number( 999+'\n' ) );
+new TestCase( SECTION, "Number( 999 + '\\r' )", 999, Number( 999+'\r' ) );
+new TestCase( SECTION, "Number( 999 + '\\t' )", 999, Number( 999+'\t' ) );
+new TestCase( SECTION, "Number( 999 + '\\f' )", 999, Number( 999+'\f' ) );
- array[item++] = new TestCase( SECTION, "Number('2')", 2, Number("2") );
- array[item++] = new TestCase( SECTION, "Number('-2')", -2, Number("-2") );
- array[item++] = new TestCase( SECTION, "Number('+2')", 2, Number("+2") );
+new TestCase( SECTION, "Number( '\\n' + 999 + '\\n' )", 999, Number( '\n' +999+'\n' ) );
+new TestCase( SECTION, "Number( '\\r' + 999 + '\\r' )", 999, Number( '\r' +999+'\r' ) );
+new TestCase( SECTION, "Number( '\\t' + 999 + '\\t' )", 999, Number( '\t' +999+'\t' ) );
+new TestCase( SECTION, "Number( '\\f' + 999 + '\\f' )", 999, Number( '\f' +999+'\f' ) );
- array[item++] = new TestCase( SECTION, "Number('3')", 3, Number("3") );
- array[item++] = new TestCase( SECTION, "Number('-3')", -3, Number("-3") );
- array[item++] = new TestCase( SECTION, "Number('+3')", 3, Number("+3") );
+new TestCase( SECTION, "Number( ' ' + '999' )", 999, Number( ' '+'999') );
+new TestCase( SECTION, "Number( '\\n' + '999' )", 999, Number( '\n' +'999') );
+new TestCase( SECTION, "Number( '\\r' + '999' )", 999, Number( '\r' +'999') );
+new TestCase( SECTION, "Number( '\\t' + '999' )", 999, Number( '\t' +'999') );
+new TestCase( SECTION, "Number( '\\f' + '999' )", 999, Number( '\f' +'999') );
- array[item++] = new TestCase( SECTION, "Number('4')", 4, Number("4") );
- array[item++] = new TestCase( SECTION, "Number('-4')", -4, Number("-4") );
- array[item++] = new TestCase( SECTION, "Number('+4')", 4, Number("+4") );
+new TestCase( SECTION, "Number( '999' + ' ' )", 999, Number( '999'+' ') );
+new TestCase( SECTION, "Number( '999' + '\\n' )", 999, Number( '999'+'\n' ) );
+new TestCase( SECTION, "Number( '999' + '\\r' )", 999, Number( '999'+'\r' ) );
+new TestCase( SECTION, "Number( '999' + '\\t' )", 999, Number( '999'+'\t' ) );
+new TestCase( SECTION, "Number( '999' + '\\f' )", 999, Number( '999'+'\f' ) );
- array[item++] = new TestCase( SECTION, "Number('5')", 5, Number("5") );
- array[item++] = new TestCase( SECTION, "Number('-5')", -5, Number("-5") );
- array[item++] = new TestCase( SECTION, "Number('+5')", 5, Number("+5") );
+new TestCase( SECTION, "Number( '\\n' + '999' + '\\n' )", 999, Number( '\n' +'999'+'\n' ) );
+new TestCase( SECTION, "Number( '\\r' + '999' + '\\r' )", 999, Number( '\r' +'999'+'\r' ) );
+new TestCase( SECTION, "Number( '\\t' + '999' + '\\t' )", 999, Number( '\t' +'999'+'\t' ) );
+new TestCase( SECTION, "Number( '\\f' + '999' + '\\f' )", 999, Number( '\f' +'999'+'\f' ) );
- array[item++] = new TestCase( SECTION, "Number('6')", 6, Number("6") );
- array[item++] = new TestCase( SECTION, "Number('-6')", -6, Number("-6") );
- array[item++] = new TestCase( SECTION, "Number('+6')", 6, Number("+6") );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' )", 99, Number( String.fromCharCode(0x0009) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' )", 99, Number( String.fromCharCode(0x0020) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' )", 99, Number( String.fromCharCode(0x000C) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' )", 99, Number( String.fromCharCode(0x000B) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' )", 99, Number( String.fromCharCode(0x000D) + '99' ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' )", 99, Number( String.fromCharCode(0x000A) + '99' ) );
- array[item++] = new TestCase( SECTION, "Number('7')", 7, Number("7") );
- array[item++] = new TestCase( SECTION, "Number('-7')", -7, Number("-7") );
- array[item++] = new TestCase( SECTION, "Number('+7')", 7, Number("+7") );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + '99' + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + '99' + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + '99' + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + '99' + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + '99' + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + '99' + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "Number('8')", 8, Number("8") );
- array[item++] = new TestCase( SECTION, "Number('-8')", -8, Number("-8") );
- array[item++] = new TestCase( SECTION, "Number('+8')", 8, Number("+8") );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0009)", 99, Number( '99' + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x0020)", 99, Number( '99' + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000C)", 99, Number( '99' + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000D)", 99, Number( '99' + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000B)", 99, Number( '99' + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( '99' + String.fromCharCode(0x000A)", 99, Number( '99' + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "Number('9')", 9, Number("9") );
- array[item++] = new TestCase( SECTION, "Number('-9')", -9, Number("-9") );
- array[item++] = new TestCase( SECTION, "Number('+9')", 9, Number("+9") );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 )", 99, Number( String.fromCharCode(0x0009) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 )", 99, Number( String.fromCharCode(0x0020) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 )", 99, Number( String.fromCharCode(0x000C) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 )", 99, Number( String.fromCharCode(0x000B) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 )", 99, Number( String.fromCharCode(0x000D) + 99 ) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 )", 99, Number( String.fromCharCode(0x000A) + 99 ) );
- array[item++] = new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") );
- array[item++] = new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") );
- array[item++] = new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x0020) + 99 + String.fromCharCode(0x0020)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000C) + 99 + String.fromCharCode(0x000C)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000D) + 99 + String.fromCharCode(0x000D)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000B) + 99 + String.fromCharCode(0x000B)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( String.fromCharCode(0x000A) + 99 + String.fromCharCode(0x000A)", 99, Number( String.fromCharCode(0x0009) + 99 + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "Number('3.')", 3, Number("3.") );
- array[item++] = new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") );
- array[item++] = new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0009)", 99, Number( 99 + String.fromCharCode(0x0009)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x0020)", 99, Number( 99 + String.fromCharCode(0x0020)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000C)", 99, Number( 99 + String.fromCharCode(0x000C)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000D)", 99, Number( 99 + String.fromCharCode(0x000D)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000B)", 99, Number( 99 + String.fromCharCode(0x000B)) );
+new TestCase( SECTION, "Number( 99 + String.fromCharCode(0x000A)", 99, Number( 99 + String.fromCharCode(0x000A)) );
- array[item++] = new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") );
- array[item++] = new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") );
- array[item++] = new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") );
- array[item++] = new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") );
- array[item++] = new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") );
- array[item++] = new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") );
+// StrNumericLiteral:::StrDecimalLiteral:::Infinity
- array[item++] = new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") );
- array[item++] = new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") );
- array[item++] = new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") );
+new TestCase( SECTION, "Number('Infinity')", Math.pow(10,10000), Number("Infinity") );
+new TestCase( SECTION, "Number('-Infinity')", -Math.pow(10,10000), Number("-Infinity") );
+new TestCase( SECTION, "Number('+Infinity')", Math.pow(10,10000), Number("+Infinity") );
- // StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+// StrNumericLiteral::: StrDecimalLiteral ::: DecimalDigits . DecimalDigits opt ExponentPart opt
- array[item++] = new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") );
- array[item++] = new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") );
- array[item++] = new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") );
+new TestCase( SECTION, "Number('0')", 0, Number("0") );
+new TestCase( SECTION, "Number('-0')", -0, Number("-0") );
+new TestCase( SECTION, "Number('+0')", 0, Number("+0") );
- array[item++] = new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") );
- array[item++] = new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") );
- array[item++] = new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") );
+new TestCase( SECTION, "Number('1')", 1, Number("1") );
+new TestCase( SECTION, "Number('-1')", -1, Number("-1") );
+new TestCase( SECTION, "Number('+1')", 1, Number("+1") );
- array[item++] = new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") );
- array[item++] = new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") );
- array[item++] = new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") );
+new TestCase( SECTION, "Number('2')", 2, Number("2") );
+new TestCase( SECTION, "Number('-2')", -2, Number("-2") );
+new TestCase( SECTION, "Number('+2')", 2, Number("+2") );
- array[item++] = new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") );
- array[item++] = new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") );
- array[item++] = new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") );
+new TestCase( SECTION, "Number('3')", 3, Number("3") );
+new TestCase( SECTION, "Number('-3')", -3, Number("-3") );
+new TestCase( SECTION, "Number('+3')", 3, Number("+3") );
- // StrDecimalLiteral::: DecimalDigits ExponentPart opt
+new TestCase( SECTION, "Number('4')", 4, Number("4") );
+new TestCase( SECTION, "Number('-4')", -4, Number("-4") );
+new TestCase( SECTION, "Number('+4')", 4, Number("+4") );
- array[item++] = new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") );
- array[item++] = new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") );
- array[item++] = new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") );
+new TestCase( SECTION, "Number('5')", 5, Number("5") );
+new TestCase( SECTION, "Number('-5')", -5, Number("-5") );
+new TestCase( SECTION, "Number('+5')", 5, Number("+5") );
- array[item++] = new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") );
- array[item++] = new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") );
- array[item++] = new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") );
+new TestCase( SECTION, "Number('6')", 6, Number("6") );
+new TestCase( SECTION, "Number('-6')", -6, Number("-6") );
+new TestCase( SECTION, "Number('+6')", 6, Number("+6") );
- array[item++] = new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") );
- array[item++] = new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") );
- array[item++] = new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") );
+new TestCase( SECTION, "Number('7')", 7, Number("7") );
+new TestCase( SECTION, "Number('-7')", -7, Number("-7") );
+new TestCase( SECTION, "Number('+7')", 7, Number("+7") );
- // StrNumericLiteral::: HexIntegerLiteral
+new TestCase( SECTION, "Number('8')", 8, Number("8") );
+new TestCase( SECTION, "Number('-8')", -8, Number("-8") );
+new TestCase( SECTION, "Number('+8')", 8, Number("+8") );
- array[item++] = new TestCase( SECTION, "Number('0x0')", 0, Number("0x0"));
- array[item++] = new TestCase( SECTION, "Number('0x1')", 1, Number("0x1"));
- array[item++] = new TestCase( SECTION, "Number('0x2')", 2, Number("0x2"));
- array[item++] = new TestCase( SECTION, "Number('0x3')", 3, Number("0x3"));
- array[item++] = new TestCase( SECTION, "Number('0x4')", 4, Number("0x4"));
- array[item++] = new TestCase( SECTION, "Number('0x5')", 5, Number("0x5"));
- array[item++] = new TestCase( SECTION, "Number('0x6')", 6, Number("0x6"));
- array[item++] = new TestCase( SECTION, "Number('0x7')", 7, Number("0x7"));
- array[item++] = new TestCase( SECTION, "Number('0x8')", 8, Number("0x8"));
- array[item++] = new TestCase( SECTION, "Number('0x9')", 9, Number("0x9"));
- array[item++] = new TestCase( SECTION, "Number('0xa')", 10, Number("0xa"));
- array[item++] = new TestCase( SECTION, "Number('0xb')", 11, Number("0xb"));
- array[item++] = new TestCase( SECTION, "Number('0xc')", 12, Number("0xc"));
- array[item++] = new TestCase( SECTION, "Number('0xd')", 13, Number("0xd"));
- array[item++] = new TestCase( SECTION, "Number('0xe')", 14, Number("0xe"));
- array[item++] = new TestCase( SECTION, "Number('0xf')", 15, Number("0xf"));
- array[item++] = new TestCase( SECTION, "Number('0xA')", 10, Number("0xA"));
- array[item++] = new TestCase( SECTION, "Number('0xB')", 11, Number("0xB"));
- array[item++] = new TestCase( SECTION, "Number('0xC')", 12, Number("0xC"));
- array[item++] = new TestCase( SECTION, "Number('0xD')", 13, Number("0xD"));
- array[item++] = new TestCase( SECTION, "Number('0xE')", 14, Number("0xE"));
- array[item++] = new TestCase( SECTION, "Number('0xF')", 15, Number("0xF"));
+new TestCase( SECTION, "Number('9')", 9, Number("9") );
+new TestCase( SECTION, "Number('-9')", -9, Number("-9") );
+new TestCase( SECTION, "Number('+9')", 9, Number("+9") );
- array[item++] = new TestCase( SECTION, "Number('0X0')", 0, Number("0X0"));
- array[item++] = new TestCase( SECTION, "Number('0X1')", 1, Number("0X1"));
- array[item++] = new TestCase( SECTION, "Number('0X2')", 2, Number("0X2"));
- array[item++] = new TestCase( SECTION, "Number('0X3')", 3, Number("0X3"));
- array[item++] = new TestCase( SECTION, "Number('0X4')", 4, Number("0X4"));
- array[item++] = new TestCase( SECTION, "Number('0X5')", 5, Number("0X5"));
- array[item++] = new TestCase( SECTION, "Number('0X6')", 6, Number("0X6"));
- array[item++] = new TestCase( SECTION, "Number('0X7')", 7, Number("0X7"));
- array[item++] = new TestCase( SECTION, "Number('0X8')", 8, Number("0X8"));
- array[item++] = new TestCase( SECTION, "Number('0X9')", 9, Number("0X9"));
- array[item++] = new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa"));
- array[item++] = new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb"));
- array[item++] = new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc"));
- array[item++] = new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd"));
- array[item++] = new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe"));
- array[item++] = new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf"));
- array[item++] = new TestCase( SECTION, "Number('0XA')", 10, Number("0XA"));
- array[item++] = new TestCase( SECTION, "Number('0XB')", 11, Number("0XB"));
- array[item++] = new TestCase( SECTION, "Number('0XC')", 12, Number("0XC"));
- array[item++] = new TestCase( SECTION, "Number('0XD')", 13, Number("0XD"));
- array[item++] = new TestCase( SECTION, "Number('0XE')", 14, Number("0XE"));
- array[item++] = new TestCase( SECTION, "Number('0XF')", 15, Number("0XF"));
+new TestCase( SECTION, "Number('3.14159')", 3.14159, Number("3.14159") );
+new TestCase( SECTION, "Number('-3.14159')", -3.14159, Number("-3.14159") );
+new TestCase( SECTION, "Number('+3.14159')", 3.14159, Number("+3.14159") );
- return ( array );
-}
+new TestCase( SECTION, "Number('3.')", 3, Number("3.") );
+new TestCase( SECTION, "Number('-3.')", -3, Number("-3.") );
+new TestCase( SECTION, "Number('+3.')", 3, Number("+3.") );
+
+new TestCase( SECTION, "Number('3.e1')", 30, Number("3.e1") );
+new TestCase( SECTION, "Number('-3.e1')", -30, Number("-3.e1") );
+new TestCase( SECTION, "Number('+3.e1')", 30, Number("+3.e1") );
+
+new TestCase( SECTION, "Number('3.e+1')", 30, Number("3.e+1") );
+new TestCase( SECTION, "Number('-3.e+1')", -30, Number("-3.e+1") );
+new TestCase( SECTION, "Number('+3.e+1')", 30, Number("+3.e+1") );
+
+new TestCase( SECTION, "Number('3.e-1')", .30, Number("3.e-1") );
+new TestCase( SECTION, "Number('-3.e-1')", -.30, Number("-3.e-1") );
+new TestCase( SECTION, "Number('+3.e-1')", .30, Number("+3.e-1") );
+
+// StrDecimalLiteral::: .DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "Number('.00001')", 0.00001, Number(".00001") );
+new TestCase( SECTION, "Number('+.00001')", 0.00001, Number("+.00001") );
+new TestCase( SECTION, "Number('-0.0001')", -0.00001, Number("-.00001") );
+
+new TestCase( SECTION, "Number('.01e2')", 1, Number(".01e2") );
+new TestCase( SECTION, "Number('+.01e2')", 1, Number("+.01e2") );
+new TestCase( SECTION, "Number('-.01e2')", -1, Number("-.01e2") );
+
+new TestCase( SECTION, "Number('.01e+2')", 1, Number(".01e+2") );
+new TestCase( SECTION, "Number('+.01e+2')", 1, Number("+.01e+2") );
+new TestCase( SECTION, "Number('-.01e+2')", -1, Number("-.01e+2") );
+
+new TestCase( SECTION, "Number('.01e-2')", 0.0001, Number(".01e-2") );
+new TestCase( SECTION, "Number('+.01e-2')", 0.0001, Number("+.01e-2") );
+new TestCase( SECTION, "Number('-.01e-2')", -0.0001, Number("-.01e-2") );
+
+// StrDecimalLiteral::: DecimalDigits ExponentPart opt
+
+new TestCase( SECTION, "Number('1234e5')", 123400000, Number("1234e5") );
+new TestCase( SECTION, "Number('+1234e5')", 123400000, Number("+1234e5") );
+new TestCase( SECTION, "Number('-1234e5')", -123400000, Number("-1234e5") );
+
+new TestCase( SECTION, "Number('1234e+5')", 123400000, Number("1234e+5") );
+new TestCase( SECTION, "Number('+1234e+5')", 123400000, Number("+1234e+5") );
+new TestCase( SECTION, "Number('-1234e+5')", -123400000, Number("-1234e+5") );
+
+new TestCase( SECTION, "Number('1234e-5')", 0.01234, Number("1234e-5") );
+new TestCase( SECTION, "Number('+1234e-5')", 0.01234, Number("+1234e-5") );
+new TestCase( SECTION, "Number('-1234e-5')", -0.01234, Number("-1234e-5") );
+
+// StrNumericLiteral::: HexIntegerLiteral
+
+new TestCase( SECTION, "Number('0x0')", 0, Number("0x0"));
+new TestCase( SECTION, "Number('0x1')", 1, Number("0x1"));
+new TestCase( SECTION, "Number('0x2')", 2, Number("0x2"));
+new TestCase( SECTION, "Number('0x3')", 3, Number("0x3"));
+new TestCase( SECTION, "Number('0x4')", 4, Number("0x4"));
+new TestCase( SECTION, "Number('0x5')", 5, Number("0x5"));
+new TestCase( SECTION, "Number('0x6')", 6, Number("0x6"));
+new TestCase( SECTION, "Number('0x7')", 7, Number("0x7"));
+new TestCase( SECTION, "Number('0x8')", 8, Number("0x8"));
+new TestCase( SECTION, "Number('0x9')", 9, Number("0x9"));
+new TestCase( SECTION, "Number('0xa')", 10, Number("0xa"));
+new TestCase( SECTION, "Number('0xb')", 11, Number("0xb"));
+new TestCase( SECTION, "Number('0xc')", 12, Number("0xc"));
+new TestCase( SECTION, "Number('0xd')", 13, Number("0xd"));
+new TestCase( SECTION, "Number('0xe')", 14, Number("0xe"));
+new TestCase( SECTION, "Number('0xf')", 15, Number("0xf"));
+new TestCase( SECTION, "Number('0xA')", 10, Number("0xA"));
+new TestCase( SECTION, "Number('0xB')", 11, Number("0xB"));
+new TestCase( SECTION, "Number('0xC')", 12, Number("0xC"));
+new TestCase( SECTION, "Number('0xD')", 13, Number("0xD"));
+new TestCase( SECTION, "Number('0xE')", 14, Number("0xE"));
+new TestCase( SECTION, "Number('0xF')", 15, Number("0xF"));
+
+new TestCase( SECTION, "Number('0X0')", 0, Number("0X0"));
+new TestCase( SECTION, "Number('0X1')", 1, Number("0X1"));
+new TestCase( SECTION, "Number('0X2')", 2, Number("0X2"));
+new TestCase( SECTION, "Number('0X3')", 3, Number("0X3"));
+new TestCase( SECTION, "Number('0X4')", 4, Number("0X4"));
+new TestCase( SECTION, "Number('0X5')", 5, Number("0X5"));
+new TestCase( SECTION, "Number('0X6')", 6, Number("0X6"));
+new TestCase( SECTION, "Number('0X7')", 7, Number("0X7"));
+new TestCase( SECTION, "Number('0X8')", 8, Number("0X8"));
+new TestCase( SECTION, "Number('0X9')", 9, Number("0X9"));
+new TestCase( SECTION, "Number('0Xa')", 10, Number("0Xa"));
+new TestCase( SECTION, "Number('0Xb')", 11, Number("0Xb"));
+new TestCase( SECTION, "Number('0Xc')", 12, Number("0Xc"));
+new TestCase( SECTION, "Number('0Xd')", 13, Number("0Xd"));
+new TestCase( SECTION, "Number('0Xe')", 14, Number("0Xe"));
+new TestCase( SECTION, "Number('0Xf')", 15, Number("0Xf"));
+new TestCase( SECTION, "Number('0XA')", 10, Number("0XA"));
+new TestCase( SECTION, "Number('0XB')", 11, Number("0XB"));
+new TestCase( SECTION, "Number('0XC')", 12, Number("0XC"));
+new TestCase( SECTION, "Number('0XD')", 13, Number("0XD"));
+new TestCase( SECTION, "Number('0XE')", 14, Number("0XE"));
+new TestCase( SECTION, "Number('0XF')", 15, Number("0XF"));
+
+test();
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.3.1-2.js b/mozilla/js/tests/ecma/TypeConversion/9.3.1-2.js
index 824afce5b31..0b8ec1672ba 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.3.1-2.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.3.1-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.3.1-2.js
- ECMA Section: 9.3 Type Conversion: ToNumber
- Description: rules for converting an argument to a number.
- see 9.3.1 for cases for converting strings to numbers.
- special cases:
- undefined NaN
- Null NaN
- Boolean 1 if true; +0 if false
- Number the argument ( no conversion )
- String see test 9.3.1
- Object see test 9.3-1
+ File Name: 9.3.1-2.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
- This tests special cases of ToNumber(string) that are
- not covered in 9.3.1-1.js.
+ This tests special cases of ToNumber(string) that are
+ not covered in 9.3.1-1.js.
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.3.1-2";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToNumber applied to the String type";
+var SECTION = "9.3.1-2";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToNumber applied to the String type";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// A StringNumericLiteral may not use octal notation
+new TestCase( SECTION, "Number(00)", 0, Number("00"));
+new TestCase( SECTION, "Number(01)", 1, Number("01"));
+new TestCase( SECTION, "Number(02)", 2, Number("02"));
+new TestCase( SECTION, "Number(03)", 3, Number("03"));
+new TestCase( SECTION, "Number(04)", 4, Number("04"));
+new TestCase( SECTION, "Number(05)", 5, Number("05"));
+new TestCase( SECTION, "Number(06)", 6, Number("06"));
+new TestCase( SECTION, "Number(07)", 7, Number("07"));
+new TestCase( SECTION, "Number(010)", 10, Number("010"));
+new TestCase( SECTION, "Number(011)", 11, Number("011"));
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+// A StringNumericLIteral may have any number of leading 0 digits
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Number(001)", 1, Number("001"));
+new TestCase( SECTION, "Number(0001)", 1, Number("0001"));
- // A StringNumericLiteral may not use octal notation
+test();
- array[item++] = new TestCase( SECTION, "Number(00)", 0, Number("00"));
- array[item++] = new TestCase( SECTION, "Number(01)", 1, Number("01"));
- array[item++] = new TestCase( SECTION, "Number(02)", 2, Number("02"));
- array[item++] = new TestCase( SECTION, "Number(03)", 3, Number("03"));
- array[item++] = new TestCase( SECTION, "Number(04)", 4, Number("04"));
- array[item++] = new TestCase( SECTION, "Number(05)", 5, Number("05"));
- array[item++] = new TestCase( SECTION, "Number(06)", 6, Number("06"));
- array[item++] = new TestCase( SECTION, "Number(07)", 7, Number("07"));
- array[item++] = new TestCase( SECTION, "Number(010)", 10, Number("010"));
- array[item++] = new TestCase( SECTION, "Number(011)", 11, Number("011"));
-
- // A StringNumericLIteral may have any number of leading 0 digits
-
- array[item++] = new TestCase( SECTION, "Number(001)", 1, Number("001"));
- array[item++] = new TestCase( SECTION, "Number(0001)", 1, Number("0001"));
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.3.1-3.js b/mozilla/js/tests/ecma/TypeConversion/9.3.1-3.js
index 34079c78a7e..adb8bed80bc 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.3.1-3.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.3.1-3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -35,47 +36,44 @@
*
* ***** END LICENSE BLOCK ***** */
/**
- File Name: 9.3.1-3.js
- ECMA Section: 9.3 Type Conversion: ToNumber
- Description: rules for converting an argument to a number.
- see 9.3.1 for cases for converting strings to numbers.
- special cases:
- undefined NaN
- Null NaN
- Boolean 1 if true; +0 if false
- Number the argument ( no conversion )
- String see test 9.3.1
- Object see test 9.3-1
+ File Name: 9.3.1-3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
- Test cases provided by waldemar.
+ Test cases provided by waldemar.
- Author: christine@netscape.com
- Date: 10 june 1998
+ Author: christine@netscape.com
+ Date: 10 june 1998
*/
var SECTION = "9.3.1-3";
var VERSION = "ECMA_1";
- startTest();
+startTest();
var BUGNUMBER="129087";
var TITLE = "Number To String, String To Number";
writeHeaderToLog( SECTION + " "+ TITLE);
-var testcases = new Array();
-
-
// test case from http://scopus.mcom.com/bugsplat/show_bug.cgi?id=312954
var z = 0;
-testcases[tc++] = new TestCase(
- SECTION,
- "var z = 0; print(1/-z)",
- -Infinity,
- 1/-z );
+new TestCase(
+ SECTION,
+ "var z = 0; writeLineToLog(1/-z)",
+ -Infinity,
+ 1/-z );
@@ -85,657 +83,645 @@ testcases[tc++] = new TestCase(
-testcases[tc++] = new TestCase( SECTION,
- '- -"0x80000000"',
- 2147483648,
- - -"0x80000000" );
+new TestCase( SECTION,
+ '- -"0x80000000"',
+ 2147483648,
+ - -"0x80000000" );
-testcases[tc++] = new TestCase( SECTION,
- '- -"0x100000000"',
- 4294967296,
- - -"0x100000000" );
+new TestCase( SECTION,
+ '- -"0x100000000"',
+ 4294967296,
+ - -"0x100000000" );
-testcases[tc++] = new TestCase( SECTION,
- '- "-0x123456789abcde8"',
- 81985529216486880,
- - "-0x123456789abcde8" );
+new TestCase( SECTION,
+ '- "-0x123456789abcde8"',
+ 81985529216486880,
+ - "-0x123456789abcde8" );
// Convert some large numbers to string
-testcases[tc++] = new TestCase( SECTION,
- "1e2000 +''",
- "Infinity",
- 1e2000 +"" );
+new TestCase( SECTION,
+ "1e2000 +''",
+ "Infinity",
+ 1e2000 +"" );
-testcases[tc++] = new TestCase( SECTION,
- "1e2000",
- Infinity,
- 1e2000 );
+new TestCase( SECTION,
+ "1e2000",
+ Infinity,
+ 1e2000 );
-testcases[tc++] = new TestCase( SECTION,
- "-1e2000 +''",
- "-Infinity",
- -1e2000 +"" );
+new TestCase( SECTION,
+ "-1e2000 +''",
+ "-Infinity",
+ -1e2000 +"" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"1e2000\"",
- -Infinity,
- -"1e2000" );
+new TestCase( SECTION,
+ "-\"1e2000\"",
+ -Infinity,
+ -"1e2000" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"-1e2000\" +''",
- "Infinity",
- -"-1e2000" +"" );
+new TestCase( SECTION,
+ "-\"-1e2000\" +''",
+ "Infinity",
+ -"-1e2000" +"" );
-testcases[tc++] = new TestCase( SECTION,
- "1e-2000",
- 0,
- 1e-2000 );
+new TestCase( SECTION,
+ "1e-2000",
+ 0,
+ 1e-2000 );
-testcases[tc++] = new TestCase( SECTION,
- "1/1e-2000",
- Infinity,
- 1/1e-2000 );
+new TestCase( SECTION,
+ "1/1e-2000",
+ Infinity,
+ 1/1e-2000 );
// convert some strings to large numbers
-testcases[tc++] = new TestCase( SECTION,
- "1/-1e-2000",
- -Infinity,
- 1/-1e-2000 );
+new TestCase( SECTION,
+ "1/-1e-2000",
+ -Infinity,
+ 1/-1e-2000 );
-testcases[tc++] = new TestCase( SECTION,
- "1/\"1e-2000\"",
- Infinity,
- 1/"1e-2000" );
+new TestCase( SECTION,
+ "1/\"1e-2000\"",
+ Infinity,
+ 1/"1e-2000" );
-testcases[tc++] = new TestCase( SECTION,
- "1/\"-1e-2000\"",
- -Infinity,
- 1/"-1e-2000" );
+new TestCase( SECTION,
+ "1/\"-1e-2000\"",
+ -Infinity,
+ 1/"-1e-2000" );
-testcases[tc++] = new TestCase( SECTION,
- "parseFloat(\"1e2000\")",
- Infinity,
- parseFloat("1e2000") );
+new TestCase( SECTION,
+ "parseFloat(\"1e2000\")",
+ Infinity,
+ parseFloat("1e2000") );
-testcases[tc++] = new TestCase( SECTION,
- "parseFloat(\"1e-2000\")",
- 0,
- parseFloat("1e-2000") );
+new TestCase( SECTION,
+ "parseFloat(\"1e-2000\")",
+ 0,
+ parseFloat("1e-2000") );
-testcases[tc++] = new TestCase( SECTION,
- "1.7976931348623157E+308",
- 1.7976931348623157e+308,
- 1.7976931348623157E+308 );
+new TestCase( SECTION,
+ "1.7976931348623157E+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623157E+308 );
-testcases[tc++] = new TestCase( SECTION,
- "1.7976931348623158e+308",
- 1.7976931348623157e+308,
- 1.7976931348623158e+308 );
+new TestCase( SECTION,
+ "1.7976931348623158e+308",
+ 1.7976931348623157e+308,
+ 1.7976931348623158e+308 );
-testcases[tc++] = new TestCase( SECTION,
- "1.7976931348623159e+308",
- Infinity,
- 1.7976931348623159e+308 );
+new TestCase( SECTION,
+ "1.7976931348623159e+308",
+ Infinity,
+ 1.7976931348623159e+308 );
s =
"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068";
-testcases[tc++] = new TestCase( SECTION,
- "s = " + s +"; s +="+
-"\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+
+new TestCase( SECTION,
+ "s = " + s +"; s +="+
+ "\"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779\""+
-+"; s",
-"17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779",
-s +=
-"190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779"
-);
+ +"; s",
+ "17976931348623158079372897140530341507993413271003782693617377898044496829276475094664901797758720709633028641669288791094655554785194040263065748867150582068190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779",
+ s +=
+ "190890200070838367627385484581771153176447573027006985557136695962284291481986083493647529271907416844436551070434271155969950809304288017790417449779"
+ );
s1 = s+1;
-testcases[tc++] = new TestCase( SECTION,
-"s1 = s+1; s1",
-"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791",
-s1 );
+new TestCase( SECTION,
+ "s1 = s+1; s1",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497791",
+ s1 );
/***** This answer is preferred but -Infinity is also acceptable here *****/
-testcases[tc++] = new TestCase( SECTION,
-"-s1 == Infinity || s1 == 1.7976931348623157e+308",
-true,
--s1 == Infinity || s1 == 1.7976931348623157e+308 );
+new TestCase( SECTION,
+ "-s1 == Infinity || s1 == 1.7976931348623157e+308",
+ true,
+ -s1 == Infinity || s1 == 1.7976931348623157e+308 );
s2 = s + 2;
-testcases[tc++] = new TestCase( SECTION,
-"s2 = s+2; s2",
-"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792",
-s2 );
+new TestCase( SECTION,
+ "s2 = s+2; s2",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497792",
+ s2 );
// ***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ",
-true,
--s2 == -Infinity || -s2 == -1.7976931348623157e+308 );
+new TestCase( SECTION,
+ "-s2 == -Infinity || -s2 == -1.7976931348623157e+308 ",
+ true,
+ -s2 == -Infinity || -s2 == -1.7976931348623157e+308 );
s3 = s+3;
-testcases[tc++] = new TestCase( SECTION,
-"s3 = s+3; s3",
-"179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793",
-s3 );
+new TestCase( SECTION,
+ "s3 = s+3; s3",
+ "179769313486231580793728971405303415079934132710037826936173778980444968292764750946649017977587207096330286416692887910946555547851940402630657488671505820681908902000708383676273854845817711531764475730270069855571366959622842914819860834936475292719074168444365510704342711559699508093042880177904174497793",
+ s3 );
//***** This answer is preferred but -1.7976931348623157e+308 is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"-s3 == -Infinity || -s3 == -1.7976931348623157e+308",
-true,
--s3 == -Infinity || -s3 == -1.7976931348623157e+308 );
+new TestCase( SECTION,
+ "-s3 == -Infinity || -s3 == -1.7976931348623157e+308",
+ true,
+ -s3 == -Infinity || -s3 == -1.7976931348623157e+308 );
//***** This answer is preferred but Infinity is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity",
-true,
-parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity );
+new TestCase( SECTION,
+ "parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity",
+ true,
+ parseInt(s1,10) == 1.7976931348623157e+308 || parseInt(s1,10) == Infinity );
//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308",
-true ,
-parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 );
+new TestCase( SECTION,
+ "parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308",
+ true ,
+ parseInt(s2,10) == Infinity || parseInt(s2,10) == 1.7976931348623157e+308 );
//***** This answer is preferred but Infinity is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity",
-true,
-parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity);
+new TestCase( SECTION,
+ "parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity",
+ true,
+ parseInt(s1) == 1.7976931348623157e+308 || parseInt(s1) == Infinity);
//***** This answer is preferred but 1.7976931348623157e+308 is also acceptable here *****
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308",
-true,
-parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 );
+new TestCase( SECTION,
+ "parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308",
+ true,
+ parseInt(s2) == Infinity || parseInt(s2) == 1.7976931348623157e+308 );
-testcases[tc++] = new TestCase( SECTION,
- "0x12345678",
- 305419896,
- 0x12345678 );
+new TestCase( SECTION,
+ "0x12345678",
+ 305419896,
+ 0x12345678 );
-testcases[tc++] = new TestCase( SECTION,
- "0x80000000",
- 2147483648,
- 0x80000000 );
+new TestCase( SECTION,
+ "0x80000000",
+ 2147483648,
+ 0x80000000 );
-testcases[tc++] = new TestCase( SECTION,
- "0xffffffff",
- 4294967295,
- 0xffffffff );
+new TestCase( SECTION,
+ "0xffffffff",
+ 4294967295,
+ 0xffffffff );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000",
- 4294967296,
- 0x100000000 );
+new TestCase( SECTION,
+ "0x100000000",
+ 4294967296,
+ 0x100000000 );
-testcases[tc++] = new TestCase( SECTION,
- "077777777777777777",
- 2251799813685247,
- 077777777777777777 );
+new TestCase( SECTION,
+ "077777777777777777",
+ 2251799813685247,
+ 077777777777777777 );
-testcases[tc++] = new TestCase( SECTION,
- "077777777777777776",
- 2251799813685246,
- 077777777777777776 );
+new TestCase( SECTION,
+ "077777777777777776",
+ 2251799813685246,
+ 077777777777777776 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1fffffffffffff",
- 9007199254740991,
- 0x1fffffffffffff );
+new TestCase( SECTION,
+ "0x1fffffffffffff",
+ 9007199254740991,
+ 0x1fffffffffffff );
-testcases[tc++] = new TestCase( SECTION,
- "0x20000000000000",
- 9007199254740992,
- 0x20000000000000 );
+new TestCase( SECTION,
+ "0x20000000000000",
+ 9007199254740992,
+ 0x20000000000000 );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abc",
- 9027215253084860,
- 0x20123456789abc );
+new TestCase( SECTION,
+ "0x20123456789abc",
+ 9027215253084860,
+ 0x20123456789abc );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abd",
- 9027215253084860,
- 0x20123456789abd );
+new TestCase( SECTION,
+ "0x20123456789abd",
+ 9027215253084860,
+ 0x20123456789abd );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abe",
- 9027215253084862,
- 0x20123456789abe );
+new TestCase( SECTION,
+ "0x20123456789abe",
+ 9027215253084862,
+ 0x20123456789abe );
-testcases[tc++] = new TestCase( SECTION,
- "0x20123456789abf",
- 9027215253084864,
- 0x20123456789abf );
+new TestCase( SECTION,
+ "0x20123456789abf",
+ 9027215253084864,
+ 0x20123456789abf );
/***** These test the round-to-nearest-or-even-if-equally-close rule *****/
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000080",
- 1152921504606847000,
- 0x1000000000000080 );
+new TestCase( SECTION,
+ "0x1000000000000080",
+ 1152921504606847000,
+ 0x1000000000000080 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000081",
- 1152921504606847200,
- 0x1000000000000081 );
+new TestCase( SECTION,
+ "0x1000000000000081",
+ 1152921504606847200,
+ 0x1000000000000081 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000100",
- 1152921504606847200,
- 0x1000000000000100 );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000000017f",
- 1152921504606847200,
- 0x100000000000017f );
+new TestCase( SECTION,
+ "0x1000000000000100",
+ 1152921504606847200,
+ 0x1000000000000100 );
+new TestCase( SECTION,
+ "0x100000000000017f",
+ 1152921504606847200,
+ 0x100000000000017f );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000180",
- 1152921504606847500,
- 0x1000000000000180 );
+new TestCase( SECTION,
+ "0x1000000000000180",
+ 1152921504606847500,
+ 0x1000000000000180 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000181",
- 1152921504606847500,
- 0x1000000000000181 );
+new TestCase( SECTION,
+ "0x1000000000000181",
+ 1152921504606847500,
+ 0x1000000000000181 );
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000001f0",
- 1152921504606847500,
- 0x10000000000001f0 );
+new TestCase( SECTION,
+ "0x10000000000001f0",
+ 1152921504606847500,
+ 0x10000000000001f0 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000200",
- 1152921504606847500,
- 0x1000000000000200 );
+new TestCase( SECTION,
+ "0x1000000000000200",
+ 1152921504606847500,
+ 0x1000000000000200 );
-testcases[tc++] = new TestCase( SECTION,
- "0x100000000000027f",
- 1152921504606847500,
- 0x100000000000027f );
+new TestCase( SECTION,
+ "0x100000000000027f",
+ 1152921504606847500,
+ 0x100000000000027f );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000280",
- 1152921504606847500,
- 0x1000000000000280 );
+new TestCase( SECTION,
+ "0x1000000000000280",
+ 1152921504606847500,
+ 0x1000000000000280 );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000281",
- 1152921504606847700,
- 0x1000000000000281 );
+new TestCase( SECTION,
+ "0x1000000000000281",
+ 1152921504606847700,
+ 0x1000000000000281 );
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000002ff",
- 1152921504606847700,
- 0x10000000000002ff );
+new TestCase( SECTION,
+ "0x10000000000002ff",
+ 1152921504606847700,
+ 0x10000000000002ff );
-testcases[tc++] = new TestCase( SECTION,
- "0x1000000000000300",
- 1152921504606847700,
- 0x1000000000000300 );
+new TestCase( SECTION,
+ "0x1000000000000300",
+ 1152921504606847700,
+ 0x1000000000000300 );
-testcases[tc++] = new TestCase( SECTION,
- "0x10000000000000000",
- 18446744073709552000,
- 0x10000000000000000 );
+new TestCase( SECTION,
+ "0x10000000000000000",
+ 18446744073709552000,
+ 0x10000000000000000 );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)",
-9027215253084860,
-parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111100\",2)",
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111100",2) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)",
-9027215253084860,
-parseInt("000000100000000100100011010001010110011110001001101010111101",2) );
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111101\",2)",
+ 9027215253084860,
+ parseInt("000000100000000100100011010001010110011110001001101010111101",2) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)",
-9027215253084864,
-parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
+new TestCase( SECTION,
+ "parseInt(\"000000100000000100100011010001010110011110001001101010111111\",2)",
+ 9027215253084864,
+ parseInt("000000100000000100100011010001010110011110001001101010111111",2) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)",
-18054430506169720,
-parseInt("0000001000000001001000110100010101100111100010011010101111010",2));
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111010\",2)",
+ 18054430506169720,
+ parseInt("0000001000000001001000110100010101100111100010011010101111010",2));
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)",
-18054430506169724,
-parseInt("0000001000000001001000110100010101100111100010011010101111011",2) );
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111011\",2)",
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111011",2) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)",
-18054430506169724,
-parseInt("0000001000000001001000110100010101100111100010011010101111100",2));
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111100\",2)",
+ 18054430506169724,
+ parseInt("0000001000000001001000110100010101100111100010011010101111100",2));
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)",
-18054430506169728,
-parseInt("0000001000000001001000110100010101100111100010011010101111110",2));
+new TestCase( SECTION,
+ "parseInt(\"0000001000000001001000110100010101100111100010011010101111110\",2)",
+ 18054430506169728,
+ parseInt("0000001000000001001000110100010101100111100010011010101111110",2));
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"yz\",35)",
- 34,
- parseInt("yz",35) );
+new TestCase( SECTION,
+ "parseInt(\"yz\",35)",
+ 34,
+ parseInt("yz",35) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"yz\",36)",
- 1259,
- parseInt("yz",36) );
+new TestCase( SECTION,
+ "parseInt(\"yz\",36)",
+ 1259,
+ parseInt("yz",36) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"yz\",37)",
- NaN,
- parseInt("yz",37) );
+new TestCase( SECTION,
+ "parseInt(\"yz\",37)",
+ NaN,
+ parseInt("yz",37) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"+77\")",
- 77,
- parseInt("+77") );
+new TestCase( SECTION,
+ "parseInt(\"+77\")",
+ 77,
+ parseInt("+77") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"-77\",9)",
- -70,
- parseInt("-77",9) );
+new TestCase( SECTION,
+ "parseInt(\"-77\",9)",
+ -70,
+ parseInt("-77",9) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"\\u20001234\\u2000\")",
- 1234,
- parseInt("\u20001234\u2000") );
+new TestCase( SECTION,
+ "parseInt(\"\\u20001234\\u2000\")",
+ 1234,
+ parseInt("\u20001234\u2000") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"123456789012345678\")",
- 123456789012345680,
- parseInt("123456789012345678") );
+new TestCase( SECTION,
+ "parseInt(\"123456789012345678\")",
+ 123456789012345680,
+ parseInt("123456789012345678") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"9\",8)",
- NaN,
- parseInt("9",8) );
+new TestCase( SECTION,
+ "parseInt(\"9\",8)",
+ NaN,
+ parseInt("9",8) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"1e2\")",
- 1,
- parseInt("1e2") );
+new TestCase( SECTION,
+ "parseInt(\"1e2\")",
+ 1,
+ parseInt("1e2") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"1.9999999999999999999\")",
- 1,
- parseInt("1.9999999999999999999") );
+new TestCase( SECTION,
+ "parseInt(\"1.9999999999999999999\")",
+ 1,
+ parseInt("1.9999999999999999999") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0x10\")",
- 16,
- parseInt("0x10") );
+new TestCase( SECTION,
+ "parseInt(\"0x10\")",
+ 16,
+ parseInt("0x10") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0x10\",10)",
- 0,
- parseInt("0x10",10) );
+new TestCase( SECTION,
+ "parseInt(\"0x10\",10)",
+ 0,
+ parseInt("0x10",10) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0022\")",
- 18,
- parseInt("0022") );
+new TestCase( SECTION,
+ "parseInt(\"0022\")",
+ 18,
+ parseInt("0022") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0022\",10)",
- 22,
- parseInt("0022",10) );
+new TestCase( SECTION,
+ "parseInt(\"0022\",10)",
+ 22,
+ parseInt("0022",10) );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0x1000000000000080\")",
- 1152921504606847000,
- parseInt("0x1000000000000080") );
+new TestCase( SECTION,
+ "parseInt(\"0x1000000000000080\")",
+ 1152921504606847000,
+ parseInt("0x1000000000000080") );
-testcases[tc++] = new TestCase( SECTION,
- "parseInt(\"0x1000000000000081\")",
- 1152921504606847200,
- parseInt("0x1000000000000081") );
+new TestCase( SECTION,
+ "parseInt(\"0x1000000000000081\")",
+ 1152921504606847200,
+ parseInt("0x1000000000000081") );
s =
"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
-testcases[tc++] = new TestCase( SECTION, "s = "+
-"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
-"s",
-"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s );
+new TestCase( SECTION, "s = "+
+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
-testcases[tc++] = new TestCase( SECTION, "s +="+
-"\"0000000000000000000000000000000000000\"; s",
-"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s += "0000000000000000000000000000000000000" );
+new TestCase( SECTION, "s +="+
+ "\"0000000000000000000000000000000000000\"; s",
+ "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s += "0000000000000000000000000000000000000" );
-testcases[tc++] = new TestCase( SECTION, "-s",
--1.7976931348623157e+308,
--s );
+new TestCase( SECTION, "-s",
+ -1.7976931348623157e+308,
+ -s );
s =
"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
-testcases[tc++] = new TestCase( SECTION, "s ="+
-"\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
-"s",
-"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s );
+new TestCase( SECTION, "s ="+
+ "\"0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFF80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
-testcases[tc++] = new TestCase( SECTION,
-"s += \"0000000000000000000000000000000000001\"",
-"0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
-s += "0000000000000000000000000000000000001" );
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000001\"",
+ "0xFFFFFFFFFFFFF800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+ s += "0000000000000000000000000000000000001" );
-testcases[tc++] = new TestCase( SECTION,
-"-s",
--1.7976931348623157e+308,
--s );
+new TestCase( SECTION,
+ "-s",
+ -1.7976931348623157e+308,
+ -s );
s =
"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
-testcases[tc++] = new TestCase( SECTION,
-"s ="+
-"\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
-"s",
-"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s );
+new TestCase( SECTION,
+ "s ="+
+ "\"0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";"+
+ "s",
+ "0xFFFFFFFFFFFFFC0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s );
-testcases[tc++] = new TestCase( SECTION,
-"s += \"0000000000000000000000000000000000000\"",
-"0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s += "0000000000000000000000000000000000000");
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000000\"",
+ "0xFFFFFFFFFFFFFC00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s += "0000000000000000000000000000000000000");
-testcases[tc++] = new TestCase( SECTION,
-"-s",
--Infinity,
--s );
+new TestCase( SECTION,
+ "-s",
+ -Infinity,
+ -s );
s =
"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
-testcases[tc++] = new TestCase( SECTION,
-"s = "+
-"\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s",
-"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
-s);
+new TestCase( SECTION,
+ "s = "+
+ "\"0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\";s",
+ "0xFFFFFFFFFFFFFB0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
+ s);
-testcases[tc++] = new TestCase( SECTION,
-"s += \"0000000000000000000000000000000000001\"",
-"0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
-s += "0000000000000000000000000000000000001" );
+new TestCase( SECTION,
+ "s += \"0000000000000000000000000000000000001\"",
+ "0xFFFFFFFFFFFFFB00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001",
+ s += "0000000000000000000000000000000000001" );
-testcases[tc++] = new TestCase( SECTION,
-"-s",
--1.7976931348623157e+308,
--s );
+new TestCase( SECTION,
+ "-s",
+ -1.7976931348623157e+308,
+ -s );
-testcases[tc++] = new TestCase( SECTION,
-"s += \"0\"",
-"0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010",
-s += "0" );
+new TestCase( SECTION,
+ "s += \"0\"",
+ "0xFFFFFFFFFFFFFB000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010",
+ s += "0" );
-testcases[tc++] = new TestCase( SECTION,
-"-s",
--Infinity,
--s );
+new TestCase( SECTION,
+ "-s",
+ -Infinity,
+ -s );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s)",
-Infinity,
-parseInt(s) );
+new TestCase( SECTION,
+ "parseInt(s)",
+ Infinity,
+ parseInt(s) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s,32)",
-0,
-parseInt(s,32) );
+new TestCase( SECTION,
+ "parseInt(s,32)",
+ 0,
+ parseInt(s,32) );
-testcases[tc++] = new TestCase( SECTION,
-"parseInt(s,36)",
-Infinity,
-parseInt(s,36) );
+new TestCase( SECTION,
+ "parseInt(s,36)",
+ Infinity,
+ parseInt(s,36) );
-testcases[tc++] = new TestCase( SECTION,
- "-\"\"",
- 0,
- -"" );
+new TestCase( SECTION,
+ "-\"\"",
+ 0,
+ -"" );
-testcases[tc++] = new TestCase( SECTION,
- "-\" \"",
- 0,
- -" " );
+new TestCase( SECTION,
+ "-\" \"",
+ 0,
+ -" " );
-testcases[tc++] = new TestCase( SECTION,
- "-\"999\"",
- -999,
- -"999" );
+new TestCase( SECTION,
+ "-\"999\"",
+ -999,
+ -"999" );
-testcases[tc++] = new TestCase( SECTION,
- "-\" 999\"",
- -999,
- -" 999" );
+new TestCase( SECTION,
+ "-\" 999\"",
+ -999,
+ -" 999" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"\\t999\"",
- -999,
- -"\t999" );
+new TestCase( SECTION,
+ "-\"\\t999\"",
+ -999,
+ -"\t999" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"013 \"",
- -13,
- -"013 " );
+new TestCase( SECTION,
+ "-\"013 \"",
+ -13,
+ -"013 " );
-testcases[tc++] = new TestCase( SECTION,
- "-\"999\\t\"",
- -999,
- -"999\t" );
+new TestCase( SECTION,
+ "-\"999\\t\"",
+ -999,
+ -"999\t" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"-Infinity\"",
- Infinity,
- -"-Infinity" );
+new TestCase( SECTION,
+ "-\"-Infinity\"",
+ Infinity,
+ -"-Infinity" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"-infinity\"",
- NaN,
- -"-infinity" );
+new TestCase( SECTION,
+ "-\"-infinity\"",
+ NaN,
+ -"-infinity" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"+Infinity\"",
- -Infinity,
- -"+Infinity" );
+new TestCase( SECTION,
+ "-\"+Infinity\"",
+ -Infinity,
+ -"+Infinity" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"+Infiniti\"",
- NaN,
- -"+Infiniti" );
+new TestCase( SECTION,
+ "-\"+Infiniti\"",
+ NaN,
+ -"+Infiniti" );
-testcases[tc++] = new TestCase( SECTION,
- "- -\"0x80000000\"",
- 2147483648,
- - -"0x80000000" );
+new TestCase( SECTION,
+ "- -\"0x80000000\"",
+ 2147483648,
+ - -"0x80000000" );
-testcases[tc++] = new TestCase( SECTION,
- "- -\"0x100000000\"",
- 4294967296,
- - -"0x100000000" );
+new TestCase( SECTION,
+ "- -\"0x100000000\"",
+ 4294967296,
+ - -"0x100000000" );
-testcases[tc++] = new TestCase( SECTION,
- "- \"-0x123456789abcde8\"",
- 81985529216486880,
- - "-0x123456789abcde8" );
+new TestCase( SECTION,
+ "- \"-0x123456789abcde8\"",
+ 81985529216486880,
+ - "-0x123456789abcde8" );
// the following two tests are not strictly ECMA 1.0
-testcases[tc++] = new TestCase( SECTION,
- "-\"\\u20001234\\u2001\"",
- -1234,
- -"\u20001234\u2001" );
+new TestCase( SECTION,
+ "-\"\\u20001234\\u2001\"",
+ -1234,
+ -"\u20001234\u2001" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"\\u20001234\\0\"",
- NaN,
- -"\u20001234\0" );
+new TestCase( SECTION,
+ "-\"\\u20001234\\0\"",
+ NaN,
+ -"\u20001234\0" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"0x10\"",
- -16,
- -"0x10" );
+new TestCase( SECTION,
+ "-\"0x10\"",
+ -16,
+ -"0x10" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"+\"",
- NaN,
- -"+" );
+new TestCase( SECTION,
+ "-\"+\"",
+ NaN,
+ -"+" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"-\"",
- NaN,
- -"-" );
+new TestCase( SECTION,
+ "-\"-\"",
+ NaN,
+ -"-" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"-0-\"",
- NaN,
- -"-0-" );
+new TestCase( SECTION,
+ "-\"-0-\"",
+ NaN,
+ -"-0-" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"1e-\"",
- NaN,
- -"1e-" );
+new TestCase( SECTION,
+ "-\"1e-\"",
+ NaN,
+ -"1e-" );
-testcases[tc++] = new TestCase( SECTION,
- "-\"1e-1\"",
- -0.1,
- -"1e-1" );
+new TestCase( SECTION,
+ "-\"1e-1\"",
+ -0.1,
+ -"1e-1" );
test();
-function test(){
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.3.js b/mozilla/js/tests/ecma/TypeConversion/9.3.js
index 5f2a160c56d..c247ed87978 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.3.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.3.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,71 +35,51 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.3.js
- ECMA Section: 9.3 Type Conversion: ToNumber
- Description: rules for converting an argument to a number.
- see 9.3.1 for cases for converting strings to numbers.
- special cases:
- undefined NaN
- Null NaN
- Boolean 1 if true; +0 if false
- Number the argument ( no conversion )
- String see test 9.3.1
- Object see test 9.3-1
+ File Name: 9.3.js
+ ECMA Section: 9.3 Type Conversion: ToNumber
+ Description: rules for converting an argument to a number.
+ see 9.3.1 for cases for converting strings to numbers.
+ special cases:
+ undefined NaN
+ Null NaN
+ Boolean 1 if true; +0 if false
+ Number the argument ( no conversion )
+ String see test 9.3.1
+ Object see test 9.3-1
- For ToNumber applied to the String type, see test 9.3.1.
- For ToNumber applied to the object type, see test 9.3-1.
+ For ToNumber applied to the String type, see test 9.3.1.
+ For ToNumber applied to the object type, see test 9.3-1.
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.3";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToNumber";
+var SECTION = "9.3";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToNumber";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// special cases here
+new TestCase( SECTION, "Number()", 0, Number() );
+new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) );
+new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
+new TestCase( SECTION, "Number(null)", 0, Number(null) );
+new TestCase( SECTION, "Number(true)", 1, Number(true) );
+new TestCase( SECTION, "Number(false)", 0, Number(false) );
+new TestCase( SECTION, "Number(0)", 0, Number(0) );
+new TestCase( SECTION, "Number(-0)", -0, Number(-0) );
+new TestCase( SECTION, "Number(1)", 1, Number(1) );
+new TestCase( SECTION, "Number(-1)", -1, Number(-1) );
+new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) );
+new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) );
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) );
+new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) );
- // special cases here
-
- array[item++] = new TestCase( SECTION, "Number()", 0, Number() );
- array[item++] = new TestCase( SECTION, "Number(eval('var x'))", Number.NaN, Number(eval("var x")) );
- array[item++] = new TestCase( SECTION, "Number(void 0)", Number.NaN, Number(void 0) );
- array[item++] = new TestCase( SECTION, "Number(null)", 0, Number(null) );
- array[item++] = new TestCase( SECTION, "Number(true)", 1, Number(true) );
- array[item++] = new TestCase( SECTION, "Number(false)", 0, Number(false) );
- array[item++] = new TestCase( SECTION, "Number(0)", 0, Number(0) );
- array[item++] = new TestCase( SECTION, "Number(-0)", -0, Number(-0) );
- array[item++] = new TestCase( SECTION, "Number(1)", 1, Number(1) );
- array[item++] = new TestCase( SECTION, "Number(-1)", -1, Number(-1) );
- array[item++] = new TestCase( SECTION, "Number(Number.MAX_VALUE)", 1.7976931348623157e308, Number(Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "Number(Number.MIN_VALUE)", 5e-324, Number(Number.MIN_VALUE) );
-
- array[item++] = new TestCase( SECTION, "Number(Number.NaN)", Number.NaN, Number(Number.NaN) );
- array[item++] = new TestCase( SECTION, "Number(Number.POSITIVE_INFINITY)", Number.POSITIVE_INFINITY, Number(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "Number(Number.NEGATIVE_INFINITY)", Number.NEGATIVE_INFINITY, Number(Number.NEGATIVE_INFINITY) );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.4-1.js b/mozilla/js/tests/ecma/TypeConversion/9.4-1.js
index 23192fe9f0c..19b279439f6 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.4-1.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.4-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,102 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.4-1.js
- ECMA Section: 9.4 ToInteger
- Description: 1. Call ToNumber on the input argument
- 2. If Result(1) is NaN, return +0
- 3. If Result(1) is +0, -0, Infinity, or -Infinity,
- return Result(1).
- 4. Compute sign(Result(1)) * floor(abs(Result(1))).
- 5. Return Result(4).
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
- To test ToInteger, this test uses new Date(value),
- 15.9.3.7. The Date constructor sets the [[Value]]
- property of the new object to TimeClip(value), which
- uses the rules:
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
- TimeClip(time)
- 1. If time is not finite, return NaN
- 2. If abs(Result(1)) > 8.64e15, return NaN
- 3. Return an implementation dependent choice of either
- ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
- (Adding a positive 0 converts -0 to +0).
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
- This tests ToInteger for values -8.64e15 > value > 8.64e15,
- not including -0 and +0.
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
- For additional special cases (0, +0, Infinity, -Infinity,
- and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToInteger";
+var SECTION = "9.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToInteger";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// some special cases
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+// value is not an integer
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
- // some special cases
+// value is not a number
- array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
- array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
- // value is not an integer
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+// edge cases
+new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
-
- // value is not a number
-
- array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
- array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
-
- array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
-
- // edge cases
- array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.4-2.js b/mozilla/js/tests/ecma/TypeConversion/9.4-2.js
index 23192fe9f0c..19b279439f6 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.4-2.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.4-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,102 +35,76 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.4-1.js
- ECMA Section: 9.4 ToInteger
- Description: 1. Call ToNumber on the input argument
- 2. If Result(1) is NaN, return +0
- 3. If Result(1) is +0, -0, Infinity, or -Infinity,
- return Result(1).
- 4. Compute sign(Result(1)) * floor(abs(Result(1))).
- 5. Return Result(4).
+ File Name: 9.4-1.js
+ ECMA Section: 9.4 ToInteger
+ Description: 1. Call ToNumber on the input argument
+ 2. If Result(1) is NaN, return +0
+ 3. If Result(1) is +0, -0, Infinity, or -Infinity,
+ return Result(1).
+ 4. Compute sign(Result(1)) * floor(abs(Result(1))).
+ 5. Return Result(4).
- To test ToInteger, this test uses new Date(value),
- 15.9.3.7. The Date constructor sets the [[Value]]
- property of the new object to TimeClip(value), which
- uses the rules:
+ To test ToInteger, this test uses new Date(value),
+ 15.9.3.7. The Date constructor sets the [[Value]]
+ property of the new object to TimeClip(value), which
+ uses the rules:
- TimeClip(time)
- 1. If time is not finite, return NaN
- 2. If abs(Result(1)) > 8.64e15, return NaN
- 3. Return an implementation dependent choice of either
- ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
- (Adding a positive 0 converts -0 to +0).
+ TimeClip(time)
+ 1. If time is not finite, return NaN
+ 2. If abs(Result(1)) > 8.64e15, return NaN
+ 3. Return an implementation dependent choice of either
+ ToInteger(Result(2)) or ToInteger(Result(2)) + (+0)
+ (Adding a positive 0 converts -0 to +0).
- This tests ToInteger for values -8.64e15 > value > 8.64e15,
- not including -0 and +0.
+ This tests ToInteger for values -8.64e15 > value > 8.64e15,
+ not including -0 and +0.
- For additional special cases (0, +0, Infinity, -Infinity,
- and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
+ For additional special cases (0, +0, Infinity, -Infinity,
+ and NaN, see 9.4-2.js). For value is String, see 9.4-3.js.
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.4-1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "ToInteger";
+var SECTION = "9.4-1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "ToInteger";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = getTestCases();
- test();
+// some special cases
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+// value is not an integer
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
+new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
- // some special cases
+// value is not a number
- array[item++] = new TestCase( SECTION, "td = new Date(Number.NaN); td.valueOf()", Number.NaN, eval("td = new Date(Number.NaN); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.POSITIVE_INFINITY); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-Infinity); td.valueOf()", Number.NaN, eval("td = new Date(Number.NEGATIVE_INFINITY); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-0); td.valueOf()", -0, eval("td = new Date(-0); td.valueOf()" ) );
- array[item++] = new TestCase( SECTION, "td = new Date(0); td.valueOf()", 0, eval("td = new Date(0); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
+new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
- // value is not an integer
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(3.14159); td.valueOf()", 3, eval("td = new Date(3.14159); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(Math.PI); td.valueOf()", 3, eval("td = new Date(Math.PI); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-Math.PI);td.valueOf()", -3, eval("td = new Date(-Math.PI);td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(3.14159e2); td.valueOf()", 314, eval("td = new Date(3.14159e2); td.valueOf()") );
+// edge cases
+new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
+new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(.692147e1); td.valueOf()", 6, eval("td = new Date(.692147e1);td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-.692147e1);td.valueOf()", -6, eval("td = new Date(-.692147e1);td.valueOf()") );
-
- // value is not a number
-
- array[item++] = new TestCase( SECTION, "td = new Date(true); td.valueOf()", 1, eval("td = new Date(true); td.valueOf()" ) );
- array[item++] = new TestCase( SECTION, "td = new Date(false); td.valueOf()", 0, eval("td = new Date(false); td.valueOf()") );
-
- array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(new Number(Math.PI)); td.valueOf()", 3, eval("td = new Date(new Number(Math.PI)); td.valueOf()") );
-
- // edge cases
- array[item++] = new TestCase( SECTION, "td = new Date(8.64e15); td.valueOf()", 8.64e15, eval("td = new Date(8.64e15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-8.64e15); td.valueOf()", -8.64e15, eval("td = new Date(-8.64e15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(8.64e-15); td.valueOf()", 0, eval("td = new Date(8.64e-15); td.valueOf()") );
- array[item++] = new TestCase( SECTION, "td = new Date(-8.64e-15); td.valueOf()", 0, eval("td = new Date(-8.64e-15); td.valueOf()") );
-
- return ( array );
-}
+test();
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.5-2.js b/mozilla/js/tests/ecma/TypeConversion/9.5-2.js
index 92bc85b6b1d..8b6f5fbab09 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.5-2.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.5-2.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,153 +35,137 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.5-2.js
- ECMA Section: 9.5 Type Conversion: ToInt32
- Description: rules for converting an argument to a signed 32 bit integer
+ File Name: 9.5-2.js
+ ECMA Section: 9.5 Type Conversion: ToInt32
+ Description: rules for converting an argument to a signed 32 bit integer
- this test uses << 0 to convert the argument to a 32bit
- integer.
+ this test uses << 0 to convert the argument to a 32bit
+ integer.
- The operator ToInt32 converts its argument to one of 2^32
- integer values in the range -2^31 through 2^31 inclusive.
- This operator functions as follows:
+ The operator ToInt32 converts its argument to one of 2^32
+ integer values in the range -2^31 through 2^31 inclusive.
+ This operator functions as follows:
- 1 call ToNumber on argument
- 2 if result is NaN, 0, -0, return 0
- 3 compute (sign (result(1)) * floor(abs(result 1)))
- 4 compute result(3) modulo 2^32:
- 5 if result(4) is greater than or equal to 2^31, return
- result(5)-2^32. otherwise, return result(5)
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 if result(4) is greater than or equal to 2^31, return
+ result(5)-2^32. otherwise, return result(5)
- special cases:
- -0 returns 0
- Infinity returns 0
- -Infinity returns 0
- ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
- Numbers greater than 2^31 (see step 5 above)
- (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ Numbers greater than 2^31 (see step 5 above)
+ (note http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
- Author: christine@netscape.com
- Date: 17 july 1997
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var SECTION = "9.5-2";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "9.5-2";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " ToInt32");
- test();
+writeHeaderToLog( SECTION + " ToInt32");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "0 << 0", 0, 0 << 0 );
+new TestCase( SECTION, "-0 << 0", 0, -0 << 0 );
+new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 );
+new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 );
+new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 );
+
+new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 );
+new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 );
+new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 );
+new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 );
+new TestCase( SECTION, "1 << 0", 1, 1 << 0 );
+new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 );
+new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 );
+
+
+new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 );
+new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 );
+new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 );
+
+new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 );
+new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 );
+new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 );
+
+new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 );
+new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 );
+new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 );
+
+new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 );
+new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 );
+new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 );
+
+new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 );
+new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 );
+new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 );
+
+new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 );
+new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 );
+new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 );
+
+new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 );
+new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 );
+new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 );
+
+new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 );
+new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 );
+new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 );
+
+/*
+ * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction)
+ * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
+ */
+new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 );
+new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 );
+new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 );
+new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 );
+new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 );
+new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 );
+new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 );
+new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 );
+new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 );
+
+/*
+ * Numbers between - 2^31 and - 2^32
+ */
+new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 );
+new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 );
+new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 );
+new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 );
+new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 );
+new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 );
+new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 );
+new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 );
+new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 );
+
+
+test();
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
function ToInt32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
- n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
- if ( sign == -1 ) {
- n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n;
- } else{
- n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
- }
+ n = (sign * Math.floor( Math.abs(n) )) % Math.pow(2,32);
+ if ( sign == -1 ) {
+ n = ( n < -Math.pow(2,31) ) ? n + Math.pow(2,32) : n;
+ } else{
+ n = ( n >= Math.pow(2,31) ) ? n - Math.pow(2,32) : n;
+ }
- return ( n );
+ return ( n );
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "0 << 0", 0, 0 << 0 );
- array[item++] = new TestCase( SECTION, "-0 << 0", 0, -0 << 0 );
- array[item++] = new TestCase( SECTION, "Infinity << 0", 0, "Infinity" << 0 );
- array[item++] = new TestCase( SECTION, "-Infinity << 0", 0, "-Infinity" << 0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY << 0", 0, Number.POSITIVE_INFINITY << 0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY << 0", 0, Number.NEGATIVE_INFINITY << 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN << 0", 0, Number.NaN << 0 );
-
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE << 0", 0, Number.MIN_VALUE << 0 );
- array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE << 0", 0, -Number.MIN_VALUE << 0 );
- array[item++] = new TestCase( SECTION, "0.1 << 0", 0, 0.1 << 0 );
- array[item++] = new TestCase( SECTION, "-0.1 << 0", 0, -0.1 << 0 );
- array[item++] = new TestCase( SECTION, "1 << 0", 1, 1 << 0 );
- array[item++] = new TestCase( SECTION, "1.1 << 0", 1, 1.1 << 0 );
- array[item++] = new TestCase( SECTION, "-1 << 0", ToInt32(-1), -1 << 0 );
-
-
- array[item++] = new TestCase( SECTION, "2147483647 << 0", ToInt32(2147483647), 2147483647 << 0 );
- array[item++] = new TestCase( SECTION, "2147483648 << 0", ToInt32(2147483648), 2147483648 << 0 );
- array[item++] = new TestCase( SECTION, "2147483649 << 0", ToInt32(2147483649), 2147483649 << 0 );
-
- array[item++] = new TestCase( SECTION, "(Math.pow(2,31)-1) << 0", ToInt32(2147483647), (Math.pow(2,31)-1) << 0 );
- array[item++] = new TestCase( SECTION, "Math.pow(2,31) << 0", ToInt32(2147483648), Math.pow(2,31) << 0 );
- array[item++] = new TestCase( SECTION, "(Math.pow(2,31)+1) << 0", ToInt32(2147483649), (Math.pow(2,31)+1) << 0 );
-
- array[item++] = new TestCase( SECTION, "(Math.pow(2,32)-1) << 0", ToInt32(4294967295), (Math.pow(2,32)-1) << 0 );
- array[item++] = new TestCase( SECTION, "(Math.pow(2,32)) << 0", ToInt32(4294967296), (Math.pow(2,32)) << 0 );
- array[item++] = new TestCase( SECTION, "(Math.pow(2,32)+1) << 0", ToInt32(4294967297), (Math.pow(2,32)+1) << 0 );
-
- array[item++] = new TestCase( SECTION, "4294967295 << 0", ToInt32(4294967295), 4294967295 << 0 );
- array[item++] = new TestCase( SECTION, "4294967296 << 0", ToInt32(4294967296), 4294967296 << 0 );
- array[item++] = new TestCase( SECTION, "4294967297 << 0", ToInt32(4294967297), 4294967297 << 0 );
-
- array[item++] = new TestCase( SECTION, "'2147483647' << 0", ToInt32(2147483647), '2147483647' << 0 );
- array[item++] = new TestCase( SECTION, "'2147483648' << 0", ToInt32(2147483648), '2147483648' << 0 );
- array[item++] = new TestCase( SECTION, "'2147483649' << 0", ToInt32(2147483649), '2147483649' << 0 );
-
- array[item++] = new TestCase( SECTION, "'4294967295' << 0", ToInt32(4294967295), '4294967295' << 0 );
- array[item++] = new TestCase( SECTION, "'4294967296' << 0", ToInt32(4294967296), '4294967296' << 0 );
- array[item++] = new TestCase( SECTION, "'4294967297' << 0", ToInt32(4294967297), '4294967297' << 0 );
-
- array[item++] = new TestCase( SECTION, "-2147483647 << 0", ToInt32(-2147483647), -2147483647 << 0 );
- array[item++] = new TestCase( SECTION, "-2147483648 << 0", ToInt32(-2147483648), -2147483648 << 0 );
- array[item++] = new TestCase( SECTION, "-2147483649 << 0", ToInt32(-2147483649), -2147483649 << 0 );
-
- array[item++] = new TestCase( SECTION, "-4294967295 << 0", ToInt32(-4294967295), -4294967295 << 0 );
- array[item++] = new TestCase( SECTION, "-4294967296 << 0", ToInt32(-4294967296), -4294967296 << 0 );
- array[item++] = new TestCase( SECTION, "-4294967297 << 0", ToInt32(-4294967297), -4294967297 << 0 );
-
- /*
- * Numbers between 2^31 and 2^32 will have a negative ToInt32 per ECMA (see step 5 of introduction)
- * (These are by stevechapel@earthlink.net; cf. http://bugzilla.mozilla.org/show_bug.cgi?id=120083)
- */
- array[item++] = new TestCase( SECTION, "2147483648.25 << 0", ToInt32(2147483648.25), 2147483648.25 << 0 );
- array[item++] = new TestCase( SECTION, "2147483648.5 << 0", ToInt32(2147483648.5), 2147483648.5 << 0 );
- array[item++] = new TestCase( SECTION, "2147483648.75 << 0", ToInt32(2147483648.75), 2147483648.75 << 0 );
- array[item++] = new TestCase( SECTION, "4294967295.25 << 0", ToInt32(4294967295.25), 4294967295.25 << 0 );
- array[item++] = new TestCase( SECTION, "4294967295.5 << 0", ToInt32(4294967295.5), 4294967295.5 << 0 );
- array[item++] = new TestCase( SECTION, "4294967295.75 << 0", ToInt32(4294967295.75), 4294967295.75 << 0 );
- array[item++] = new TestCase( SECTION, "3000000000.25 << 0", ToInt32(3000000000.25), 3000000000.25 << 0 );
- array[item++] = new TestCase( SECTION, "3000000000.5 << 0", ToInt32(3000000000.5), 3000000000.5 << 0 );
- array[item++] = new TestCase( SECTION, "3000000000.75 << 0", ToInt32(3000000000.75), 3000000000.75 << 0 );
-
- /*
- * Numbers between - 2^31 and - 2^32
- */
- array[item++] = new TestCase( SECTION, "-2147483648.25 << 0", ToInt32(-2147483648.25), -2147483648.25 << 0 );
- array[item++] = new TestCase( SECTION, "-2147483648.5 << 0", ToInt32(-2147483648.5), -2147483648.5 << 0 );
- array[item++] = new TestCase( SECTION, "-2147483648.75 << 0", ToInt32(-2147483648.75), -2147483648.75 << 0 );
- array[item++] = new TestCase( SECTION, "-4294967295.25 << 0", ToInt32(-4294967295.25), -4294967295.25 << 0 );
- array[item++] = new TestCase( SECTION, "-4294967295.5 << 0", ToInt32(-4294967295.5), -4294967295.5 << 0 );
- array[item++] = new TestCase( SECTION, "-4294967295.75 << 0", ToInt32(-4294967295.75), -4294967295.75 << 0 );
- array[item++] = new TestCase( SECTION, "-3000000000.25 << 0", ToInt32(-3000000000.25), -3000000000.25 << 0 );
- array[item++] = new TestCase( SECTION, "-3000000000.5 << 0", ToInt32(-3000000000.5), -3000000000.5 << 0 );
- array[item++] = new TestCase( SECTION, "-3000000000.75 << 0", ToInt32(-3000000000.75), -3000000000.75 << 0 );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.6.js b/mozilla/js/tests/ecma/TypeConversion/9.6.js
index aff3e9053f0..bf3965bb151 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.6.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.6.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,121 +35,104 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.6.js
- ECMA Section: 9.6 Type Conversion: ToUint32
- Description: rules for converting an argument to an unsigned
- 32 bit integer
+ File Name: 9.6.js
+ ECMA Section: 9.6 Type Conversion: ToUint32
+ Description: rules for converting an argument to an unsigned
+ 32 bit integer
- this test uses >>> 0 to convert the argument to
- an unsigned 32bit integer.
+ this test uses >>> 0 to convert the argument to
+ an unsigned 32bit integer.
- 1 call ToNumber on argument
- 2 if result is NaN, 0, -0, Infinity, -Infinity
- return 0
- 3 compute (sign (result(1)) * floor(abs(result 1)))
- 4 compute result(3) modulo 2^32:
- 5 return result(4)
+ 1 call ToNumber on argument
+ 2 if result is NaN, 0, -0, Infinity, -Infinity
+ return 0
+ 3 compute (sign (result(1)) * floor(abs(result 1)))
+ 4 compute result(3) modulo 2^32:
+ 5 return result(4)
- special cases:
- -0 returns 0
- Infinity returns 0
- -Infinity returns 0
- 0 returns 0
- ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
- ** NEED TO DO THIS PART IN A SEPARATE TEST FILE **
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
+ ToInt32(ToUint32(x)) == ToInt32(x) for all values of x
+ ** NEED TO DO THIS PART IN A SEPARATE TEST FILE **
- Author: christine@netscape.com
- Date: 17 july 1997
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var SECTION = "9.6";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "9.6";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Type Conversion: ToUint32");
- test();
+writeHeaderToLog( SECTION + " Type Conversion: ToUint32");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 );
+// new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0);
+new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 );
+new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 );
+new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0);
+new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 );
+new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
+new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
+new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 );
+new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 );
+new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 );
+new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 );
+
+new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 );
+new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 );
+
+new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 );
+new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 );
+new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 );
+
+new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 );
+new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 );
+new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 );
+
+new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 );
+new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 );
+new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 );
+
+new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 );
+new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 );
+new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 );
+
+new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 );
+new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 );
+new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 );
+
+new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 );
+new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 );
+new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 );
+
+
+test();
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0 || Math.abs( n ) == Number.POSITIVE_INFINITY) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
-function getTestCases() {
- var array = new Array();
- var item = 0;
- array[item++] = new TestCase( SECTION, "0 >>> 0", 0, 0 >>> 0 );
-// array[item++] = new TestCase( SECTION, "+0 >>> 0", 0, +0 >>> 0);
- array[item++] = new TestCase( SECTION, "-0 >>> 0", 0, -0 >>> 0 );
- array[item++] = new TestCase( SECTION, "'Infinity' >>> 0", 0, "Infinity" >>> 0 );
- array[item++] = new TestCase( SECTION, "'-Infinity' >>> 0", 0, "-Infinity" >>> 0);
- array[item++] = new TestCase( SECTION, "'+Infinity' >>> 0", 0, "+Infinity" >>> 0 );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY >>> 0", 0, Number.POSITIVE_INFINITY >>> 0 );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY >>> 0", 0, Number.NEGATIVE_INFINITY >>> 0 );
- array[item++] = new TestCase( SECTION, "Number.NaN >>> 0", 0, Number.NaN >>> 0 );
-
- array[item++] = new TestCase( SECTION, "Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
- array[item++] = new TestCase( SECTION, "-Number.MIN_VALUE >>> 0", 0, Number.MIN_VALUE >>> 0 );
- array[item++] = new TestCase( SECTION, "0.1 >>> 0", 0, 0.1 >>> 0 );
- array[item++] = new TestCase( SECTION, "-0.1 >>> 0", 0, -0.1 >>> 0 );
- array[item++] = new TestCase( SECTION, "1 >>> 0", 1, 1 >>> 0 );
- array[item++] = new TestCase( SECTION, "1.1 >>> 0", 1, 1.1 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "-1.1 >>> 0", ToUint32(-1.1), -1.1 >>> 0 );
- array[item++] = new TestCase( SECTION, "-1 >>> 0", ToUint32(-1), -1 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "2147483647 >>> 0", ToUint32(2147483647), 2147483647 >>> 0 );
- array[item++] = new TestCase( SECTION, "2147483648 >>> 0", ToUint32(2147483648), 2147483648 >>> 0 );
- array[item++] = new TestCase( SECTION, "2147483649 >>> 0", ToUint32(2147483649), 2147483649 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "4294967295 >>> 0", ToUint32(4294967295), 4294967295 >>> 0 );
- array[item++] = new TestCase( SECTION, "4294967296 >>> 0", ToUint32(4294967296), 4294967296 >>> 0 );
- array[item++] = new TestCase( SECTION, "4294967297 >>> 0", ToUint32(4294967297), 4294967297 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "-2147483647 >>> 0", ToUint32(-2147483647), -2147483647 >>> 0 );
- array[item++] = new TestCase( SECTION, "-2147483648 >>> 0", ToUint32(-2147483648), -2147483648 >>> 0 );
- array[item++] = new TestCase( SECTION, "-2147483649 >>> 0", ToUint32(-2147483649), -2147483649 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "-4294967295 >>> 0", ToUint32(-4294967295), -4294967295 >>> 0 );
- array[item++] = new TestCase( SECTION, "-4294967296 >>> 0", ToUint32(-4294967296), -4294967296 >>> 0 );
- array[item++] = new TestCase( SECTION, "-4294967297 >>> 0", ToUint32(-4294967297), -4294967297 >>> 0 );
-
- array[item++] = new TestCase( SECTION, "'2147483647' >>> 0", ToUint32(2147483647), '2147483647' >>> 0 );
- array[item++] = new TestCase( SECTION, "'2147483648' >>> 0", ToUint32(2147483648), '2147483648' >>> 0 );
- array[item++] = new TestCase( SECTION, "'2147483649' >>> 0", ToUint32(2147483649), '2147483649' >>> 0 );
-
- array[item++] = new TestCase( SECTION, "'4294967295' >>> 0", ToUint32(4294967295), '4294967295' >>> 0 );
- array[item++] = new TestCase( SECTION, "'4294967296' >>> 0", ToUint32(4294967296), '4294967296' >>> 0 );
- array[item++] = new TestCase( SECTION, "'4294967297' >>> 0", ToUint32(4294967297), '4294967297' >>> 0 );
-
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.7.js b/mozilla/js/tests/ecma/TypeConversion/9.7.js
index 26b7acc0ca3..4725ec68f4a 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.7.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.7.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,140 +35,124 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.7.js
- ECMA Section: 9.7 Type Conversion: ToInt16
- Description: rules for converting an argument to an unsigned
- 16 bit integer in the range 0 to 2^16-1.
+ File Name: 9.7.js
+ ECMA Section: 9.7 Type Conversion: ToInt16
+ Description: rules for converting an argument to an unsigned
+ 16 bit integer in the range 0 to 2^16-1.
- this test uses String.prototype.fromCharCode() and
- String.prototype.charCodeAt() to test ToInt16.
+ this test uses String.prototype.fromCharCode() and
+ String.prototype.charCodeAt() to test ToInt16.
- special cases:
- -0 returns 0
- Infinity returns 0
- -Infinity returns 0
- 0 returns 0
+ special cases:
+ -0 returns 0
+ Infinity returns 0
+ -Infinity returns 0
+ 0 returns 0
- Author: christine@netscape.com
- Date: 17 july 1997
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var SECTION = "9.7";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "9.7";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " Type Conversion: ToInt16");
- test();
+writeHeaderToLog( SECTION + " Type Conversion: ToInt16");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function ToInt16( num ) {
- num = Number( num );
- if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
- return 0;
- }
-
- var sign = ( num < 0 ) ? -1 : 1;
-
- num = sign * Math.floor( Math.abs( num ) );
-
- num = num % Math.pow(2,16);
-
- num = ( num > -65536 && num < 0) ? 65536 + num : num;
-
- return num;
-}
-
-function getTestCases() {
- var array = new Array();
- var item = 0;
/*
- array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", 0, String.fromCharCode(0).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", 0, String.fromCharCode(-0).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", 1, String.fromCharCode(1).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", 64, String.fromCharCode(64).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", 126, String.fromCharCode(126).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", 127, String.fromCharCode(127).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", 128, String.fromCharCode(128).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", 130, String.fromCharCode(130).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", 255, String.fromCharCode(255).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", 256, String.fromCharCode(256).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+ new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
*/
- array[item++] = new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(0).charCodeAt(0)", ToInt16(0), String.fromCharCode(0).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-0).charCodeAt(0)", ToInt16(0), String.fromCharCode(-0).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(1).charCodeAt(0)", ToInt16(1), String.fromCharCode(1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(64).charCodeAt(0)", ToInt16(64), String.fromCharCode(64).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(126).charCodeAt(0)", ToInt16(126), String.fromCharCode(126).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(127).charCodeAt(0)", ToInt16(127), String.fromCharCode(127).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(128).charCodeAt(0)", ToInt16(128), String.fromCharCode(128).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(130).charCodeAt(0)", ToInt16(130), String.fromCharCode(130).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(255).charCodeAt(0)", ToInt16(255), String.fromCharCode(255).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(256).charCodeAt(0)", ToInt16(256), String.fromCharCode(256).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(Math.pow(2,16)-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(Math.pow(2,16)).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(65535).charCodeAt(0)", ToInt16(65535), String.fromCharCode(65535).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(65536).charCodeAt(0)", ToInt16(65536), String.fromCharCode(65536).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(65537).charCodeAt(0)", ToInt16(65537), String.fromCharCode(65537).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(131071).charCodeAt(0)", ToInt16(131071), String.fromCharCode(131071).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(131072).charCodeAt(0)", ToInt16(131072), String.fromCharCode(131072).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(131073).charCodeAt(0)", ToInt16(131073), String.fromCharCode(131073).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('65535').charCodeAt(0)", 65535, String.fromCharCode("65535").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('65536').charCodeAt(0)", 0, String.fromCharCode("65536").charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-1).charCodeAt(0)", ToInt16(-1), String.fromCharCode(-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-64).charCodeAt(0)", ToInt16(-64), String.fromCharCode(-64).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-126).charCodeAt(0)", ToInt16(-126), String.fromCharCode(-126).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-127).charCodeAt(0)", ToInt16(-127), String.fromCharCode(-127).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-128).charCodeAt(0)", ToInt16(-128), String.fromCharCode(-128).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-130).charCodeAt(0)", ToInt16(-130), String.fromCharCode(-130).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-255).charCodeAt(0)", ToInt16(-255), String.fromCharCode(-255).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-256).charCodeAt(0)", ToInt16(-256), String.fromCharCode(-256).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0)", 65535, String.fromCharCode(-Math.pow(2,16)-1).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-Math.pow(2,16)).charCodeAt(0)", 0, String.fromCharCode(-Math.pow(2,16)).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-65535).charCodeAt(0)", ToInt16(-65535), String.fromCharCode(-65535).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-65536).charCodeAt(0)", ToInt16(-65536), String.fromCharCode(-65536).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-65537).charCodeAt(0)", ToInt16(-65537), String.fromCharCode(-65537).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-131071).charCodeAt(0)", ToInt16(-131071), String.fromCharCode(-131071).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-131072).charCodeAt(0)", ToInt16(-131072), String.fromCharCode(-131072).charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode(-131073).charCodeAt(0)", ToInt16(-131073), String.fromCharCode(-131073).charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) );
- array[item++] = new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('-65535').charCodeAt(0)", ToInt16(-65535), String.fromCharCode("-65535").charCodeAt(0) );
+new TestCase( "9.7", "String.fromCharCode('-65536').charCodeAt(0)", ToInt16(-65536), String.fromCharCode("-65536").charCodeAt(0) );
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(2147483648).charCodeAt(0)", ToInt16(2147483648), String.fromCharCode(2147483648).charCodeAt(0) );
// the following test cases cause a runtime error. see: http://scopus.mcom.com/bugsplat/show_bug.cgi?id=78878
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) );
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) );
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) );
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) );
-// array[item++] = new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) );
- return ( array );
+// new TestCase( "9.7", "String.fromCharCode(Infinity).charCodeAt(0)", 0, String.fromCharCode("Infinity").charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(-Infinity).charCodeAt(0)", 0, String.fromCharCode("-Infinity").charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(NaN).charCodeAt(0)", 0, String.fromCharCode(Number.NaN).charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.POSITIVE_INFINITY).charCodeAt(0) );
+// new TestCase( "9.7", "String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0)", 0, String.fromCharCode(Number.NEGATIVE_INFINITY).charCodeAt(0) );
+
+test();
+
+function ToInt16( num ) {
+ num = Number( num );
+ if ( isNaN( num ) || num == 0 || num == Number.POSITIVE_INFINITY || num == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
+
+ var sign = ( num < 0 ) ? -1 : 1;
+
+ num = sign * Math.floor( Math.abs( num ) );
+
+ num = num % Math.pow(2,16);
+
+ num = ( num > -65536 && num < 0) ? 65536 + num : num;
+
+ return num;
}
+
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.8.1.js b/mozilla/js/tests/ecma/TypeConversion/9.8.1.js
index 94b81a943cb..bcdd41d2195 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.8.1.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.8.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,148 +35,131 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 9.8.1.js
- ECMA Section: 9.8.1 ToString Applied to the Number Type
- Description: The operator ToString convers a number m to string
- as follows:
+ File Name: 9.8.1.js
+ ECMA Section: 9.8.1 ToString Applied to the Number Type
+ Description: The operator ToString convers a number m to string
+ as follows:
- 1. if m is NaN, return the string "NaN"
- 2. if m is +0 or -0, return the string "0"
- 3. if m is less than zero, return the string
- concatenation of the string "-" and ToString(-m).
- 4. If m is Infinity, return the string "Infinity".
- 5. Otherwise, let n, k, and s be integers such that
- k >= 1, 10k1 <= s < 10k, the number value for s10nk
- is m, and k is as small as possible. Note that k is
- the number of digits in the decimal representation
- of s, that s is not divisible by 10, and that the
- least significant digit of s is not necessarily
- uniquely determined by these criteria.
- 6. If k <= n <= 21, return the string consisting of the
- k digits of the decimal representation of s (in order,
- with no leading zeroes), followed by n-k occurences
- of the character '0'.
- 7. If 0 < n <= 21, return the string consisting of the
- most significant n digits of the decimal
- representation of s, followed by a decimal point
- '.', followed by the remaining kn digits of the
- decimal representation of s.
- 8. If 6 < n <= 0, return the string consisting of the
- character '0', followed by a decimal point '.',
- followed by n occurences of the character '0',
- followed by the k digits of the decimal
- representation of s.
- 9. Otherwise, if k = 1, return the string consisting
- of the single digit of s, followed by lowercase
- character 'e', followed by a plus sign '+' or minus
- sign '' according to whether n1 is positive or
- negative, followed by the decimal representation
- of the integer abs(n1) (with no leading zeros).
- 10. Return the string consisting of the most significant
- digit of the decimal representation of s, followed
- by a decimal point '.', followed by the remaining k1
- digits of the decimal representation of s, followed
- by the lowercase character 'e', followed by a plus
- sign '+' or minus sign '' according to whether n1 is
- positive or negative, followed by the decimal
- representation of the integer abs(n1) (with no
- leading zeros).
+ 1. if m is NaN, return the string "NaN"
+ 2. if m is +0 or -0, return the string "0"
+ 3. if m is less than zero, return the string
+ concatenation of the string "-" and ToString(-m).
+ 4. If m is Infinity, return the string "Infinity".
+ 5. Otherwise, let n, k, and s be integers such that
+ k >= 1, 10k1 <= s < 10k, the number value for s10nk
+ is m, and k is as small as possible. Note that k is
+ the number of digits in the decimal representation
+ of s, that s is not divisible by 10, and that the
+ least significant digit of s is not necessarily
+ uniquely determined by these criteria.
+ 6. If k <= n <= 21, return the string consisting of the
+ k digits of the decimal representation of s (in order,
+ with no leading zeroes), followed by n-k occurences
+ of the character '0'.
+ 7. If 0 < n <= 21, return the string consisting of the
+ most significant n digits of the decimal
+ representation of s, followed by a decimal point
+ '.', followed by the remaining kn digits of the
+ decimal representation of s.
+ 8. If 6 < n <= 0, return the string consisting of the
+ character '0', followed by a decimal point '.',
+ followed by n occurences of the character '0',
+ followed by the k digits of the decimal
+ representation of s.
+ 9. Otherwise, if k = 1, return the string consisting
+ of the single digit of s, followed by lowercase
+ character 'e', followed by a plus sign '+' or minus
+ sign '' according to whether n1 is positive or
+ negative, followed by the decimal representation
+ of the integer abs(n1) (with no leading zeros).
+ 10. Return the string consisting of the most significant
+ digit of the decimal representation of s, followed
+ by a decimal point '.', followed by the remaining k1
+ digits of the decimal representation of s, followed
+ by the lowercase character 'e', followed by a plus
+ sign '+' or minus sign '' according to whether n1 is
+ positive or negative, followed by the decimal
+ representation of the integer abs(n1) (with no
+ leading zeros).
- Note that if x is any number value other than 0, then
- ToNumber(ToString(x)) is exactly the same number value as x.
+ Note that if x is any number value other than 0, then
+ ToNumber(ToString(x)) is exactly the same number value as x.
- As noted, the least significant digit of s is not always
- uniquely determined by the requirements listed in step 5.
- The following specification for step 5 was considered, but
- not adopted:
+ As noted, the least significant digit of s is not always
+ uniquely determined by the requirements listed in step 5.
+ The following specification for step 5 was considered, but
+ not adopted:
- Author: christine@netscape.com
- Date: 10 july 1997
+ Author: christine@netscape.com
+ Date: 10 july 1997
*/
- var SECTION = "9.8.1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "9.8.1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " ToString applied to the Number type");
- test();
+writeHeaderToLog( SECTION + " ToString applied to the Number type");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" );
+new TestCase( SECTION, "0", "0", 0 + "" );
+new TestCase( SECTION, "-0", "0", -0 + "" );
+new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" );
+new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" );
+new TestCase( SECTION, "-1", "-1", -1 + "" );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+// cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
- array[item++] = new TestCase( SECTION, "Number.NaN", "NaN", Number.NaN + "" );
- array[item++] = new TestCase( SECTION, "0", "0", 0 + "" );
- array[item++] = new TestCase( SECTION, "-0", "0", -0 + "" );
- array[item++] = new TestCase( SECTION, "Number.POSITIVE_INFINITY", "Infinity", Number.POSITIVE_INFINITY + "" );
- array[item++] = new TestCase( SECTION, "Number.NEGATIVE_INFINITY", "-Infinity", Number.NEGATIVE_INFINITY + "" );
- array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" );
+new TestCase( SECTION, "1", "1", 1 + "" );
+new TestCase( SECTION, "10", "10", 10 + "" );
+new TestCase( SECTION, "100", "100", 100 + "" );
+new TestCase( SECTION, "1000", "1000", 1000 + "" );
+new TestCase( SECTION, "10000", "10000", 10000 + "" );
+new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" );
+new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" );
+new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" );
- // cases in step 6: integers 1e21 > x >= 1 or -1 >= x > -1e21
+new TestCase( SECTION, "12345", "12345", 12345 + "" );
+new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" );
- array[item++] = new TestCase( SECTION, "1", "1", 1 + "" );
- array[item++] = new TestCase( SECTION, "10", "10", 10 + "" );
- array[item++] = new TestCase( SECTION, "100", "100", 100 + "" );
- array[item++] = new TestCase( SECTION, "1000", "1000", 1000 + "" );
- array[item++] = new TestCase( SECTION, "10000", "10000", 10000 + "" );
- array[item++] = new TestCase( SECTION, "10000000000", "10000000000", 10000000000 + "" );
- array[item++] = new TestCase( SECTION, "10000000000000000000", "10000000000000000000", 10000000000000000000 + "" );
- array[item++] = new TestCase( SECTION, "100000000000000000000","100000000000000000000",100000000000000000000 + "" );
+new TestCase( SECTION, "-1", "-1", -1 + "" );
+new TestCase( SECTION, "-10", "-10", -10 + "" );
+new TestCase( SECTION, "-100", "-100", -100 + "" );
+new TestCase( SECTION, "-1000", "-1000", -1000 + "" );
+new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" );
+new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" );
+new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" );
+new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" );
- array[item++] = new TestCase( SECTION, "12345", "12345", 12345 + "" );
- array[item++] = new TestCase( SECTION, "1234567890", "1234567890", 1234567890 + "" );
+new TestCase( SECTION, "-12345", "-12345", -12345 + "" );
+new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" );
- array[item++] = new TestCase( SECTION, "-1", "-1", -1 + "" );
- array[item++] = new TestCase( SECTION, "-10", "-10", -10 + "" );
- array[item++] = new TestCase( SECTION, "-100", "-100", -100 + "" );
- array[item++] = new TestCase( SECTION, "-1000", "-1000", -1000 + "" );
- array[item++] = new TestCase( SECTION, "-1000000000", "-1000000000", -1000000000 + "" );
- array[item++] = new TestCase( SECTION, "-1000000000000000", "-1000000000000000", -1000000000000000 + "" );
- array[item++] = new TestCase( SECTION, "-100000000000000000000", "-100000000000000000000", -100000000000000000000 + "" );
- array[item++] = new TestCase( SECTION, "-1000000000000000000000", "-1e+21", -1000000000000000000000 + "" );
+// cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
+new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" );
- array[item++] = new TestCase( SECTION, "-12345", "-12345", -12345 + "" );
- array[item++] = new TestCase( SECTION, "-1234567890", "-1234567890", -1234567890 + "" );
+// cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
- // cases in step 7: numbers with a fractional component, 1e21> x >1 or -1 > x > -1e21,
- array[item++] = new TestCase( SECTION, "1.0000001", "1.0000001", 1.0000001 + "" );
+// cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
- // cases in step 8: fractions between 1 > x > -1, exclusive of 0 and -0
+new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" );
+new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" );
- // cases in step 9: numbers with 1 significant digit >= 1e+21 or <= 1e-6
+// cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
- array[item++] = new TestCase( SECTION, "1000000000000000000000", "1e+21", 1000000000000000000000 + "" );
- array[item++] = new TestCase( SECTION, "10000000000000000000000", "1e+22", 10000000000000000000000 + "" );
-
- // cases in step 10: numbers with more than 1 significant digit >= 1e+21 or <= 1e-6
-
- array[item++] = new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345));
- array[item++] = new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 ));
+new TestCase( SECTION, "1.2345", "1.2345", String( 1.2345));
+new TestCase( SECTION, "1.234567890", "1.23456789", String( 1.234567890 ));
- array[item++] = new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) );
- array[item++] = new TestCase( SECTION, ".012345", "0.012345", String(.012345) );
- array[item++] = new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) );
- array[item++] = new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) );
- array[item++] = new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) );
- array[item++] = new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) );
- array[item++] = new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345));
+new TestCase( SECTION, ".12345", "0.12345", String(.12345 ) );
+new TestCase( SECTION, ".012345", "0.012345", String(.012345) );
+new TestCase( SECTION, ".0012345", "0.0012345", String(.0012345) );
+new TestCase( SECTION, ".00012345", "0.00012345", String(.00012345) );
+new TestCase( SECTION, ".000012345", "0.000012345", String(.000012345) );
+new TestCase( SECTION, ".0000012345", "0.0000012345", String(.0000012345) );
+new TestCase( SECTION, ".00000012345", "1.2345e-7", String(.00000012345));
+
+new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) );
+
+test();
- array[item++] = new TestCase( SECTION, "-1e21", "-1e+21", String(-1e21) );
- return ( array );
-}
diff --git a/mozilla/js/tests/ecma/TypeConversion/9.9-1.js b/mozilla/js/tests/ecma/TypeConversion/9.9-1.js
index 1332c6fb9d5..6c3711ebe3a 100644
--- a/mozilla/js/tests/ecma/TypeConversion/9.9-1.js
+++ b/mozilla/js/tests/ecma/TypeConversion/9.9-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,125 +35,98 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-/**
- File Name: 9.9-1.js
- ECMA Section: 9.9 Type Conversion: ToObject
- Description:
- undefined generate a runtime error
- null generate a runtime error
- boolean create a new Boolean object whose default
- value is the value of the boolean.
- number Create a new Number object whose default
- value is the value of the number.
- string Create a new String object whose default
- value is the value of the string.
- object Return the input argument (no conversion).
- Author: christine@netscape.com
- Date: 17 july 1997
+/**
+ File Name: 9.9-1.js
+ ECMA Section: 9.9 Type Conversion: ToObject
+ Description:
+
+ undefined generate a runtime error
+ null generate a runtime error
+ boolean create a new Boolean object whose default
+ value is the value of the boolean.
+ number Create a new Number object whose default
+ value is the value of the number.
+ string Create a new String object whose default
+ value is the value of the string.
+ object Return the input argument (no conversion).
+ Author: christine@netscape.com
+ Date: 17 july 1997
*/
- var VERSION = "ECMA_1";
- startTest();
- var SECTION = "9.9-1";
+var VERSION = "ECMA_1";
+startTest();
+var SECTION = "9.9-1";
- writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
- var tc= 0;
- var testcases = getTestCases();
+writeHeaderToLog( SECTION + " Type Conversion: ToObject" );
-// all tests must call a function that returns an array of TestCase objects.
- test();
+new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
+new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
+new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
+new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
+new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(true).valueOf()", true, (Object(true)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(true)", "object", typeof Object(true) );
- array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
+new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
+new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(false).valueOf()", false, (Object(false)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(false)", "object", typeof Object(false) );
- array[item++] = new TestCase( SECTION, "(Object(true)).__proto__", Boolean.prototype, (Object(true)).__proto__ );
+new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
+new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
+new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(0).valueOf()", 0, (Object(0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(0)", "object", typeof Object(0) );
- array[item++] = new TestCase( SECTION, "(Object(0)).__proto__", Number.prototype, (Object(0)).__proto__ );
+new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
+new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
+new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(-0).valueOf()", -0, (Object(-0)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(-0)", "object", typeof Object(-0) );
- array[item++] = new TestCase( SECTION, "(Object(-0)).__proto__", Number.prototype, (Object(-0)).__proto__ );
+new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
+new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
+new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(1).valueOf()", 1, (Object(1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(1)", "object", typeof Object(1) );
- array[item++] = new TestCase( SECTION, "(Object(1)).__proto__", Number.prototype, (Object(1)).__proto__ );
+new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
+new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(-1).valueOf()", -1, (Object(-1)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(-1)", "object", typeof Object(-1) );
- array[item++] = new TestCase( SECTION, "(Object(-1)).__proto__", Number.prototype, (Object(-1)).__proto__ );
+new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
+new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(Number.MAX_VALUE).valueOf()", 1.7976931348623157e308, (Object(Number.MAX_VALUE)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.MAX_VALUE)", "object", typeof Object(Number.MAX_VALUE) );
- array[item++] = new TestCase( SECTION, "(Object(Number.MAX_VALUE)).__proto__", Number.prototype, (Object(Number.MAX_VALUE)).__proto__ );
+new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
+new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(Number.MIN_VALUE).valueOf()", 5e-324, (Object(Number.MIN_VALUE)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.MIN_VALUE)", "object", typeof Object(Number.MIN_VALUE) );
- array[item++] = new TestCase( SECTION, "(Object(Number.MIN_VALUE)).__proto__", Number.prototype, (Object(Number.MIN_VALUE)).__proto__ );
+new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
+new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(Number.POSITIVE_INFINITY).valueOf()", Number.POSITIVE_INFINITY, (Object(Number.POSITIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.POSITIVE_INFINITY)", "object", typeof Object(Number.POSITIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "(Object(Number.POSITIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.POSITIVE_INFINITY)).__proto__ );
+new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
+new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
+new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(Number.NEGATIVE_INFINITY).valueOf()", Number.NEGATIVE_INFINITY, (Object(Number.NEGATIVE_INFINITY)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.NEGATIVE_INFINITY)", "object", typeof Object(Number.NEGATIVE_INFINITY) );
- array[item++] = new TestCase( SECTION, "(Object(Number.NEGATIVE_INFINITY)).__proto__", Number.prototype, (Object(Number.NEGATIVE_INFINITY)).__proto__ );
+new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
+new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
+new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
- array[item++] = new TestCase( SECTION, "Object(Number.NaN).valueOf()", Number.NaN, (Object(Number.NaN)).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object(Number.NaN)", "object", typeof Object(Number.NaN) );
- array[item++] = new TestCase( SECTION, "(Object(Number.NaN)).__proto__", Number.prototype, (Object(Number.NaN)).__proto__ );
+new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
+new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
+new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
- array[item++] = new TestCase( SECTION, "Object('a string').valueOf()", "a string", (Object("a string")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('a string')", "object", typeof (Object("a string")) );
- array[item++] = new TestCase( SECTION, "(Object('a string')).__proto__", String.prototype, (Object("a string")).__proto__ );
+new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
+new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
+new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
- array[item++] = new TestCase( SECTION, "Object('').valueOf()", "", (Object("")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('')", "object", typeof (Object("")) );
- array[item++] = new TestCase( SECTION, "(Object('')).__proto__", String.prototype, (Object("")).__proto__ );
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
+new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
+new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
- array[item++] = new TestCase( SECTION, "Object('\\r\\t\\b\\n\\v\\f').valueOf()", "\r\t\b\n\v\f", (Object("\r\t\b\n\v\f")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object('\\r\\t\\b\\n\\v\\f')", "object", typeof (Object("\\r\\t\\b\\n\\v\\f")) );
- array[item++] = new TestCase( SECTION, "(Object('\\r\\t\\b\\n\\v\\f')).__proto__", String.prototype, (Object("\\r\\t\\b\\n\\v\\f")).__proto__ );
+new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") );
+new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") );
+new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
- array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).valueOf()", "\'\"\\", (Object("\'\"\\")).valueOf() );
- array[item++] = new TestCase( SECTION, "typeof Object( '\\\'\\\"\\' )", "object", typeof Object("\'\"\\") );
- array[item++] = new TestCase( SECTION, "Object( '\\\'\\\"\\' ).__proto__", String.prototype, (Object("\'\"\\")).__proto__ );
+test();
- array[item++] = new TestCase( SECTION, "Object( new MyObject(true) ).valueOf()", true, eval("Object( new MyObject(true) ).valueOf()") );
- array[item++] = new TestCase( SECTION, "typeof Object( new MyObject(true) )", "object", eval("typeof Object( new MyObject(true) )") );
- array[item++] = new TestCase( SECTION, "(Object( new MyObject(true) )).toString()", "[object Object]", eval("(Object( new MyObject(true) )).toString()") );
-
- return ( array );
-}
-
-function test() {
- for ( tc = 0; tc < testcases.length; tc++ ) {
-
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason +=
- ( testcases[tc].passed ) ? "" : "wrong value ";
-
- }
- stopTest();
-
- // all tests must return an array of TestCase objects
- return ( testcases );
-}
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function ( "return this.value" );
-}
\ No newline at end of file
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+}
diff --git a/mozilla/js/tests/ecma/TypeConversion/browser.js b/mozilla/js/tests/ecma/TypeConversion/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/TypeConversion/shell.js b/mozilla/js/tests/ecma/TypeConversion/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Types/8.1.js b/mozilla/js/tests/ecma/Types/8.1.js
index ed9c613dadb..0a1b555ca16 100644
--- a/mozilla/js/tests/ecma/Types/8.1.js
+++ b/mozilla/js/tests/ecma/Types/8.1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,53 +35,39 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 8.1.js
- ECMA Section: The undefined type
- Description:
+ File Name: 8.1.js
+ ECMA Section: The undefined type
+ Description:
- The Undefined type has exactly one value, called undefined. Any variable
- that has not been assigned a value is of type Undefined.
+ The Undefined type has exactly one value, called undefined. Any variable
+ that has not been assigned a value is of type Undefined.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "8.1";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The undefined type";
+var SECTION = "8.1";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The undefined type";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "var x; typeof x",
+ "undefined",
+ eval("var x; typeof x") );
- testcases[tc++] = new TestCase( SECTION,
- "var x; typeof x",
- "undefined",
- eval("var x; typeof x") );
+new TestCase( SECTION,
+ "var x; typeof x == 'undefined",
+ true,
+ eval("var x; typeof x == 'undefined'") );
- testcases[tc++] = new TestCase( SECTION,
- "var x; typeof x == 'undefined",
- true,
- eval("var x; typeof x == 'undefined'") );
+new TestCase( SECTION,
+ "var x; x == void 0",
+ true,
+ eval("var x; x == void 0") );
+test();
- testcases[tc++] = new TestCase( SECTION,
- "var x; x == void 0",
- true,
- eval("var x; x == void 0") );
- test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Types/8.4.js b/mozilla/js/tests/ecma/Types/8.4.js
index 3a432ea2f47..151410f27ef 100644
--- a/mozilla/js/tests/ecma/Types/8.4.js
+++ b/mozilla/js/tests/ecma/Types/8.4.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,107 +35,94 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 8.4.js
- ECMA Section: The String type
- Description:
+ File Name: 8.4.js
+ ECMA Section: The String type
+ Description:
- The String type is the set of all finite ordered sequences of zero or more
- Unicode characters. Each character is regarded as occupying a position
- within the sequence. These positions are identified by nonnegative
- integers. The leftmost character (if any) is at position 0, the next
- character (if any) at position 1, and so on. The length of a string is the
- number of distinct positions within it. The empty string has length zero
- and therefore contains no characters.
+ The String type is the set of all finite ordered sequences of zero or more
+ Unicode characters. Each character is regarded as occupying a position
+ within the sequence. These positions are identified by nonnegative
+ integers. The leftmost character (if any) is at position 0, the next
+ character (if any) at position 1, and so on. The length of a string is the
+ number of distinct positions within it. The empty string has length zero
+ and therefore contains no characters.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "8.4";
- var VERSION = "ECMA_1";
- startTest();
- var TITLE = "The String type";
+var SECTION = "8.4";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "The String type";
- writeHeaderToLog( SECTION + " "+ TITLE);
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
+new TestCase( SECTION,
+ "var s = ''; s.length",
+ 0,
+ eval("var s = ''; s.length") );
- testcases[tc++] = new TestCase( SECTION,
- "var s = ''; s.length",
- 0,
- eval("var s = ''; s.length") );
-
- testcases[tc++] = new TestCase( SECTION,
- "var s = ''; s.charAt(0)",
- "",
- eval("var s = ''; s.charAt(0)") );
+new TestCase( SECTION,
+ "var s = ''; s.charAt(0)",
+ "",
+ eval("var s = ''; s.charAt(0)") );
- for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) {
- TEST_STRING += ("\\u"+ DecimalToHexString( i ) );
- EXPECT_STRING += String.fromCharCode(i);
- }
+for ( var i = 0x0041, TEST_STRING = "", EXPECT_STRING = ""; i < 0x007B; i++ ) {
+ TEST_STRING += ("\\u"+ DecimalToHexString( i ) );
+ EXPECT_STRING += String.fromCharCode(i);
+}
- testcases[tc++] = new TestCase( SECTION,
- "var s = '" + TEST_STRING+ "'; s",
- EXPECT_STRING,
- eval("var s = '" + TEST_STRING+ "'; s") );
+new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s",
+ EXPECT_STRING,
+ eval("var s = '" + TEST_STRING+ "'; s") );
- testcases[tc++] = new TestCase( SECTION,
- "var s = '" + TEST_STRING+ "'; s.length",
- 0x007B-0x0041,
- eval("var s = '" + TEST_STRING+ "'; s.length") );
+new TestCase( SECTION,
+ "var s = '" + TEST_STRING+ "'; s.length",
+ 0x007B-0x0041,
+ eval("var s = '" + TEST_STRING+ "'; s.length") );
+
+test();
- test();
function DecimalToHexString( n ) {
- n = Number( n );
- var h = "";
+ n = Number( n );
+ var h = "";
- for ( var i = 3; i >= 0; i-- ) {
- if ( n >= Math.pow(16, i) ){
- var t = Math.floor( n / Math.pow(16, i));
- n -= t * Math.pow(16, i);
- if ( t >= 10 ) {
- if ( t == 10 ) {
- h += "A";
- }
- if ( t == 11 ) {
- h += "B";
- }
- if ( t == 12 ) {
- h += "C";
- }
- if ( t == 13 ) {
- h += "D";
- }
- if ( t == 14 ) {
- h += "E";
- }
- if ( t == 15 ) {
- h += "F";
- }
- } else {
- h += String( t );
- }
- } else {
- h += "0";
- }
+ for ( var i = 3; i >= 0; i-- ) {
+ if ( n >= Math.pow(16, i) ){
+ var t = Math.floor( n / Math.pow(16, i));
+ n -= t * Math.pow(16, i);
+ if ( t >= 10 ) {
+ if ( t == 10 ) {
+ h += "A";
+ }
+ if ( t == 11 ) {
+ h += "B";
+ }
+ if ( t == 12 ) {
+ h += "C";
+ }
+ if ( t == 13 ) {
+ h += "D";
+ }
+ if ( t == 14 ) {
+ h += "E";
+ }
+ if ( t == 15 ) {
+ h += "F";
+ }
+ } else {
+ h += String( t );
+ }
+ } else {
+ h += "0";
}
+ }
- return h;
+ return h;
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma/Types/8.6.2.1-1.js b/mozilla/js/tests/ecma/Types/8.6.2.1-1.js
index 7f1a6d4c233..aef57c59959 100644
--- a/mozilla/js/tests/ecma/Types/8.6.2.1-1.js
+++ b/mozilla/js/tests/ecma/Types/8.6.2.1-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,87 +35,69 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+
/**
- File Name: 8.6.2.1-1.js
- ECMA Section: 8.6.2.1 Get (Value)
- Description:
+ File Name: 8.6.2.1-1.js
+ ECMA Section: 8.6.2.1 Get (Value)
+ Description:
- When the [[Get]] method of O is called with property name P, the following
- steps are taken:
+ When the [[Get]] method of O is called with property name P, the following
+ steps are taken:
- 1. If O doesn't have a property with name P, go to step 4.
- 2. Get the value of the property.
- 3. Return Result(2).
- 4. If the [[Prototype]] of O is null, return undefined.
- 5. Call the [[Get]] method of [[Prototype]] with property name P.
- 6. Return Result(5).
+ 1. If O doesn't have a property with name P, go to step 4.
+ 2. Get the value of the property.
+ 3. Return Result(2).
+ 4. If the [[Prototype]] of O is null, return undefined.
+ 5. Call the [[Get]] method of [[Prototype]] with property name P.
+ 6. Return Result(5).
- This tests [[Get]] (Value).
+ This tests [[Get]] (Value).
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "8.6.2.1-1";
- var VERSION = "ECMA_1";
- startTest();
- var testcases = getTestCases();
+var SECTION = "8.6.2.1-1";
+var VERSION = "ECMA_1";
+startTest();
- writeHeaderToLog( SECTION + " [[Get]] (Value)");
- test();
+writeHeaderToLog( SECTION + " [[Get]] (Value)");
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") );
+new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
-function getTestCases() {
- var array = new Array();
- var item = 0;
+new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyValuelessObject(true); OBJ.valueOf()") );
-// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(true); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyProtolessObject(true); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
+new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") );
+// new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
+new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") );
+new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyValuelessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
-// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject(Number.POSITIVE_INFINITY); OBJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyProtolessObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
+test();
- array[item++] = new TestCase( SECTION, "var OBJ = new MyValuelessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyValuelessObject('string'); OBJ.valueOf()") );
-// array[item++] = new TestCase( SECTION, "var OBJ = new MyProtoValuelessObject('string'); OJ + ''", "undefined", eval("var OBJ = new MyProtoValuelessObject(); OBJ + ''") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyProtolessObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyProtolessObject('string'); OBJ.valueOf()") );
- array[item++] = new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") );
-
- return ( array );
-}
function MyProtoValuelessObject(value) {
- this.valueOf = new Function ( "" );
- this.__proto__ = null;
+ this.valueOf = new Function ( "" );
+ this.__proto__ = null;
}
function MyProtolessObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.__proto__ = null;
- this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.__proto__ = null;
+ this.value = value;
}
function MyValuelessObject(value) {
- this.__proto__ = new MyPrototypeObject(value);
+ this.__proto__ = new MyPrototypeObject(value);
}
function MyPrototypeObject(value) {
- this.valueOf = new Function( "return this.value;" );
- this.toString = new Function( "return (this.value + '');" );
- this.value = value;
+ this.valueOf = new Function( "return this.value;" );
+ this.toString = new Function( "return (this.value + '');" );
+ this.value = value;
}
function MyObject( value ) {
- this.valueOf = new Function( "return this.value" );
- this.value = value;
-}
\ No newline at end of file
+ this.valueOf = new Function( "return this.value" );
+ this.value = value;
+}
diff --git a/mozilla/js/tests/ecma/Types/browser.js b/mozilla/js/tests/ecma/Types/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/Types/shell.js b/mozilla/js/tests/ecma/Types/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma/browser.js b/mozilla/js/tests/ecma/browser.js
index 922fb136e05..0f01407fc48 100644
--- a/mozilla/js/tests/ecma/browser.js
+++ b/mozilla/js/tests/ecma/browser.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -49,47 +50,77 @@
*
*/
-onerror = err;
-
-function startTest() {
- if ( BUGNUMBER ) {
- writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
- }
-
- testcases = new Array();
- tc = 0;
-}
+var GLOBAL = "[object Window]";
function writeLineToLog( string ) {
- document.write( string + "
\n");
+ document.write( string + "
\n");
}
-function writeHeaderToLog( string ) {
- document.write( "" + string + "
" );
-}
-function stopTest() {
- var gc;
- if ( gc != undefined ) {
- gc();
- }
- document.write( "
" );
-}
-function writeFormattedResult( expect, actual, string, passed ) {
- var s = ""+ string ;
- s += "" ;
- s += ( passed ) ? " " + PASSED
- : " " + FAILED + expect + "";
- writeLineToLog( s + "" );
- return passed;
-}
-function err( msg, page, line ) {
- writeLineToLog( "Test failed with the message: " + msg );
- testcases[tc].actual = "error";
- testcases[tc].reason = msg;
- writeTestCaseResult( testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual +
- ": " + testcases[tc].reason );
- stopTest();
- return true;
+function writeHeaderToLog( string ) {
+ document.write( "" + string + "
" );
+}
+
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = ""+ string ;
+ s += "" ;
+ s += ( passed ) ? " " + PASSED
+ : " " + FAILED + expect + "";
+ writeLineToLog( s + "" );
+ return passed;
+}
+
+/*
+ * The earlier versions of the test code used exceptions
+ * to terminate the test script in "negative" test cases
+ * before the failure reporting code could run. In order
+ * to be able to capture errors for the "negative" case
+ * where the exception is a sign the test actually passed,
+ * the err online handler will assume that any error is a
+ * failure unless gExceptionExpected is true.
+ */
+window.onerror = err;
+var gExceptionExpected = false;
+
+function err( msg, page, line ) {
+ var testcase;
+
+ if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
+ /*
+ * an unexpected exception occured
+ */
+ writeLineToLog( "Test failed with the message: " + msg );
+ testcase = new TestCase(SECTION, "unknown", "unknown", "unknown");
+ testcase.passed = false;
+ testcase.reason = "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ return;
+ }
+
+ if (typeof SECTION == 'undefined')
+ {
+ SECTION = 'Unknown';
+ }
+ if (typeof DESCRIPTION == 'undefined')
+ {
+ DESCRIPTION = 'Unknown';
+ }
+ if (typeof EXPECTED == 'undefined')
+ {
+ EXPECTED = 'Unknown';
+ }
+
+ testcase = new TestCase(SECTION, DESCRIPTION, EXPECTED, "error");
+ testcase.reason += "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ stopTest();
+}
+
+var gVersion = 0;
+
+function version(v)
+{
+ if (v) {
+ gVersion = v;
+ }
+ return gVersion;
}
diff --git a/mozilla/js/tests/ecma/shell.js b/mozilla/js/tests/ecma/shell.js
index d2ee1f69920..e997b94e12d 100644
--- a/mozilla/js/tests/ecma/shell.js
+++ b/mozilla/js/tests/ecma/shell.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -40,31 +41,30 @@
* then load the test script.
*/
-var completed = false;
-var testcases;
-var tc = 0;
+var completed = false;
+var testcases = new Array();
+var tc = testcases.length;
-SECTION = "";
-VERSION = "";
-BUGNUMBER = "";
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER = "";
/*
* constant strings
*/
-var GLOBAL = "[object global]";
+var GLOBAL = "[object global]";
var PASSED = " PASSED!"
var FAILED = " FAILED! expected: ";
-var DEBUG = false;
+var DEBUG = false;
-
-
-/* wrapper for test cas constructor that doesn't require the SECTION
+/*
+ * wrapper for test case constructor that doesn't require the SECTION
* argument.
*/
function AddTestCase( description, expect, actual ) {
- testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+ new TestCase( SECTION, description, expect, actual );
}
/*
@@ -72,19 +72,28 @@ function AddTestCase( description, expect, actual ) {
*
*/
-function TestCase( n, d, e, a ) {
- this.name = n;
- this.description = d;
- this.expect = e;
- this.actual = a;
- this.passed = true;
- this.reason = "";
- this.bugnumber = BUGNUMBER;
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
- this.passed = getTestCaseResult( this.expect, this.actual );
- if ( DEBUG ) {
- writeLineToLog( "added " + this.description );
- }
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+ /*
+ * testcases are solely maintained in the TestCase
+ * constructor. tc will _always_ point to one past the
+ * last testcase. If an exception occurs during the call
+ * to the constructor, then we are assured that the tc
+ * index has not been incremented.
+ */
+
+ testcases[tc++] = this;
}
/*
@@ -92,88 +101,92 @@ function TestCase( n, d, e, a ) {
*
*/
function startTest() {
- if ( version ) {
- // JavaScript 1.3 is supposed to be compliant ecma version 1.0
- if ( VERSION == "ECMA_1" ) {
- version ( "130" );
- }
- if ( VERSION == "JS_1.3" ) {
- version ( "130" );
- }
- if ( VERSION == "JS_1.2" ) {
- version ( "120" );
- }
- if ( VERSION == "JS_1.1" ) {
- version ( "110" );
- }
- // for ecma version 2.0, we will leave the javascript version to
- // the default ( for now ).
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
}
-
- // print out bugnumber
-
- if ( BUGNUMBER ) {
- writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
}
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+ }
- testcases = new Array();
- tc = 0;
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
}
-
function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ // temporary hack to work around some unknown issue in 1.7
+ try
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
- stopTest();
- return ( testcases );
+ catch(e)
+ {
+ writeLineToLog('test(): empty testcase for tc = ' + tc + ' ' + e);
+ }
+ }
+ stopTest();
+ return ( testcases );
}
/*
* Compare expected result to the actual result and figure out whether
* the test case passed.
*/
-function getTestCaseResult( expect, actual ) {
- // because ( NaN == NaN ) always returns false, need to do
- // a special compare to see if we got the right result.
- if ( actual != actual ) {
- if ( typeof actual == "object" ) {
- actual = "NaN object";
- } else {
- actual = "NaN number";
- }
- }
- if ( expect != expect ) {
- if ( typeof expect == "object" ) {
- expect = "NaN object";
- } else {
- expect = "NaN number";
- }
- }
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
- var passed = ( expect == actual ) ? true : false;
+ var passed = ( expect == actual ) ? true : false;
- // if both objects are numbers
- // need to replace w/ IEEE standard for rounding
- if ( !passed
- && typeof(actual) == "number"
- && typeof(expect) == "number"
- ) {
- if ( Math.abs(actual-expect) < 0.0000001 ) {
- passed = true;
- }
- }
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
- // verify type is the same
- if ( typeof(expect) != typeof(actual) ) {
- passed = false;
- }
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
- return passed;
+ return passed;
}
/*
@@ -184,21 +197,21 @@ function getTestCaseResult( expect, actual ) {
*/
function writeTestCaseResult( expect, actual, string ) {
- var passed = getTestCaseResult( expect, actual );
- writeFormattedResult( expect, actual, string, passed );
- return passed;
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
}
function writeFormattedResult( expect, actual, string, passed ) {
- var s = string ;
- s += ( passed ) ? PASSED : FAILED + expect;
- writeLineToLog( s);
- return passed;
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
}
-function writeLineToLog( string ) {
- print( string );
+function writeLineToLog( string ) {
+ print( string );
}
-function writeHeaderToLog( string ) {
- print( string );
+function writeHeaderToLog( string ) {
+ print( string );
}
/* end of print functions */
@@ -208,11 +221,11 @@ function writeHeaderToLog( string ) {
* test has completed.
*/
-function stopTest() {
- var gc;
- if ( gc != undefined ) {
- gc();
- }
+function stopTest() {
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
}
/*
@@ -221,29 +234,29 @@ function stopTest() {
*
*/
function getFailedCases() {
- for ( var i = 0; i < testcases.length; i++ ) {
- if ( ! testcases[i].passed ) {
- print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
- }
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ writeLineToLog( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
+ }
}
}
- /*
- * Date functions used by tests in Date suite
- *
- */
-var msPerDay = 86400000;
-var HoursPerDay = 24;
-var MinutesPerHour = 60;
-var SecondsPerMinute = 60;
-var msPerSecond = 1000;
-var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
-var msPerHour = 3600000; // msPerMinute * MinutesPerHour
-var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
-var TZ_PST = -8; // offset of Pacific Standard Time from UTC
-var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
-var TIME_1970 = 0;
-var TIME_2000 = 946684800000;
-var TIME_1900 = -2208988800000;
+/*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
+var MinutesPerHour = 60;
+var SecondsPerMinute = 60;
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
+var TZ_PST = -8; // offset of Pacific Standard Time from UTC
+var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
/*
@@ -251,7 +264,7 @@ var TIME_1900 = -2208988800000;
* But that was only valid for testers in the Pacific Standard Time Zone!
* We calculate the proper number dynamically for any tester. We just
* have to be careful not to use a date subject to Daylight Savings Time...
-*/
+ */
function getTimeZoneDiff()
{
return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
@@ -279,7 +292,7 @@ function adjustResultArray(ResultArray, msMode)
* like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc.
*
* In the second case, it is exactly the other way around -
- */
+ */
if (msMode)
{
// The hard-coded UTC milliseconds from Time 0 derives from a UTC date.
@@ -310,382 +323,383 @@ function adjustResultArray(ResultArray, msMode)
}
-function Day( t ) {
- return ( Math.floor(t/msPerDay ) );
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
}
function DaysInYear( y ) {
- if ( y % 4 != 0 ) {
- return 365;
- }
- if ( (y % 4 == 0) && (y % 100 != 0) ) {
- return 366;
- }
- if ( (y % 100 == 0) && (y % 400 != 0) ) {
- return 365;
- }
- if ( (y % 400 == 0) ){
- return 366;
- } else {
- return "ERROR: DaysInYear(" + y + ") case not covered";
- }
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
}
function TimeInYear( y ) {
- return ( DaysInYear(y) * msPerDay );
+ return ( DaysInYear(y) * msPerDay );
}
-function DayNumber( t ) {
- return ( Math.floor( t / msPerDay ) );
+function DayNumber( t ) {
+ return ( Math.floor( t / msPerDay ) );
}
-function TimeWithinDay( t ) {
- if ( t < 0 ) {
- return ( (t % msPerDay) + msPerDay );
- } else {
- return ( t % msPerDay );
- }
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
}
function YearNumber( t ) {
}
function TimeFromYear( y ) {
- return ( msPerDay * DayFromYear(y) );
+ return ( msPerDay * DayFromYear(y) );
}
-function DayFromYear( y ) {
- return ( 365*(y-1970) +
- Math.floor((y-1969)/4) -
- Math.floor((y-1901)/100) +
- Math.floor((y-1601)/400) );
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
}
function InLeapYear( t ) {
- if ( DaysInYear(YearFromTime(t)) == 365 ) {
- return 0;
- }
- if ( DaysInYear(YearFromTime(t)) == 366 ) {
- return 1;
- } else {
- return "ERROR: InLeapYear("+ t + ") case not covered";
- }
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+ t + ") case not covered";
+ }
}
function YearFromTime( t ) {
- t = Number( t );
- var sign = ( t < 0 ) ? -1 : 1;
- var year = ( sign < 0 ) ? 1969 : 1970;
- for ( var timeToTimeZero = t; ; ) {
- // subtract the current year's time from the time that's left.
- timeToTimeZero -= sign * TimeInYear(year)
+ t = Number( t );
+ var sign = ( t < 0 ) ? -1 : 1;
+ var year = ( sign < 0 ) ? 1969 : 1970;
+ for ( var timeToTimeZero = t; ; ) {
+ // subtract the current year's time from the time that's left.
+ timeToTimeZero -= sign * TimeInYear(year)
- // if there's less than the current year's worth of time left, then break.
- if ( sign < 0 ) {
- if ( sign * timeToTimeZero <= 0 ) {
- break;
- } else {
- year += sign;
- }
- } else {
- if ( sign * timeToTimeZero < 0 ) {
- break;
- } else {
- year += sign;
- }
- }
- }
- return ( year );
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
+ }
+ return ( year );
}
-function MonthFromTime( t ) {
- // i know i could use switch but i'd rather not until it's part of ECMA
- var day = DayWithinYear( t );
- var leap = InLeapYear(t);
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
+ var day = DayWithinYear( t );
+ var leap = InLeapYear(t);
- if ( (0 <= day) && (day < 31) ) {
- return 0;
- }
- if ( (31 <= day) && (day < (59+leap)) ) {
- return 1;
- }
- if ( ((59+leap) <= day) && (day < (90+leap)) ) {
- return 2;
- }
- if ( ((90+leap) <= day) && (day < (120+leap)) ) {
- return 3;
- }
- if ( ((120+leap) <= day) && (day < (151+leap)) ) {
- return 4;
- }
- if ( ((151+leap) <= day) && (day < (181+leap)) ) {
- return 5;
- }
- if ( ((181+leap) <= day) && (day < (212+leap)) ) {
- return 6;
- }
- if ( ((212+leap) <= day) && (day < (243+leap)) ) {
- return 7;
- }
- if ( ((243+leap) <= day) && (day < (273+leap)) ) {
- return 8;
- }
- if ( ((273+leap) <= day) && (day < (304+leap)) ) {
- return 9;
- }
- if ( ((304+leap) <= day) && (day < (334+leap)) ) {
- return 10;
- }
- if ( ((334+leap) <= day) && (day < (365+leap)) ) {
- return 11;
- } else {
- return "ERROR: MonthFromTime("+t+") not known";
- }
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
}
-function DayWithinYear( t ) {
- return( Day(t) - DayFromYear(YearFromTime(t)));
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
}
function DateFromTime( t ) {
- var day = DayWithinYear(t);
- var month = MonthFromTime(t);
+ var day = DayWithinYear(t);
+ var month = MonthFromTime(t);
- if ( month == 0 ) {
- return ( day + 1 );
- }
- if ( month == 1 ) {
- return ( day - 30 );
- }
- if ( month == 2 ) {
- return ( day - 58 - InLeapYear(t) );
- }
- if ( month == 3 ) {
- return ( day - 89 - InLeapYear(t));
- }
- if ( month == 4 ) {
- return ( day - 119 - InLeapYear(t));
- }
- if ( month == 5 ) {
- return ( day - 150- InLeapYear(t));
- }
- if ( month == 6 ) {
- return ( day - 180- InLeapYear(t));
- }
- if ( month == 7 ) {
- return ( day - 211- InLeapYear(t));
- }
- if ( month == 8 ) {
- return ( day - 242- InLeapYear(t));
- }
- if ( month == 9 ) {
- return ( day - 272- InLeapYear(t));
- }
- if ( month == 10 ) {
- return ( day - 303- InLeapYear(t));
- }
- if ( month == 11 ) {
- return ( day - 333- InLeapYear(t));
- }
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
- return ("ERROR: DateFromTime("+t+") not known" );
+ return ("ERROR: DateFromTime("+t+") not known" );
}
-function WeekDay( t ) {
- var weekday = (Day(t)+4) % 7;
- return( weekday < 0 ? 7 + weekday : weekday );
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
}
-// missing daylight savins time adjustment
+// missing daylight savings time adjustment
function HourFromTime( t ) {
- var h = Math.floor( t / msPerHour ) % HoursPerDay;
- return ( (h<0) ? HoursPerDay + h : h );
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
+ return ( (h<0) ? HoursPerDay + h : h );
}
-function MinFromTime( t ) {
- var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
- return( ( min < 0 ) ? MinutesPerHour + min : min );
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
}
-function SecFromTime( t ) {
- var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
- return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
}
function msFromTime( t ) {
- var ms = t % msPerSecond;
- return ( (ms < 0 ) ? msPerSecond + ms : ms );
+ var ms = t % msPerSecond;
+ return ( (ms < 0 ) ? msPerSecond + ms : ms );
}
-function LocalTZA() {
- return ( TZ_DIFF * msPerHour );
+function LocalTZA() {
+ return ( TZ_DIFF * msPerHour );
}
-function UTC( t ) {
- return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
}
function DaylightSavingTA( t ) {
- t = t - LocalTZA();
+ t = t - LocalTZA();
- var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
- var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour;
+ var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
+ var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour;
- if ( t >= dst_start && t < dst_end ) {
- return msPerHour;
- } else {
- return 0;
- }
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
- // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
- // PST. Other time zones will need to override this function.
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
- print( new Date( UTC(dst_start + LocalTZA())) );
+ writeLineToLog( new Date( UTC(dst_start + LocalTZA())) );
- return UTC(dst_start + LocalTZA());
+ return UTC(dst_start + LocalTZA());
}
-function GetFirstSundayInApril( t ) {
- var year = YearFromTime(t);
- var leap = InLeapYear(t);
+function GetFirstSundayInApril( t ) {
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
- var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
- TimeInMonth(2,leap);
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
- for ( var first_sunday = april; WeekDay(first_sunday) > 0;
- first_sunday += msPerDay )
- {
- ;
- }
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
+ ;
+ }
- return first_sunday;
+ return first_sunday;
}
function GetLastSundayInOctober( t ) {
- var year = YearFromTime(t);
- var leap = InLeapYear(t);
+ var year = YearFromTime(t);
+ var leap = InLeapYear(t);
- for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
- oct += TimeInMonth(m, leap);
- }
- for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
- last_sunday -= msPerDay )
- {
- ;
- }
- return last_sunday;
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
+ oct += TimeInMonth(m, leap);
+ }
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
+ {
+ ;
+ }
+ return last_sunday;
}
-function LocalTime( t ) {
- return ( t + LocalTZA() + DaylightSavingTA(t) );
+function LocalTime( t ) {
+ return ( t + LocalTZA() + DaylightSavingTA(t) );
}
-function MakeTime( hour, min, sec, ms ) {
- if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
- return Number.NaN;
- }
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
- hour = ToInteger(hour);
- min = ToInteger( min);
- sec = ToInteger( sec);
- ms = ToInteger( ms );
+ hour = ToInteger(hour);
+ min = ToInteger( min);
+ sec = ToInteger( sec);
+ ms = ToInteger( ms );
- return( (hour*msPerHour) + (min*msPerMinute) +
- (sec*msPerSecond) + ms );
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
}
-function MakeDay( year, month, date ) {
- if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
- return Number.NaN;
- }
- year = ToInteger(year);
- month = ToInteger(month);
- date = ToInteger(date );
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
+ year = ToInteger(year);
+ month = ToInteger(month);
+ date = ToInteger(date );
- var sign = ( year < 1970 ) ? -1 : 1;
- var t = ( year < 1970 ) ? 1 : 0;
- var y = ( year < 1970 ) ? 1969 : 1970;
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
- var result5 = year + Math.floor( month/12 );
- var result6 = month % 12;
+ var result5 = year + Math.floor( month/12 );
+ var result6 = month % 12;
- if ( year < 1970 ) {
- for ( y = 1969; y >= year; y += sign ) {
- t += sign * TimeInYear(y);
- }
- } else {
- for ( y = 1970 ; y < year; y += sign ) {
- t += sign * TimeInYear(y);
- }
- }
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
+ t += sign * TimeInYear(y);
+ }
+ }
- var leap = InLeapYear( t );
+ var leap = InLeapYear( t );
- for ( var m = 0; m < month; m++ ) {
- t += TimeInMonth( m, leap );
- }
+ for ( var m = 0; m < month; m++ ) {
+ t += TimeInMonth( m, leap );
+ }
- if ( YearFromTime(t) != result5 ) {
- return Number.NaN;
- }
- if ( MonthFromTime(t) != result6 ) {
- return Number.NaN;
- }
- if ( DateFromTime(t) != 1 ) {
- return Number.NaN;
- }
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
- return ( (Day(t)) + date - 1 );
+ return ( (Day(t)) + date - 1 );
}
-function TimeInMonth( month, leap ) {
- // september april june november
- // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
- // aug 7 sep 8 oct 9 nov 10 dec 11
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
- if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
- return ( 30*msPerDay );
- }
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
- // all the rest
- if ( month == 0 || month == 2 || month == 4 || month == 6 ||
- month == 7 || month == 9 || month == 11 ) {
- return ( 31*msPerDay );
- }
+ // all the rest
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
- // save february
- return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
}
-function MakeDate( day, time ) {
- if ( day == Number.POSITIVE_INFINITY ||
- day == Number.NEGATIVE_INFINITY ||
- day == Number.NaN ) {
- return Number.NaN;
- }
- if ( time == Number.POSITIVE_INFINITY ||
- time == Number.POSITIVE_INFINITY ||
- day == Number.NaN) {
- return Number.NaN;
- }
- return ( day * msPerDay ) + time;
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
+ day == Number.NEGATIVE_INFINITY ||
+ day == Number.NaN ) {
+ return Number.NaN;
+ }
+ if ( time == Number.POSITIVE_INFINITY ||
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
+ return Number.NaN;
+ }
+ return ( day * msPerDay ) + time;
}
function TimeClip( t ) {
- if ( isNaN( t ) ) {
- return ( Number.NaN );
- }
- if ( Math.abs( t ) > 8.64e15 ) {
- return ( Number.NaN );
- }
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
- return ( ToInteger( t ) );
+ return ( ToInteger( t ) );
}
-function ToInteger( t ) {
- t = Number( t );
+function ToInteger( t ) {
+ t = Number( t );
- if ( isNaN( t ) ){
- return ( Number.NaN );
- }
- if ( t == 0 || t == -0 ||
- t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
- return 0;
- }
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
+ return 0;
+ }
- var sign = ( t < 0 ) ? -1 : 1;
+ var sign = ( t < 0 ) ? -1 : 1;
- return ( sign * Math.floor( Math.abs( t ) ) );
+ return ( sign * Math.floor( Math.abs( t ) ) );
}
function Enumerate ( o ) {
- var p;
- for ( p in o ) {
- print( p +": " + o[p] );
- }
+ var p;
+ for ( p in o ) {
+ writeLineToLog( p +": " + o[p] );
+ }
}
/* these functions are useful for running tests manually in Rhino */
function GetContext() {
- return Packages.com.netscape.javascript.Context.getCurrentContext();
+ return Packages.com.netscape.javascript.Context.getCurrentContext();
}
function OptLevel( i ) {
- i = Number(i);
- var cx = GetContext();
- cx.setOptimizationLevel(i);
+ i = Number(i);
+ var cx = GetContext();
+ cx.setOptimizationLevel(i);
}
/* end of Rhino functions */
+
diff --git a/mozilla/js/tests/ecma/template.js b/mozilla/js/tests/ecma/template.js
new file mode 100644
index 00000000000..511bcb4b4af
--- /dev/null
+++ b/mozilla/js/tests/ecma/template.js
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * 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):
+ */
+
+/**
+ * File Name: template.js
+ * Reference: ** replace with bugzilla URL or document reference **
+ * Description: ** replace with description of test **
+ * Author: ** replace with your e-mail address **
+ */
+
+var SECTION = ""; // provide a document reference (ie, ECMA section)
+var VERSION = "ECMA"; // Version of JavaScript or ECMA
+var TITLE = ""; // Provide ECMA section title or a description
+var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+
+startTest(); // leave this alone
+
+/*
+ * Calls to AddTestCase here. AddTestCase is a function that is defined
+ * in shell.js and takes three arguments:
+ * - a string representation of what is being tested
+ * - the expected result
+ * - the actual result
+ *
+ * For example, a test might look like this:
+ *
+ * AddTestCase("** description",
+ * "** expected value",
+ * "** actual value");
+ */
+
+// leave this alone. this executes the test cases and
+// displays results.
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/boolean-001.js b/mozilla/js/tests/ecma_2/Exceptions/boolean-001.js
index 1645ad456c4..67b7390d2a1 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/boolean-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/boolean-001.js
@@ -1,43 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: boolean-001.js
- Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.2-4-n.js
- The toString function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The toString function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: june 27, 1997
+ Author: christine@netscape.com
+ Date: june 27, 1997
*/
- var SECTION = "boolean-001.js";
- var VERSION = "JS1_4";
- var TITLE = "Boolean.prototype.toString()";
- startTest();
- writeHeaderToLog( SECTION +" "+ TITLE );
+var SECTION = "boolean-001.js";
+var VERSION = "JS1_4";
+var TITLE = "Boolean.prototype.toString()";
+startTest();
+writeHeaderToLog( SECTION +" "+ TITLE );
- var tc = 0;
- var testcases = new Array();
+var exception = "No exception thrown";
+var result = "Failed";
- var exception = "No exception thrown";
- var result = "Failed";
+var TO_STRING = Boolean.prototype.toString;
- var TO_STRING = Boolean.prototype.toString;
+try {
+ var s = new String("Not a Boolean");
+ s.toString = TO_STRING;
+ s.toString();
+} catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+}
- try {
- var s = new String("Not a Boolean");
- s.toString = TO_STRING;
- s.toString();
- } catch ( e ) {
- result = "Passed!";
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.toString to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "Assigning Boolean.prototype.toString to a String object "+
- "(threw " +exception +")",
- "Passed!",
- result );
+test();
- test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/boolean-002.js b/mozilla/js/tests/ecma_2/Exceptions/boolean-002.js
index be31b99dea4..ca5cea08c12 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/boolean-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/boolean-002.js
@@ -1,47 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: boolean-001.js
- Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js
+ File Name: boolean-001.js
+ Description: Corresponds to ecma/Boolean/15.6.4.3-4-n.js
- 15.6.4.3 Boolean.prototype.valueOf()
- Returns this boolean value.
+ 15.6.4.3 Boolean.prototype.valueOf()
+ Returns this boolean value.
- The valueOf function is not generic; it generates
- a runtime error if its this value is not a Boolean
- object. Therefore it cannot be transferred to other
- kinds of objects for use as a method.
+ The valueOf function is not generic; it generates
+ a runtime error if its this value is not a Boolean
+ object. Therefore it cannot be transferred to other
+ kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 09 september 1998
+ Author: christine@netscape.com
+ Date: 09 september 1998
*/
- var SECTION = "boolean-002.js";
- var VERSION = "JS1_4";
- var TITLE = "Boolean.prototype.valueOf()";
- startTest();
- writeHeaderToLog( SECTION +" "+ TITLE );
+var SECTION = "boolean-002.js";
+var VERSION = "JS1_4";
+var TITLE = "Boolean.prototype.valueOf()";
+startTest();
+writeHeaderToLog( SECTION +" "+ TITLE );
- var tc = 0;
- var testcases = new Array();
- var exception = "No exception thrown";
- var result = "Failed";
+var exception = "No exception thrown";
+var result = "Failed";
- var VALUE_OF = Boolean.prototype.valueOf;
+var VALUE_OF = Boolean.prototype.valueOf;
- try {
- var s = new String("Not a Boolean");
- s.valueOf = VALUE_0F;
- s.valueOf();
- } catch ( e ) {
- result = "Passed!";
- exception = e.toString();
- }
+try {
+ var s = new String("Not a Boolean");
+ s.valueOf = VALUE_0F;
+ s.valueOf();
+} catch ( e ) {
+ result = "Passed!";
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "Assigning Boolean.prototype.valueOf to a String object "+
- "(threw " +exception +")",
- "Passed!",
- result );
+new TestCase(
+ SECTION,
+ "Assigning Boolean.prototype.valueOf to a String object "+
+ "(threw " +exception +")",
+ "Passed!",
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/browser.js b/mozilla/js/tests/ecma_2/Exceptions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/Exceptions/date-001.js b/mozilla/js/tests/ecma_2/Exceptions/date-001.js
index 60ef3a4af91..a959311661e 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/date-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/date-001.js
@@ -1,57 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: date-001.js
- Corresponds To: 15.9.5.2-2.js
- ECMA Section: 15.9.5.2 Date.prototype.toString
- Description:
- This function returns a string value. The contents of the string are
- implementation dependent, but are intended to represent the Date in a
- convenient, human-readable form in the current time zone.
+ File Name: date-001.js
+ Corresponds To: 15.9.5.2-2.js
+ ECMA Section: 15.9.5.2 Date.prototype.toString
+ Description:
+ This function returns a string value. The contents of the string are
+ implementation dependent, but are intended to represent the Date in a
+ convenient, human-readable form in the current time zone.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Date object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Date object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- This verifies that calling toString on an object that is not a string
- generates a runtime error.
+ This verifies that calling toString on an object that is not a string
+ generates a runtime error.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "date-001";
- var VERSION = "JS1_4";
- var TITLE = "Date.prototype.toString";
+var SECTION = "date-001";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.toString";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var OBJ = new MyObject( new Date(0) );
- result = OBJ.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJECT = new MyObject( new Date(0)) ; result = OBJ.toString()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function( "return this.value" );
- this.toString = Date.prototype.toString;
- return this;
+ this.value = value;
+ this.valueOf = new Function( "return this.value" );
+ this.toString = Date.prototype.toString;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/date-002.js b/mozilla/js/tests/ecma_2/Exceptions/date-002.js
index 6fd5a648997..73ebbe82d19 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/date-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/date-002.js
@@ -1,51 +1,49 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: date-002.js
- Corresponds To: 15.9.5.23-3-n.js
- ECMA Section: 15.9.5.23
- Description: Date.prototype.setTime
+ File Name: date-002.js
+ Corresponds To: 15.9.5.23-3-n.js
+ ECMA Section: 15.9.5.23
+ Description: Date.prototype.setTime
- 1. If the this value is not a Date object, generate a runtime error.
- 2. Call ToNumber(time).
- 3. Call TimeClip(Result(1)).
- 4. Set the [[Value]] property of the this value to Result(2).
- 5. Return the value of the [[Value]] property of the this value.
+ 1. If the this value is not a Date object, generate a runtime error.
+ 2. Call ToNumber(time).
+ 3. Call TimeClip(Result(1)).
+ 4. Set the [[Value]] property of the this value to Result(2).
+ 5. Return the value of the [[Value]] property of the this value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "date-002";
- var VERSION = "JS1_4";
- var TITLE = "Date.prototype.setTime()";
+var SECTION = "date-002";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.setTime()";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var MYDATE = new MyDate();
+ result = MYDATE.setTime(0);
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var MYDATE = new MyDate();
- result = MYDATE.setTime(0);
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.setTime(0)" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "MYDATE = new MyDate(); MYDATE.setTime(0)" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyDate(value) {
- this.value = value;
- this.setTime = Date.prototype.setTime;
- return this;
+ this.value = value;
+ this.setTime = Date.prototype.setTime;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/date-003.js b/mozilla/js/tests/ecma_2/Exceptions/date-003.js
index b675fdd87aa..b7cbfafb32b 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/date-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/date-003.js
@@ -1,53 +1,51 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: date-003.js
- Corresponds To 15.9.5.3-1.js
- ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
- Description:
+ File Name: date-003.js
+ Corresponds To 15.9.5.3-1.js
+ ECMA Section: 15.9.5.3-1 Date.prototype.valueOf
+ Description:
- The valueOf function returns a number, which is this time value.
+ The valueOf function returns a number, which is this time value.
- The valueOf function is not generic; it generates a runtime error if
- its this value is not a Date object. Therefore it cannot be transferred
- to other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if
+ its this value is not a Date object. Therefore it cannot be transferred
+ to other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "date-003";
- var VERSION = "JS1_4";
- var TITLE = "Date.prototype.valueOf";
+var SECTION = "date-003";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.valueOf";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var OBJ = new MyObject( new Date(0) );
+ result = OBJ.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var OBJ = new MyObject( new Date(0) );
- result = OBJ.valueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJ = new MyObject( new Date(0)); OBJ.valueOf()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject( value ) {
- this.value = value;
- this.valueOf = Date.prototype.valueOf;
+ this.value = value;
+ this.valueOf = Date.prototype.valueOf;
// The following line causes an infinte loop
// this.toString = new Function( "return this+\"\";");
- return this;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/date-004.js b/mozilla/js/tests/ecma_2/Exceptions/date-004.js
index fc2e4199be0..f9c4494cc9a 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/date-004.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/date-004.js
@@ -1,47 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: date-004.js
- Corresponds To: 15.9.5.4-2-n.js
- ECMA Section: 15.9.5.4-1 Date.prototype.getTime
- Description:
+ File Name: date-004.js
+ Corresponds To: 15.9.5.4-2-n.js
+ ECMA Section: 15.9.5.4-1 Date.prototype.getTime
+ Description:
- 1. If the this value is not an object whose [[Class]] property is "Date",
- generate a runtime error.
- 2. Return this time value.
- Author: christine@netscape.com
- Date: 12 november 1997
+ 1. If the this value is not an object whose [[Class]] property is "Date",
+ generate a runtime error.
+ 2. Return this time value.
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "date-004";
- var VERSION = "JS1_4";
- var TITLE = "Date.prototype.getTime";
+var SECTION = "date-004";
+var VERSION = "JS1_4";
+var TITLE = "Date.prototype.getTime";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var MYDATE = new MyDate();
+ result = MYDATE.getTime();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var MYDATE = new MyDate();
- result = MYDATE.getTime();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "MYDATE = new MyDate(); MYDATE.getTime()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "MYDATE = new MyDate(); MYDATE.getTime()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyDate( value ) {
- this.value = value;
- this.getTime = Date.prototype.getTime;
+ this.value = value;
+ this.getTime = Date.prototype.getTime;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-001.js b/mozilla/js/tests/ecma_2/Exceptions/exception-001.js
index eeeaa86e80f..5278ad8d989 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-001
* ECMA Section:
@@ -8,35 +9,32 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-001";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: CallError";
+var SECTION = "exception-001";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: CallError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+Call_1();
- Call_1();
+test();
- test();
+function Call_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function Call_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- Math();
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "Math() [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-002.js b/mozilla/js/tests/ecma_2/Exceptions/exception-002.js
index 680fcbf3d14..820dbe6cb6d 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-002
* ECMA Section:
@@ -8,35 +9,32 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-002";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError";
+var SECTION = "exception-002";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ConstructError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+Construct_1();
- Construct_1();
+test();
- test();
+function Construct_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function Construct_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- result = new Math();
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "new Math() [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = new Math();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new Math() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-003.js b/mozilla/js/tests/ecma_2/Exceptions/exception-003.js
index d073fbc14f6..d69bf32cc34 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-003
* ECMA Section:
@@ -8,39 +9,36 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-003";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: TargetError";
+var SECTION = "exception-003";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TargetError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+Target_1();
- Target_1();
+test();
- test();
+function Target_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function Target_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- string = new String("hi");
- string.toString = Boolean.prototype.toString;
- string.toString();
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "string = new String(\"hi\");"+
- "string.toString = Boolean.prototype.toString" +
- "string.toString() [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ string = new String("hi");
+ string.toString = Boolean.prototype.toString;
+ string.toString();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "string = new String(\"hi\");"+
+ "string.toString = Boolean.prototype.toString" +
+ "string.toString() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-004.js b/mozilla/js/tests/ecma_2/Exceptions/exception-004.js
index 1fde9595f43..10354252dcd 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-004.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-004
* ECMA Section:
@@ -8,35 +9,32 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-004";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+var SECTION = "exception-004";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+ToObject_1();
- ToObject_1();
+test();
- test();
+function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function ToObject_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- result = foo["bar"];
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "foo[\"bar\"] [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-005.js b/mozilla/js/tests/ecma_2/Exceptions/exception-005.js
index 2fbb9846148..d9944b2074f 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-005.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-005.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-005
* ECMA Section:
@@ -8,35 +9,32 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-005";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
+var SECTION = "exception-005";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: ToObjectError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+ToObject_1();
- ToObject_1();
+test();
- test();
+function ToObject_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function ToObject_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- result = foo["bar"];
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "foo[\"bar\"] [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = foo["bar"];
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "foo[\"bar\"] [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-006.js b/mozilla/js/tests/ecma_2/Exceptions/exception-006.js
index 583e976ba65..a3ddaabec63 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-006.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-006.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-006
* ECMA Section:
@@ -8,46 +9,43 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-006";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+var SECTION = "exception-006";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+ToPrimitive_1();
- ToPrimitive_1();
-
- test();
+test();
- /**
- * Getting the [[DefaultValue]] of any instances of MyObject
- * should result in a runtime error in ToPrimitive.
- */
+/**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
- function MyObject() {
- this.toString = void 0;
- this.valueOf = void 0;
- }
+function MyObject() {
+ this.toString = void 0;
+ this.valueOf = void 0;
+}
- function ToPrimitive_1() {
- result = "failed: no exception thrown";
- exception = null;
+function ToPrimitive_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- try {
- result = new MyObject() + new MyObject();
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "new MyObject() + new MyObject() [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-007.js b/mozilla/js/tests/ecma_2/Exceptions/exception-007.js
index e26a40ecae5..b0476a23d83 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-007.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-007.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-007
* ECMA Section:
@@ -8,47 +9,44 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-007";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
- var BUGNUMBER="318250";
+var SECTION = "exception-007";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: TypeError";
+var BUGNUMBER="318250";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DefaultValue_1();
- DefaultValue_1();
-
- test();
+test();
- /**
- * Getting the [[DefaultValue]] of any instances of MyObject
- * should result in a runtime error in ToPrimitive.
- */
+/**
+ * Getting the [[DefaultValue]] of any instances of MyObject
+ * should result in a runtime error in ToPrimitive.
+ */
- function MyObject() {
- this.toString = void 0;
- this.valueOf = new Object();
- }
+function MyObject() {
+ this.toString = void 0;
+ this.valueOf = new Object();
+}
- function DefaultValue_1() {
- result = "failed: no exception thrown";
- exception = null;
+function DefaultValue_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- try {
- result = new MyObject() + new MyObject();
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "new MyObject() + new MyObject() [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = new MyObject() + new MyObject();
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "new MyObject() + new MyObject() [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-008.js b/mozilla/js/tests/ecma_2/Exceptions/exception-008.js
index 797f12566b2..5125738575b 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-008.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-008.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-008
* ECMA Section:
@@ -8,34 +9,31 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-008";
- var VERSION = "js1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+var SECTION = "exception-008";
+var VERSION = "js1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+Syntax_1();
- Syntax_1();
+test();
- test();
+function Syntax_1() {
+ result = "failed: no exception thrown";
+ exception = null;
- function Syntax_1() {
- result = "failed: no exception thrown";
- exception = null;
-
- try {
- result = eval("continue;");
- } catch ( e ) {
- result = "passed: threw exception",
- exception = e.toString();
- } finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "eval(\"continue\") [ exception is " + exception +" ]",
- "passed: threw exception",
- result );
- }
- }
+ try {
+ result = eval("continue;");
+ } catch ( e ) {
+ result = "passed: threw exception",
+ exception = e.toString();
+ } finally {
+ new TestCase(
+ SECTION,
+ "eval(\"continue\") [ exception is " + exception +" ]",
+ "passed: threw exception",
+ result );
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-009.js b/mozilla/js/tests/ecma_2/Exceptions/exception-009.js
index b153532e55b..9591a05edaf 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-009.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-009.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: exception-009
* ECMA Section:
@@ -10,41 +11,38 @@
* Author: christine@netscape.com
* Date: 31 August 1998
*/
- var SECTION = "exception-009";
- var VERSION = "JS1_4";
- var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
- var BUGNUMBER= "312964";
+var SECTION = "exception-009";
+var VERSION = "JS1_4";
+var TITLE = "Tests for JavaScript Standard Exceptions: SyntaxError";
+var BUGNUMBER= "312964";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+try {
+ expect = "passed: no exception thrown";
+ result = expect;
+ Nested_1();
+} catch ( e ) {
+ result = "failed: threw " + e;
+} finally {
+ new TestCase(
+ SECTION,
+ "nested try",
+ expect,
+ result );
+}
+
+test();
+
+function Nested_1() {
+ try {
try {
- expect = "passed: no exception thrown";
- result = expect;
- Nested_1();
- } catch ( e ) {
- result = "failed: threw " + e;
+ } catch (a) {
} finally {
- testcases[tc++] = new TestCase(
- SECTION,
- "nested try",
- expect,
- result );
- }
-
-
- test();
-
- function Nested_1() {
- try {
- try {
- } catch (a) {
- } finally {
- }
- } catch (b) {
- } finally {
- }
}
+ } catch (b) {
+ } finally {
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-010-n.js b/mozilla/js/tests/ecma_2/Exceptions/exception-010-n.js
index fe7cdae8e4a..e3dde58346b 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-010-n.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-010-n.js
@@ -38,15 +38,22 @@
*
* ***** END LICENSE BLOCK ***** */
+var SECTION = "exception-010";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Don't Crash throwing null";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+writeLineToLog("Null throw test.");
+writeLineToLog("BUGNUMBER: 21799");
+
+DESCRIPTION = "throw null";
+EXPECTED = "error";
+
+new TestCase( SECTION, "throw null", "error", eval("throw null" ));
+
test();
-function test()
-{
- print ("Null throw test.");
- print ("BUGNUMBER: 21799");
-
- throw null;
-
- print ("FAILED!: Should have exited with uncaught exception.");
+writeLineToLog("FAILED!: Should have exited with uncaught exception.");
+
-}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/exception-011-n.js b/mozilla/js/tests/ecma_2/Exceptions/exception-011-n.js
index f1fd34635e7..7138427ba95 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/exception-011-n.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/exception-011-n.js
@@ -38,14 +38,23 @@
*
* ***** END LICENSE BLOCK ***** */
+var SECTION = "exception-011";
+var VERSION = "ECMA_2";
+startTest();
+var TITLE = "Don't Crash throwing undefined";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+writeLineToLog("Undefined throw test.");
+
+DESCRIPTION = "throw undefined";
+EXPECTED = "error";
+
+new TestCase( SECTION, "throw undefined", "error", eval("throw (void 0)") );
+
test();
-function test()
-{
- print ("Undefined throw test.");
-
- throw (void 0);
-
- print ("FAILED!: Should have exited with uncaught exception.");
+writeLineToLog("FAILED!: Should have exited with uncaught exception.");
+
+
-}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-001.js b/mozilla/js/tests/ecma_2/Exceptions/expression-001.js
index b1baf6f15d7..81872ead52d 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-001.js
@@ -1,47 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-001.js
- Corresponds to: ecma/Expressions/11.12-2-n.js
- ECMA Section: 11.12
- Description:
+ File Name: expression-001.js
+ Corresponds to: ecma/Expressions/11.12-2-n.js
+ ECMA Section: 11.12
+ Description:
- The grammar for a ConditionalExpression in ECMAScript is a little bit
- different from that in C and Java, which each allow the second
- subexpression to be an Expression but restrict the third expression to
- be a ConditionalExpression. The motivation for this difference in
- ECMAScript is to allow an assignment expression to be governed by either
- arm of a conditional and to eliminate the confusing and fairly useless
- case of a comma expression as the center expression.
+ The grammar for a ConditionalExpression in ECMAScript is a little bit
+ different from that in C and Java, which each allow the second
+ subexpression to be an Expression but restrict the third expression to
+ be a ConditionalExpression. The motivation for this difference in
+ ECMAScript is to allow an assignment expression to be governed by either
+ arm of a conditional and to eliminate the confusing and fairly useless
+ case of a comma expression as the center expression.
- Author: christine@netscape.com
- Date: 09 september 1998
+ Author: christine@netscape.com
+ Date: 09 september 1998
*/
- var SECTION = "expression-001";
- var VERSION = "JS1_4";
- var TITLE = "Conditional operator ( ? : )"
- startTest();
- writeHeaderToLog( SECTION + " " + TITLE );
+var SECTION = "expression-001";
+var VERSION = "JS1_4";
+var TITLE = "Conditional operator ( ? : )"
+startTest();
+writeHeaderToLog( SECTION + " " + TITLE );
- var tc = 0;
- var testcases = new Array();
+// the following expression should be an error in JS.
- // the following expression should be an error in JS.
+var result = "Failed"
+var exception = "No exception was thrown";
- var result = "Failed"
- var exception = "No exception was thrown";
+try {
+ eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\"");
+} catch ( e ) {
+ result = "Passed";
+ exception = e.toString();
+}
- try {
- eval("var MY_VAR = true ? \"EXPR1\", \"EXPR2\" : \"EXPR3\"");
- } catch ( e ) {
- result = "Passed";
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "comma expression in a conditional statement "+
- "(threw "+ exception +")",
- "Passed",
- result );
+new TestCase(
+ SECTION,
+ "comma expression in a conditional statement "+
+ "(threw "+ exception +")",
+ "Passed",
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-002.js b/mozilla/js/tests/ecma_2/Exceptions/expression-002.js
index 1a73ebec01d..53799878860 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-002.js
@@ -1,57 +1,55 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expressions-002.js
- Corresponds to: ecma/Expressions/11.2.1-3-n.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: expressions-002.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Try to access properties of an object whose value is undefined.
+ Try to access properties of an object whose value is undefined.
- Author: christine@netscape.com
- Date: 09 september 1998
+ Author: christine@netscape.com
+ Date: 09 september 1998
*/
- var SECTION = "expressions-002.js";
- var VERSION = "JS1_4";
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "expressions-002.js";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- startTest();
+startTest();
- var tc = 0;
- var testcases = new Array();
+// go through all Native Function objects, methods, and properties and get their typeof.
- // go through all Native Function objects, methods, and properties and get their typeof.
+var PROPERTY = new Array();
+var p = 0;
- var PROPERTY = new Array();
- var p = 0;
+// try to access properties of primitive types
- // try to access properties of primitive types
+OBJECT = new Property( "undefined", void 0, "undefined", NaN );
- OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
-
- try {
- result = OBJECT.value.valueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ result = OBJECT.value.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "Get the value of an object whose value is undefined "+
- "(threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "Get the value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
- test();
+test();
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.valueOf = value;
-}
\ No newline at end of file
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.valueOf = value;
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-003.js b/mozilla/js/tests/ecma_2/Exceptions/expression-003.js
index 30b536912ac..0dc7d7f868e 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-003.js
@@ -1,52 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expressions-003.js
- Corresponds to: ecma/Expressions/11.2.1-3-n.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: expressions-003.js
+ Corresponds to: ecma/Expressions/11.2.1-3-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Try to access properties of an object whose value is undefined.
+ Try to access properties of an object whose value is undefined.
- Author: christine@netscape.com
- Date: 09 september 1998
+ Author: christine@netscape.com
+ Date: 09 september 1998
*/
- var SECTION = "expressions-003.js";
- var VERSION = "JS1_4";
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
+var SECTION = "expressions-003.js";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
- startTest();
+startTest();
- var tc = 0;
- var testcases = new Array();
+// try to access properties of primitive types
- // try to access properties of primitive types
+OBJECT = new Property( "undefined", void 0, "undefined", NaN );
- OBJECT = new Property( "undefined", void 0, "undefined", NaN );
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
-
- try {
- result = OBJECT.value.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ result = OBJECT.value.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "Get the toString value of an object whose value is undefined "+
- "(threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is undefined "+
+ "(threw " + exception +")",
+ expect,
+ result );
- test();
+test();
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.value = value;
-}
\ No newline at end of file
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-004.js b/mozilla/js/tests/ecma_2/Exceptions/expression-004.js
index 0ce3864b11c..5db826783cb 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-004.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-004.js
@@ -1,46 +1,44 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-004.js
- Corresponds To: 11.2.1-4-n.js
- ECMA Section: 11.2.1 Property Accessors
- Description:
+ File Name: expression-004.js
+ Corresponds To: 11.2.1-4-n.js
+ ECMA Section: 11.2.1 Property Accessors
+ Description:
- Author: christine@netscape.com
- Date: 09 september 1998
+ Author: christine@netscape.com
+ Date: 09 september 1998
*/
- var SECTION = "expression-004";
- var VERSION = "JS1_4";
- var TITLE = "Property Accessors";
- writeHeaderToLog( SECTION + " "+TITLE );
- startTest();
+var SECTION = "expression-004";
+var VERSION = "JS1_4";
+var TITLE = "Property Accessors";
+writeHeaderToLog( SECTION + " "+TITLE );
+startTest();
- var tc = 0;
- var testcases = new Array();
+var OBJECT = new Property( "null", null, "null", 0 );
- var OBJECT = new Property( "null", null, "null", 0 );
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = OBJECT.value.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = OBJECT.value.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "Get the toString value of an object whose value is null "+
+ "(threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "Get the toString value of an object whose value is null "+
- "(threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function Property( object, value, string, number ) {
- this.object = object;
- this.string = String(value);
- this.number = Number(value);
- this.value = value;
+ this.object = object;
+ this.string = String(value);
+ this.number = Number(value);
+ this.value = value;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-005.js b/mozilla/js/tests/ecma_2/Exceptions/expression-005.js
index df6914493bc..8d783eac622 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-005.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-005.js
@@ -1,38 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-005.js
- Corresponds To: 11.2.2-10-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: expression-005.js
+ Corresponds To: 11.2.2-10-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-005";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-005";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var expect = "Passed";
+var exception = "No exception thrown";
- var result = "Failed";
- var expect = "Passed";
- var exception = "No exception thrown";
+try {
+ result = new Math();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new Math();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "result= new Math() (threw " + exception + ")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "result= new Math() (threw " + exception + ")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-006.js b/mozilla/js/tests/ecma_2/Exceptions/expression-006.js
index 1bf0798a160..6cdbaefc9be 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-006.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-006.js
@@ -1,43 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-006.js
- Corresponds to: 11.2.2-1-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: expression-006.js
+ Corresponds to: 11.2.2-1-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- http://scopus/bugsplat/show_bug.cgi?id=327765
+ http://scopus/bugsplat/show_bug.cgi?id=327765
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-006.js";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
- var BUGNUMBER="327765";
+var SECTION = "expression-006.js";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER="327765";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var OBJECT = new Object();
+ result = new OBJECT();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var OBJECT = new Object();
- result = new OBJECT();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJECT = new Object; result = new OBJECT()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-007.js b/mozilla/js/tests/ecma_2/Exceptions/expression-007.js
index 988109b652b..02d199417a3 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-007.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-007.js
@@ -1,41 +1,39 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-007.js
- Corresponds To: 11.2.2-2-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: expression-007.js
+ Corresponds To: 11.2.2-2-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-007";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-007";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ UNDEFINED = void 0;
+ result = new UNDEFINED();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- UNDEFINED = void 0;
- result = new UNDEFINED();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "UNDEFINED = void 0; result = new UNDEFINED()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "UNDEFINED = void 0; result = new UNDEFINED()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-008.js b/mozilla/js/tests/ecma_2/Exceptions/expression-008.js
index caa891254c7..cf1385b694e 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-008.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-008.js
@@ -1,38 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-008
- Corresponds To: 11.2.2-3-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-008
+ Corresponds To: 11.2.2-3-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-008";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-008";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var NULL = null;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var NULL = null;
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = new NULL();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new NULL();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "NULL = null; result = new NULL()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "NULL = null; result = new NULL()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-009.js b/mozilla/js/tests/ecma_2/Exceptions/expression-009.js
index 2aa63b6a6d5..870dcb80857 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-009.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-009.js
@@ -1,39 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-009
- Corresponds to: ecma/Expressions/11.2.2-4-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-009
+ Corresponds to: ecma/Expressions/11.2.2-4-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-009";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-009";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var STRING = "";
- var STRING = "";
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new STRING();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "STRING = ''; result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "STRING = ''; result = new STRING()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-010.js b/mozilla/js/tests/ecma_2/Exceptions/expression-010.js
index bb21aba2626..19da1a601b2 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-010.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-010.js
@@ -1,40 +1,38 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-010.js
- Corresponds To: 11.2.2-5-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-010.js
+ Corresponds To: 11.2.2-5-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-010";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-010";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var NUMBER = 0;
- var NUMBER = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = new NUMBER();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new NUMBER();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "NUMBER=0, result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "NUMBER=0, result = new NUMBER()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-011.js b/mozilla/js/tests/ecma_2/Exceptions/expression-011.js
index 71c601a3b46..bcbcf78077a 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-011.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-011.js
@@ -1,40 +1,38 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-011.js
- Corresponds To: ecma/Expressions/11.2.2-6-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-011.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-011";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
+var SECTION = "expression-011";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var BOOLEAN = true;
- var BOOLEAN = true;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var OBJECT = new BOOLEAN();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var OBJECT = new BOOLEAN();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "BOOLEAN = true; result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "BOOLEAN = true; result = new BOOLEAN()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-012.js b/mozilla/js/tests/ecma_2/Exceptions/expression-012.js
index 31eb0996bbd..63b67100615 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-012.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-012.js
@@ -1,41 +1,39 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-012.js
- Corresponds To: ecma/Expressions/11.2.2-6-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- http://scopus/bugsplat/show_bug.cgi?id=327765
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-012.js
+ Corresponds To: ecma/Expressions/11.2.2-6-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ http://scopus/bugsplat/show_bug.cgi?id=327765
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-012";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
- var BUGNUMBER= "327765";
+var SECTION = "expression-012";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var STRING = new String("hi");
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var STRING = new String("hi");
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new STRING();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "STRING = new String(\"hi\"); result = new STRING()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "STRING = new String(\"hi\"); result = new STRING()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-013.js b/mozilla/js/tests/ecma_2/Exceptions/expression-013.js
index cc75a7747c5..60fedb25272 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-013.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-013.js
@@ -1,41 +1,39 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-013.js
- Corresponds To: ecma/Expressions/11.2.2-8-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-013.js
+ Corresponds To: ecma/Expressions/11.2.2-8-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-013";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
- var BUGNUMBER= "327765";
+var SECTION = "expression-013";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var NUMBER = new Number(1);
- var NUMBER = new Number(1);
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = new NUMBER();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = new NUMBER();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "NUMBER = new Number(1); result = new NUMBER()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "NUMBER = new Number(1); result = new NUMBER()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-014.js b/mozilla/js/tests/ecma_2/Exceptions/expression-014.js
index 4a09cd140a4..5475cde2978 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-014.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-014.js
@@ -1,43 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-014.js
- Corresponds To: ecma/Expressions/11.2.2-9-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: expression-014.js
+ Corresponds To: ecma/Expressions/11.2.2-9-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-014.js";
- var VERSION = "ECMA_1";
- var TITLE = "The new operator";
- var BUGNUMBER= "327765";
+var SECTION = "expression-014.js";
+var VERSION = "ECMA_1";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- var BOOLEAN = new Boolean();
+var BOOLEAN = new Boolean();
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- try {
- result = new BOOLEAN();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ result = new BOOLEAN();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "BOOLEAN = new Boolean(); result = new BOOLEAN()" +
- " (threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "BOOLEAN = new Boolean(); result = new BOOLEAN()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-015.js b/mozilla/js/tests/ecma_2/Exceptions/expression-015.js
index 09577fc1b0a..b04d6641177 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-015.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-015.js
@@ -1,37 +1,35 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-015.js
- Corresponds To: ecma/Expressions/11.2.3-2-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-015.js
+ Corresponds To: ecma/Expressions/11.2.3-2-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-015";
- var VERSION = "JS1_4";
- var TITLE = "Function Calls";
+var SECTION = "expression-015";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("result = 3.valueOf();");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("result = 3.valueOf();");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "3.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "3.valueOf()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-016.js b/mozilla/js/tests/ecma_2/Exceptions/expression-016.js
index 4a551106a7e..ccbc987657c 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-016.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-016.js
@@ -1,37 +1,35 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-016.js
- Corresponds To: ecma/Expressions/11.2.3-3-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-016.js
+ Corresponds To: ecma/Expressions/11.2.3-3-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-016";
- var VERSION = "JS1_4";
- var TITLE = "Function Calls";
+var SECTION = "expression-016";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = (void 0).valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = (void 0).valueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "(void 0).valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "(void 0).valueOf()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-017.js b/mozilla/js/tests/ecma_2/Exceptions/expression-017.js
index 949cf3f5734..8c73d872564 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-017.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-017.js
@@ -1,37 +1,35 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-07.js
- Corresponds To: ecma/Expressions/11.2.3-4-n.js
- ECMA Section: 11.2.3. Function Calls
- Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ File Name: expression-07.js
+ Corresponds To: ecma/Expressions/11.2.3-4-n.js
+ ECMA Section: 11.2.3. Function Calls
+ Description:
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-017";
- var VERSION = "JS1_4";
- var TITLE = "Function Calls";
+var SECTION = "expression-017";
+var VERSION = "JS1_4";
+var TITLE = "Function Calls";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = nullvalueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- result = nullvalueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "null.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "null.valueOf()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/expression-019.js b/mozilla/js/tests/ecma_2/Exceptions/expression-019.js
index 0ef02cb609e..ae8c7ca27b2 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/expression-019.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/expression-019.js
@@ -1,41 +1,39 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: expression-019.js
- Corresponds To: 11.2.2-7-n.js
- ECMA Section: 11.2.2. The new operator
- Description:
+ File Name: expression-019.js
+ Corresponds To: 11.2.2-7-n.js
+ ECMA Section: 11.2.2. The new operator
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "expression-019";
- var VERSION = "JS1_4";
- var TITLE = "The new operator";
- var BUGNUMBER= "327765";
+var SECTION = "expression-019";
+var VERSION = "JS1_4";
+var TITLE = "The new operator";
+var BUGNUMBER= "327765";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var STRING = new String("hi");
+ result = new STRING();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var STRING = new String("hi");
- result = new STRING();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var STRING = new String(\"hi\"); result = new STRING();" +
+ " (threw " + exception + ")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var STRING = new String(\"hi\"); result = new STRING();" +
- " (threw " + exception + ")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/function-001.js b/mozilla/js/tests/ecma_2/Exceptions/function-001.js
index 3cbd19e6e16..f901d18d366 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/function-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/function-001.js
@@ -27,9 +27,6 @@
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
var result = "fail";
var exception = "no exception thrown";
@@ -40,7 +37,7 @@
exception = e.toString();
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"eval(\"function f(){}function g(){}\") (threw "+exception,
"pass",
@@ -48,17 +45,3 @@
test();
-
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/global-001.js b/mozilla/js/tests/ecma_2/Exceptions/global-001.js
index 3b1bd98f0df..a512d6aed35 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/global-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/global-001.js
@@ -1,43 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: global-001
- Corresponds To: ecma/GlobalObject/15.1-1-n.js
- ECMA Section: The global object
- Description:
+ File Name: global-001
+ Corresponds To: ecma/GlobalObject/15.1-1-n.js
+ ECMA Section: The global object
+ Description:
- The global object does not have a [[Construct]] property; it is not
- possible to use the global object as a constructor with the new operator.
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "global-001";
- var VERSION = "ECMA_1";
- var TITLE = "The Global Object";
+var SECTION = "global-001";
+var VERSION = "ECMA_1";
+var TITLE = "The Global Object";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+try {
+ result = new this();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+new TestCase(
+ SECTION,
+ "result = new this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- try {
- result = new this();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "result = new this()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/global-002.js b/mozilla/js/tests/ecma_2/Exceptions/global-002.js
index 2453c295b19..efc40b48cfe 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/global-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/global-002.js
@@ -1,43 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: global-002
- Corresponds To: ecma/GlobalObject/15.1-2-n.js
- ECMA Section: The global object
- Description:
+ File Name: global-002
+ Corresponds To: ecma/GlobalObject/15.1-2-n.js
+ ECMA Section: The global object
+ Description:
- The global object does not have a [[Construct]] property; it is not
- possible to use the global object as a constructor with the new operator.
+ The global object does not have a [[Construct]] property; it is not
+ possible to use the global object as a constructor with the new operator.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "global-002";
- var VERSION = "JS1_4";
- var TITLE = "The Global Object";
+var SECTION = "global-002";
+var VERSION = "JS1_4";
+var TITLE = "The Global Object";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+try {
+ result = this();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+new TestCase(
+ SECTION,
+ "result = this()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- try {
- result = this();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "result = this()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-001.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-001.js
index 528a57347f9..c21ae5fc0c6 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-001.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-001.js
- CorrespondsTo: ecma/LexicalConventions/7.2.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: lexical-001.js
+ CorrespondsTo: ecma/LexicalConventions/7.2.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-001";
- var VERSION = "JS1_4";
- var TITLE = "Line Terminators";
+var SECTION = "lexical-001";
+var VERSION = "JS1_4";
+var TITLE = "Line Terminators";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = eval("\r\n\expect");
+} catch ( e ) {
+ exception = e.toString();
+}
- try {
- result = eval("\r\n\expect");
- } catch ( e ) {
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; result = new OBJECT()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJECT = new Object; result = new OBJECT()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-002.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-002.js
index b1521c2a44d..7a03faa90af 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-002.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-002.js
- Corresponds To: ecma/LexicalConventions/7.2-3-n.js
- ECMA Section: 7.2 Line Terminators
- Description: - readability
- - separate tokens
- - may occur between any two tokens
- - cannot occur within any token, not even a string
- - affect the process of automatic semicolon insertion.
+ File Name: lexical-002.js
+ Corresponds To: ecma/LexicalConventions/7.2-3-n.js
+ ECMA Section: 7.2 Line Terminators
+ Description: - readability
+ - separate tokens
+ - may occur between any two tokens
+ - cannot occur within any token, not even a string
+ - affect the process of automatic semicolon insertion.
- white space characters are:
- unicode name formal name string representation
- \u000A line feed \n
- \u000D carriage return \r
+ white space characters are:
+ unicode name formal name string representation
+ \u000A line feed \n
+ \u000D carriage return \r
- this test uses onerror to capture line numbers. because
- we use on error, we can only have one test case per file.
+ this test uses onerror to capture line numbers. because
+ we use on error, we can only have one test case per file.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-002";
- var VERSION = "JS1_4";
- var TITLE = "Line Terminators";
+var SECTION = "lexical-002";
+var VERSION = "JS1_4";
+var TITLE = "Line Terminators";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ result = eval("\r\n\expect");
+} catch ( e ) {
+ exception = e.toString();
+}
- try {
- result = eval("\r\n\expect");
- } catch ( e ) {
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "result=eval(\"\r\nexpect\")" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "result=eval(\"\r\nexpect\")" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-003.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-003.js
index a622d12bf81..b095dfbf658 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-003.js
@@ -1,41 +1,38 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-003.js
- Corresponds To: 7.3-13-n.js
- ECMA Section: 7.3 Comments
- Description:
+ File Name: lexical-003.js
+ Corresponds To: 7.3-13-n.js
+ ECMA Section: 7.3 Comments
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-003.js";
- var VERSION = "JS1_4";
- var TITLE = "Comments";
+var SECTION = "lexical-003.js";
+var VERSION = "JS1_4";
+var TITLE = "Comments";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+try {
+ eval("/*\n/* nested comment */\n*/\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+new TestCase(
+ SECTION,
+ "/*/*nested comment*/ */" +
+ " (threw " + exception +")",
+ expect,
+ result );
- try {
- eval("/*\n/* nested comment */\n*/\n");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "/*/*nested comment*/ */" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-004.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-004.js
index 64758385b2c..9a3d8a729aa 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-004.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-004.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-004.js
- Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js
- ECMA Section: 7.4.1
+ File Name: lexical-004.js
+ Corresponds To: ecma/LexicalExpressions/7.4.1-1-n.js
+ ECMA Section: 7.4.1
- Description:
+ Description:
- Reserved words cannot be used as identifiers.
+ Reserved words cannot be used as identifiers.
- ReservedWord ::
- Keyword
- FutureReservedWord
- NullLiteral
- BooleanLiteral
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-004";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-004";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var null = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var null = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var null = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var null = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-005.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-005.js
index a9cdd6b12e6..a74f189b724 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-005.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-005.js
@@ -1,50 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-005.js
- Corresponds To: 7.4.1-2.js
- ECMA Section: 7.4.1
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-2.js
+ ECMA Section: 7.4.1
- Description:
+ Description:
- Reserved words cannot be used as identifiers.
+ Reserved words cannot be used as identifiers.
- ReservedWord ::
- Keyword
- FutureReservedWord
- NullLiteral
- BooleanLiteral
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-005";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-005";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+try {
+ eval("true = false;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+new TestCase(
+ SECTION,
+ "true = false" +
+ " (threw " + exception +")",
+ expect,
+ result );
- try {
- eval("true = false;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "true = false" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-006.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-006.js
index 89c45f3b475..96195e2f442 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-006.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-006.js
@@ -1,55 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-006.js
- Corresponds To: 7.4.2-1.js
- ECMA Section: 7.4.2
+ File Name: lexical-006.js
+ Corresponds To: 7.4.2-1.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-006";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-006";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("break = new Object();");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("break = new Object();");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "break = new Object()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "break = new Object()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-007.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-007.js
index d34afe4bee6..0e798d390a9 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-007.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-007.js
@@ -1,48 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-005.js
- Corresponds To: 7.4.1-3-n.js
- ECMA Section: 7.4.1
+ File Name: lexical-005.js
+ Corresponds To: 7.4.1-3-n.js
+ ECMA Section: 7.4.1
- Description:
+ Description:
- Reserved words cannot be used as identifiers.
+ Reserved words cannot be used as identifiers.
- ReservedWord ::
- Keyword
- FutureReservedWord
- NullLiteral
- BooleanLiteral
+ ReservedWord ::
+ Keyword
+ FutureReservedWord
+ NullLiteral
+ BooleanLiteral
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-005";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-005";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("false = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("false = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "false = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "false = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-008.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-008.js
index f819eaee1a6..871c0b0afd3 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-008.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-008.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-008.js
- Corresponds To: 7.4.3-1-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-008.js
+ Corresponds To: 7.4.3-1-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-008.js";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-008.js";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("case = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("case = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "case = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "case = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-009.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-009.js
index 39fc71ab3c0..134500213ea 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-009.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-009.js
@@ -1,49 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-009
- Corresponds To: 7.4.3-2-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-009
+ Corresponds To: 7.4.3-2-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-009";
- var VERSION = "ECMA_1";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-009";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- try {
- eval("debugger = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ eval("debugger = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "debugger = true" +
- " (threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "debugger = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-010.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-010.js
index 9e9f6648dbb..c2a7fa1882a 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-010.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-010.js
@@ -1,48 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-010.js
- Corresponds To: 7.4.3-3-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-010.js
+ Corresponds To: 7.4.3-3-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-010";
- var VERSION = "ECMA_1";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-010";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("export = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("export = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "export = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "export = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-012.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-012.js
index e4579fd95c6..acdffabb5d1 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-012.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-012.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-012.js
- Corresponds To: 7.4.3-5-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-012.js
+ Corresponds To: 7.4.3-5-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-012";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-012";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("catch = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("catch = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "catch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "catch = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-013.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-013.js
index 699d06a9f9c..ea0f4249726 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-013.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-013.js
@@ -1,49 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-013.js
- Corresponds To: 7.4.3-6-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-013.js
+ Corresponds To: 7.4.3-6-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-013";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-013";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- try {
- eval("default = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ eval("default = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "default = true" +
- " (threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "default = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-015.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-015.js
index 7cbcc049f6a..e2b3b6172f5 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-015.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-015.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-015.js
- Corresponds To: 7.4.3-8-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-015.js
+ Corresponds To: 7.4.3-8-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-015";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-015";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("switch = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("switch = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "switch = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "switch = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-017.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-017.js
index 96849b76994..feca34768d4 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-017.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-017.js
@@ -1,50 +1,49 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-017.js
- Corresponds To: 7.4.3-10-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-017.js
+ Corresponds To: 7.4.3-10-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-017";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-017";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- try {
- eval("do = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+try {
+ eval("do = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "do = true" +
- " (threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "do = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-018.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-018.js
index 5d46c5f289e..6a6881eba89 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-018.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-018.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-018
- Corresponds To: 7.4.3-11-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-018
+ Corresponds To: 7.4.3-11-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-018";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-018";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("finally = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("finally = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "finally = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "finally = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-019.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-019.js
index 9f01fc0adf3..9fb10223a90 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-019.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-019.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-019.js
- Corresponds To: 7.4.3-12-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-019.js
+ Corresponds To: 7.4.3-12-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-019";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-019";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("throw = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("throw = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "throw = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "throw = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-020.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-020.js
index 362a3d572e5..cd2e508d105 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-020.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-020.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-020.js
- Corresponds To 7.4.3-13-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-020.js
+ Corresponds To 7.4.3-13-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-020";
- var VERSION = "JS1_4";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-020";
+var VERSION = "JS1_4";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("const = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("const = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "const = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "const = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-022.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-022.js
index 54f256a60dd..67f7a6db2ef 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-022.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-022.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-022
- Corresponds To 7.4.3-15-n.js
- ECMA Section: 7.4.3
+ File Name: lexical-022
+ Corresponds To 7.4.3-15-n.js
+ ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-022.js";
- var VERSION = "ECMA_1";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-022.js";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("import = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("import = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "import = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "import = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-023.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-023.js
index 0715a3d3923..ddb015704a0 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-023.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-023.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-023.js
- Corresponds To: 7.4.3-16-n.js
- ECMA Section: 7.4.3
- Description:
- The following words are used as keywords in proposed extensions and are
- therefore reserved to allow for the possibility of future adoption of
- those extensions.
+ File Name: lexical-023.js
+ Corresponds To: 7.4.3-16-n.js
+ ECMA Section: 7.4.3
+ Description:
+ The following words are used as keywords in proposed extensions and are
+ therefore reserved to allow for the possibility of future adoption of
+ those extensions.
- FutureReservedWord :: one of
- case debugger export super
- catch default extends switch
- class do finally throw
- const enum import try
+ FutureReservedWord :: one of
+ case debugger export super
+ catch default extends switch
+ class do finally throw
+ const enum import try
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-023.js";
- var VERSION = "ECMA_1";
- var TITLE = "Future Reserved Words";
+var SECTION = "lexical-023.js";
+var VERSION = "ECMA_1";
+var TITLE = "Future Reserved Words";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("try = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("try = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "try = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "try = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-024.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-024.js
index d7317914e13..0fb9b5e728f 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-024.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-024.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-024
- Corresponds To: 7.4.2-1-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-024
+ Corresponds To: 7.4.2-1-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-024";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-024";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var break;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var break;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var break" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var break" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-025.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-025.js
index 16a44d60e27..883e6f97a36 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-025.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-025.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-025.js
- Corresponds To 7.4.2-2-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-025.js
+ Corresponds To 7.4.2-2-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-025";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-025";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var for;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var for;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var for" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var for" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-026.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-026.js
index 73aea73f0d5..9f7afe44ec4 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-026.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-026.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-026.js
- Corresponds To: 7.4.2-3-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-026.js
+ Corresponds To: 7.4.2-3-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-026";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-026";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var new;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var new;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var new" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var new" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-027.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-027.js
index b8f8593055d..9666bc111cf 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-027.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-027.js
@@ -1,58 +1,56 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-027.js
- Corresponds To: 7.4.2-4-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-027.js
+ Corresponds To: 7.4.2-4-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- var
+ var
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-027";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-027";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var var;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var var;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var var" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var var" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-028.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-028.js
index a985527def1..8dc5104febd 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-028.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-028.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-028.js
- Corresponds To: 7.4.2-5-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-028.js
+ Corresponds To: 7.4.2-5-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-028";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-028";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var continue=true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var continue=true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var continue=true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var continue=true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-029.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-029.js
index 0b38cbeb5e7..886e04308b4 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-029.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-029.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-029.js
- Corresponds To: 7.4.2-6.js
- ECMA Section: 7.4.2
+ File Name: lexical-029.js
+ Corresponds To: 7.4.2-6.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-029";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-029";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var function = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var function = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var function = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var function = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-030.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-030.js
index bc854724f2f..e6f1431a11a 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-030.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-030.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-030.js
- Corresponds To: 7.4.2-7-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-030.js
+ Corresponds To: 7.4.2-7-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-030";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-030";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var return = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var return = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var return = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var return = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-031.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-031.js
index d2251ba854d..a77c0a795b8 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-031.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-031.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-031.js
- Corresponds To: 7.4.2-8-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-031.js
+ Corresponds To: 7.4.2-8-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-031";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-031";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var return;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var return;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var return" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var return" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-032.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-032.js
index 5ac71cbddcf..c6d883ea67f 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-032.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-032.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-032.js
- Corresponds To: 7.4.2-9-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-032.js
+ Corresponds To: 7.4.2-9-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-032";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-032";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("delete = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("delete = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "delete = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "delete = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-033.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-033.js
index 2a357fe0f5b..5e0af78c653 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-033.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-033.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-033.js
- Corresponds To: 7.4.2-10.js
- ECMA Section: 7.4.2
+ File Name: lexical-033.js
+ Corresponds To: 7.4.2-10.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-033";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-033";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("if = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("if = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "if = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "if = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-034.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-034.js
index d6c03a24364..e423a33e4c2 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-034.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-034.js
@@ -1,55 +1,53 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: 7.4.2-11-n.js
- ECMA Section: 7.4.2
+ File Name: 7.4.2-11-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-034";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-034";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("this = true");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("this = true");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "this = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "this = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-035.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-035.js
index f5fca592fbf..41ebc85e762 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-035.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-035.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-035.js
- Correpsonds To: 7.4.2-12-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-035.js
+ Correpsonds To: 7.4.2-12-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-035";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-035";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var while");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var while");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var while" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var while" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-036.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-036.js
index 3512c9b721a..c2849480a59 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-036.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-036.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-036.js
- Corresponds To: 7.4.2-13-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-036.js
+ Corresponds To: 7.4.2-13-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-036";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-036";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("else = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("else = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "else = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "else = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-037.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-037.js
index 641c9de4776..8cb9b531148 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-037.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-037.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-037.js
- Corresponds To: 7.4.2-14-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-037.js
+ Corresponds To: 7.4.2-14-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-028";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-028";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var in;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var in;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var in" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var in" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-038.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-038.js
index f44b6b3cf67..b5c322eaef1 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-038.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-038.js
@@ -1,56 +1,54 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-038.js
- Corresponds To: 7.4.2-15-n.js
- ECMA Section: 7.4.2
+ File Name: lexical-038.js
+ Corresponds To: 7.4.2-15-n.js
+ ECMA Section: 7.4.2
- Description:
- The following tokens are ECMAScript keywords and may not be used as
- identifiers in ECMAScript programs.
+ Description:
+ The following tokens are ECMAScript keywords and may not be used as
+ identifiers in ECMAScript programs.
- Syntax
+ Syntax
- Keyword :: one of
- break for new var
- continue function return void
- delete if this while
- else in typeof with
+ Keyword :: one of
+ break for new var
+ continue function return void
+ delete if this while
+ else in typeof with
- This test verifies that the keyword cannot be used as an identifier.
- Functioinal tests of the keyword may be found in the section corresponding
- to the function of the keyword.
+ This test verifies that the keyword cannot be used as an identifier.
+ Functioinal tests of the keyword may be found in the section corresponding
+ to the function of the keyword.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "lexical-038";
- var VERSION = "JS1_4";
- var TITLE = "Keywords";
+var SECTION = "lexical-038";
+var VERSION = "JS1_4";
+var TITLE = "Keywords";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("typeof = true;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("typeof = true;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "typeof = true" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "typeof = true" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-039.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-039.js
index e40b21b9a1f..5fb3fe4d284 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-039.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-039.js
@@ -1,43 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-039
- Corresponds To: 7.5-2-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: lexical-039
+ Corresponds To: 7.5-2-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-039";
- var VERSION = "JS1_4";
- var TITLE = "Identifiers";
+var SECTION = "lexical-039";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var 0abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var 0abc;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var 0abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var 0abc" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-040.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-040.js
index fb306c1d0ff..6fc4c39b3b4 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-040.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-040.js
@@ -1,43 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-040.js
- Corresponds To: 7.5-2.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: lexical-040.js
+ Corresponds To: 7.5-2.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-040";
- var VERSION = "JS1_4";
- var TITLE = "Identifiers";
+var SECTION = "lexical-040";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var 1abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var 1abc;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var 1abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var 1abc" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-041.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-041.js
index da830f8e220..9fa35b346d9 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-041.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-041.js
@@ -1,45 +1,43 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-041.js
- Corresponds To: 7.5-8-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: lexical-041.js
+ Corresponds To: 7.5-8-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-041";
- var VERSION = "ECMA_1";
- var TITLE = "Identifiers";
+var SECTION = "lexical-041";
+var VERSION = "ECMA_1";
+var TITLE = "Identifiers";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var @abc;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var @abc;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var @abc" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var @abc" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-042.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-042.js
index 88ee50951cf..5e032807e88 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-042.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-042.js
@@ -1,46 +1,44 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-042.js
- Corresponds To: 7.5-9-n.js
- ECMA Section: 7.5 Identifiers
- Description: Identifiers are of unlimited length
- - can contain letters, a decimal digit, _, or $
- - the first character cannot be a decimal digit
- - identifiers are case sensitive
+ File Name: lexical-042.js
+ Corresponds To: 7.5-9-n.js
+ ECMA Section: 7.5 Identifiers
+ Description: Identifiers are of unlimited length
+ - can contain letters, a decimal digit, _, or $
+ - the first character cannot be a decimal digit
+ - identifiers are case sensitive
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "lexical-042";
- var VERSION = "JS1_4";
- var TITLE = "Identifiers";
+var SECTION = "lexical-042";
+var VERSION = "JS1_4";
+var TITLE = "Identifiers";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("var 123;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("var 123;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "var 123" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "var 123" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-047.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-047.js
index b5e35489b8a..6437e4f0dde 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-047.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-047.js
@@ -1,47 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-047.js
- Corresponds To: 7.8.1-7-n.js
- ECMA Section: 7.8.1
- Description:
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-047.js
+ Corresponds To: 7.8.1-7-n.js
+ ECMA Section: 7.8.1
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-047";
- var VERSION = "JS1_4";
- var TITLE = "for loops";
+var SECTION = "lexical-047";
+var VERSION = "JS1_4";
+var TITLE = "for loops";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got to inner loop\";\n"
+ + "}\n");
- try {
- var counter = 0;
- eval("for ( counter = 0\n"
- + "counter <= 1\n"
- + "counter++ )\n"
- + "{\n"
- + "result += \": got to inner loop\";\n"
- + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "line breaks within a for expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-048.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-048.js
index 39a0600ad85..e0766ec62a5 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-048.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-048.js
@@ -1,41 +1,39 @@
- /**
- File Name: lexical-048.js
- Corresponds To: 7.8.1-1.js
- ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion
- Description:
- Author: christine@netscape.com
- Date: 15 september 1997
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/**
+ File Name: lexical-048.js
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertion
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-048";
- var VERSION = "JS1_4";
- var TITLE = "The Rules of Automatic Semicolon Insertion";
+var SECTION = "lexical-048";
+var VERSION = "JS1_4";
+var TITLE = "The Rules of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var counter = 0;
+ eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var counter = 0;
- eval( "for ( counter = 0;\ncounter <= 1\ncounter++ ) {\nresult += \": got inside for loop\")");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "line breaks within a for expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-049.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-049.js
index e03cfec0e40..e302a33996b 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-049.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-049.js
@@ -1,46 +1,44 @@
- /**
- File Name: lexical-049
- Corresponds To: 7.8.1-1.js
- ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin
- Description:
- Author: christine@netscape.com
- Date: 15 september 1997
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/**
+ File Name: lexical-049
+ Corresponds To: 7.8.1-1.js
+ ECMA Section: 7.8.1 Rules of Automatic Semicolon Insertioin
+ Description:
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-049";
- var VERSION = "JS1_4";
- var TITLE = "The Rules of Automatic Semicolon Insertion";
+var SECTION = "lexical-049";
+var VERSION = "JS1_4";
+var TITLE = "The Rules of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var counter = 0;
+ eval("for ( counter = 0\n"
+ + "counter <= 1;\n"
+ + "counter++ )\n"
+ + "{\n"
+ + "result += \": got inside for loop\";\n"
+ + "}\n");
- try {
- var counter = 0;
- eval("for ( counter = 0\n"
- + "counter <= 1;\n"
- + "counter++ )\n"
- + "{\n"
- + "result += \": got inside for loop\";\n"
- + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "line breaks within a for expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "line breaks within a for expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-050.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-050.js
index bc871a7e2dd..bcec0e3d19d 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-050.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-050.js
@@ -1,42 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-050.js
- Corresponds to: 7.8.2-1-n.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-050.js
+ Corresponds to: 7.8.2-1-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-050";
- var VERSION = "JS1_4";
- var TITLE = "Examples of Automatic Semicolon Insertion";
+var SECTION = "lexical-050";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("{ 1 2 } 3");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("{ 1 2 } 3");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "{ 1 2 } 3" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "{ 1 2 } 3" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-051.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-051.js
index 68e6b44258a..84c8f399208 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-051.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-051.js
@@ -1,42 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-051.js
- Corresponds to: 7.8.2-3-n.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-051.js
+ Corresponds to: 7.8.2-3-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-051";
- var VERSION = "JS1_4";
- var TITLE = "Examples of Automatic Semicolon Insertion";
+var SECTION = "lexical-051";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
-
- try {
- eval("for (a; b\n) result += \": got to inner loop\";")
+try {
+ eval("for (a; b\n) result += \": got to inner loop\";")
} catch ( e ) {
- result = expect;
- exception = e.toString();
+ result = expect;
+ exception = e.toString();
}
- testcases[tc++] = new TestCase(
- SECTION,
- "for (a; b\n)" +
- " (threw " + exception +")",
- expect,
- result );
+new TestCase(
+ SECTION,
+ "for (a; b\n)" +
+ " (threw " + exception +")",
+ expect,
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-052.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-052.js
index 49aa7c761df..0f3ce439d79 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-052.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-052.js
@@ -1,44 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-052.js
- Corresponds to: 7.8.2-4-n.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-052.js
+ Corresponds to: 7.8.2-4-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-052";
- var VERSION = "JS1_4";
- var TITLE = "Examples of Automatic Semicolon Insertion";
+var SECTION = "lexical-052";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ MyFunction();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- MyFunction();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "calling return indirectly" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyFunction() {
- var s = "return";
- eval(s);
+ var s = "return";
+ eval(s);
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-053.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-053.js
index 6e3ae99bd67..3728e3c39c5 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-053.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-053.js
@@ -1,42 +1,40 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-053.js
- Corresponds to: 7.8.2-7-n.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-053.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-053";
- var VERSION = "JS1_4";
- var TITLE = "Examples of Automatic Semicolon Insertion";
+var SECTION = "lexical-053";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ a = true
+ b = false
- try {
- a = true
- b = false
+ eval('if (a > b)\nelse result += ": got to else statement"');
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- eval('if (a > b)\nelse result += ": got to else statement"');
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "calling return indirectly" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "calling return indirectly" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/lexical-054.js b/mozilla/js/tests/ecma_2/Exceptions/lexical-054.js
index c4b9e9f654b..5739239a4f6 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/lexical-054.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/lexical-054.js
@@ -1,43 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: lexical-054.js
- Corresponds to: 7.8.2-7-n.js
- ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
- Description: compare some specific examples of the automatic
- insertion rules in the EMCA specification.
- Author: christine@netscape.com
- Date: 15 september 1997
+ File Name: lexical-054.js
+ Corresponds to: 7.8.2-7-n.js
+ ECMA Section: 7.8.2 Examples of Automatic Semicolon Insertion
+ Description: compare some specific examples of the automatic
+ insertion rules in the EMCA specification.
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "lexical-054";
- var VERSION = "JS1_4";
- var TITLE = "Examples of Automatic Semicolon Insertion";
+var SECTION = "lexical-054";
+var VERSION = "JS1_4";
+var TITLE = "Examples of Automatic Semicolon Insertion";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ a=0;
+ b=1;
+ c=2;
+ d=3;
+ eval("if (a > b)\nelse c = d");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- a=0;
- b=1;
- c=2;
- d=3;
- eval("if (a > b)\nelse c = d");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "if (a > b)\nelse c = d" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "if (a > b)\nelse c = d" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/number-001.js b/mozilla/js/tests/ecma_2/Exceptions/number-001.js
index 1f456037d3d..746bc36e21d 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/number-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/number-001.js
@@ -1,52 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: number-001
- Corresponds To: 15.7.4.2-2-n.js
- ECMA Section: 15.7.4.2.2 Number.prototype.toString()
- Description:
- If the radix is the number 10 or not supplied, then this number value is
- given as an argument to the ToString operator; the resulting string value
- is returned.
+ File Name: number-001
+ Corresponds To: 15.7.4.2-2-n.js
+ ECMA Section: 15.7.4.2.2 Number.prototype.toString()
+ Description:
+ If the radix is the number 10 or not supplied, then this number value is
+ given as an argument to the ToString operator; the resulting string value
+ is returned.
- If the radix is supplied and is an integer from 2 to 36, but not 10, the
- result is a string, the choice of which is implementation dependent.
+ If the radix is supplied and is an integer from 2 to 36, but not 10, the
+ result is a string, the choice of which is implementation dependent.
- The toString function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The toString function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "number-001";
- var VERSION = "JS1_4";
- var TITLE = "Exceptions for Number.toString()";
+var SECTION = "number-001";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.toString()";
- startTest();
- writeHeaderToLog( SECTION + " Number.prototype.toString()");
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.toString()");
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
+try {
+ object= new Object();
+ object.toString = Number.prototype.toString;
+ result = object.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+new TestCase(
+ SECTION,
+ "object = new Object(); object.toString = Number.prototype.toString; object.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
-
- try {
- object= new Object();
- object.toString = Number.prototype.toString;
- result = object.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "object = new Object(); object.toString = Number.prototype.toString; object.toString()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/number-002.js b/mozilla/js/tests/ecma_2/Exceptions/number-002.js
index 5e84ebf20e3..c8502ca19b9 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/number-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/number-002.js
@@ -1,45 +1,43 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: number-002.js
- Corresponds To: ecma/Number/15.7.4.3-2-n.js
- ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
- Description:
- Returns this number value.
+ File Name: number-002.js
+ Corresponds To: ecma/Number/15.7.4.3-2-n.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
- The valueOf function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "number-002";
- var VERSION = "JS1_4";
- var TITLE = "Exceptions for Number.valueOf()";
+var SECTION = "number-002";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.valueOf()";
- startTest();
- writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ object= new Object();
+ object.toString = Number.prototype.valueOf;
+ result = object.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- object= new Object();
- object.toString = Number.prototype.valueOf;
- result = object.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "object = new Object(); object.valueOf = Number.prototype.valueOf; object.valueOf()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/number-003.js b/mozilla/js/tests/ecma_2/Exceptions/number-003.js
index 947d3d23243..ab9ac7672bb 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/number-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/number-003.js
@@ -1,47 +1,45 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: number-003.js
- Corresponds To: 15.7.4.3-3.js
- ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
- Description:
- Returns this number value.
+ File Name: number-003.js
+ Corresponds To: 15.7.4.3-3.js
+ ECMA Section: 15.7.4.3.1 Number.prototype.valueOf()
+ Description:
+ Returns this number value.
- The valueOf function is not generic; it generates a runtime error if its
- this value is not a Number object. Therefore it cannot be transferred to
- other kinds of objects for use as a method.
+ The valueOf function is not generic; it generates a runtime error if its
+ this value is not a Number object. Therefore it cannot be transferred to
+ other kinds of objects for use as a method.
- Author: christine@netscape.com
- Date: 16 september 1997
+ Author: christine@netscape.com
+ Date: 16 september 1997
*/
- var SECTION = "number-003";
- var VERSION = "JS1_4";
- var TITLE = "Exceptions for Number.valueOf()";
+var SECTION = "number-003";
+var VERSION = "JS1_4";
+var TITLE = "Exceptions for Number.valueOf()";
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
- startTest();
- writeHeaderToLog( SECTION + " Number.prototype.valueOf()");
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ VALUE_OF = Number.prototype.valueOf;
+ OBJECT = new String("Infinity");
+ OBJECT.valueOf = VALUE_OF;
+ result = OBJECT.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- VALUE_OF = Number.prototype.valueOf;
- OBJECT = new String("Infinity");
- OBJECT.valueOf = VALUE_OF;
- result = OBJECT.valueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "Assigning Number.prototype.valueOf as the valueOf of a String object " +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "Assigning Number.prototype.valueOf as the valueOf of a String object " +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/shell.js b/mozilla/js/tests/ecma_2/Exceptions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-001.js b/mozilla/js/tests/ecma_2/Exceptions/statement-001.js
index 928a04d747d..4b4a130bc60 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-001.js
@@ -1,44 +1,42 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-001.js
- Corresponds To: 12.6.2-9-n.js
- ECMA Section: 12.6.2 The for Statement
+ File Name: statement-001.js
+ Corresponds To: 12.6.2-9-n.js
+ ECMA Section: 12.6.2 The for Statement
- 1. first expression is not present.
- 2. second expression is not present
- 3. third expression is not present
+ 1. first expression is not present.
+ 2. second expression is not present
+ 3. third expression is not present
- Author: christine@netscape.com
- Date: 15 september 1997
+ Author: christine@netscape.com
+ Date: 15 september 1997
*/
- var SECTION = "statement-001.js";
+var SECTION = "statement-001.js";
// var SECTION = "12.6.2-9-n";
- var VERSION = "ECMA_1";
- var TITLE = "The for statment";
+var VERSION = "ECMA_1";
+var TITLE = "The for statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("for (i) {\n}");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("for (i) {\n}");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "for(i) {}" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "for(i) {}" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-002.js b/mozilla/js/tests/ecma_2/Exceptions/statement-002.js
index 83c642c12d7..4b5c2c6ec56 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-002.js
@@ -1,66 +1,64 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-002.js
- Corresponds To: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: statement-002.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "statement-002";
- var VERSION = "JS1_4";
- var TITLE = "The for..in statment";
+var SECTION = "statement-002";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
- var testcases = new Array();
- var tc = 0;
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval(" for ( var i, p in this) { result += this[p]; }");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval(" for ( var i, p in this) { result += this[p]; }");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "more than one member expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "more than one member expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-003.js b/mozilla/js/tests/ecma_2/Exceptions/statement-003.js
index c7ffc7f9ba1..38916a780a8 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-003.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-003.js
@@ -1,77 +1,75 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-003
- Corresponds To: 12.6.3-7-n.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- The production IterationStatement : for ( LeftHandSideExpression in Expression )
- Statement is evaluated as follows:
+ File Name: statement-003
+ Corresponds To: 12.6.3-7-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ The production IterationStatement : for ( LeftHandSideExpression in Expression )
+ Statement is evaluated as follows:
- 1. Evaluate the Expression.
- 2. Call GetValue(Result(1)).
- 3. Call ToObject(Result(2)).
- 4. Let C be "normal completion".
- 5. Get the name of the next property of Result(3) that doesn't have the
- DontEnum attribute. If there is no such property, go to step 14.
- 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
- 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
- 1. If Type(V) is not Reference, generate a runtime error.
- 2. Call GetBase(V).
- 3. If Result(2) is null, go to step 6.
- 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
- for the property name and W for the value.
- 5. Return.
- 6. Call the [[Put]] method for the global object, passing
- GetPropertyName(V) for the property name and W for the value.
- 7. Return.
- 8. Evaluate Statement.
- 9. If Result(8) is a value completion, change C to be "normal completion
- after value V" where V is the value carried by Result(8).
- 10. If Result(8) is a break completion, go to step 14.
- 11. If Result(8) is a continue completion, go to step 5.
- 12. If Result(8) is a return completion, return Result(8).
- 13. Go to step 5.
- 14. Return C.
+ 1. Evaluate the Expression.
+ 2. Call GetValue(Result(1)).
+ 3. Call ToObject(Result(2)).
+ 4. Let C be "normal completion".
+ 5. Get the name of the next property of Result(3) that doesn't have the
+ DontEnum attribute. If there is no such property, go to step 14.
+ 6. Evaluate the LeftHandSideExpression ( it may be evaluated repeatedly).
+ 7. Call PutValue(Result(6), Result(5)). PutValue( V, W ):
+ 1. If Type(V) is not Reference, generate a runtime error.
+ 2. Call GetBase(V).
+ 3. If Result(2) is null, go to step 6.
+ 4. Call the [[Put]] method of Result(2), passing GetPropertyName(V)
+ for the property name and W for the value.
+ 5. Return.
+ 6. Call the [[Put]] method for the global object, passing
+ GetPropertyName(V) for the property name and W for the value.
+ 7. Return.
+ 8. Evaluate Statement.
+ 9. If Result(8) is a value completion, change C to be "normal completion
+ after value V" where V is the value carried by Result(8).
+ 10. If Result(8) is a break completion, go to step 14.
+ 11. If Result(8) is a continue completion, go to step 5.
+ 12. If Result(8) is a return completion, return Result(8).
+ 13. Go to step 5.
+ 14. Return C.
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "statement-003";
- var VERSION = "JS1_4";
- var TITLE = "The for..in statment";
+var SECTION = "statement-003";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var o = new MyObject();
+ var result = 0;
- try {
- var o = new MyObject();
- var result = 0;
+ eval("for ( this in o) {\n"
+ + "result += this[p];\n"
+ + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- eval("for ( this in o) {\n"
- + "result += this[p];\n"
- + "}\n");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "bad left-hand side expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
+ this.value = 2;
+ this[0] = 4;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-004.js b/mozilla/js/tests/ecma_2/Exceptions/statement-004.js
index 9eee4e605e9..2b59c09961d 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-004.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-004.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-004.js
- Corresponds To: 12.6.3-1.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+ File Name: statement-004.js
+ Corresponds To: 12.6.3-1.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "statement-004";
- var VERSION = "JS1_4";
- var TITLE = "The for..in statment";
+var SECTION = "statement-004";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var o = new MyObject();
- try {
- var o = new MyObject();
+ eval("for ( \"a\" in o) {\n"
+ + "result += this[p];\n"
+ + "}");
- eval("for ( \"a\" in o) {\n"
- + "result += this[p];\n"
- + "}");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "bad left-hand side expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
+ this.value = 2;
+ this[0] = 4;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-005.js b/mozilla/js/tests/ecma_2/Exceptions/statement-005.js
index 50933b03b7e..aa87e3633c9 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-005.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-005.js
@@ -1,48 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-005.js
- Corresponds To: 12.6.3-8-n.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+ File Name: statement-005.js
+ Corresponds To: 12.6.3-8-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "statement-005";
- var VERSION = "JS1_4";
- var TITLE = "The for..in statment";
+var SECTION = "statement-005";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var testcases = new Array();
- var tc = 0;
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var o = new MyObject();
+ result = 0;
- try {
- var o = new MyObject();
- result = 0;
+ eval("for (1 in o) {\n"
+ + "result += this[p];"
+ + "}\n");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- eval("for (1 in o) {\n"
- + "result += this[p];"
- + "}\n");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "bad left-hand side expression" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "bad left-hand side expression" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
+ this.value = 2;
+ this[0] = 4;
+ return this;
}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-006.js b/mozilla/js/tests/ecma_2/Exceptions/statement-006.js
index 1fe03259eac..6e86ac70bab 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-006.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-006.js
@@ -1,48 +1,46 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-006.js
- Corresponds To: 12.6.3-9-n.js
- ECMA Section: 12.6.3 The for...in Statement
- Description:
+ File Name: statement-006.js
+ Corresponds To: 12.6.3-9-n.js
+ ECMA Section: 12.6.3 The for...in Statement
+ Description:
- Author: christine@netscape.com
- Date: 11 september 1997
+ Author: christine@netscape.com
+ Date: 11 september 1997
*/
- var SECTION = "statement-006";
- var VERSION = "JS1_4";
- var TITLE = "The for..in statment";
+var SECTION = "statement-006";
+var VERSION = "JS1_4";
+var TITLE = "The for..in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var o = new MyObject();
+ var result = 0;
+ for ( var o in foo) {
+ result += this[o];
+ }
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var o = new MyObject();
- var result = 0;
- for ( var o in foo) {
- result += this[o];
- }
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "object is not defined" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "object is not defined" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
function MyObject() {
- this.value = 2;
- this[0] = 4;
- return this;
-}
\ No newline at end of file
+ this.value = 2;
+ this[0] = 4;
+ return this;
+}
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-007.js b/mozilla/js/tests/ecma_2/Exceptions/statement-007.js
index 506578b4d90..7499b3029b7 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-007.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-007.js
@@ -1,39 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-007.js
- Corresponds To: 12.7-1-n.js
- ECMA Section: 12.7 The continue statement
- Description:
+ File Name: statement-007.js
+ Corresponds To: 12.7-1-n.js
+ ECMA Section: 12.7 The continue statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "statement-007";
- var VERSION = "JS1_4";
- var TITLE = "The continue statment";
+var SECTION = "statement-007";
+var VERSION = "JS1_4";
+var TITLE = "The continue statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("continue;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("continue;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "continue outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "continue outside of an iteration statement" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-008.js b/mozilla/js/tests/ecma_2/Exceptions/statement-008.js
index e293964c129..c95888b60c3 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-008.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-008.js
@@ -1,39 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: statement-008.js
- Corresponds To: 12.8-1-n.js
- ECMA Section: 12.8 The break statement
- Description:
+ File Name: statement-008.js
+ Corresponds To: 12.8-1-n.js
+ ECMA Section: 12.8 The break statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "statement-008";
- var VERSION = "JS1_4";
- var TITLE = "The break in statment";
+var SECTION = "statement-008";
+var VERSION = "JS1_4";
+var TITLE = "The break in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("break;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("break;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "break outside of an iteration statement" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "break outside of an iteration statement" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/statement-009.js b/mozilla/js/tests/ecma_2/Exceptions/statement-009.js
index 136d3f1f866..1723ddbcedd 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/statement-009.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/statement-009.js
@@ -1,38 +1,36 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: 12.9-1-n.js
- ECMA Section: 12.9 The return statement
- Description:
+ File Name: 12.9-1-n.js
+ ECMA Section: 12.9 The return statement
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "12.9-1-n";
- var VERSION = "ECMA_1";
- var TITLE = "The return statment";
+var SECTION = "12.9-1-n";
+var VERSION = "ECMA_1";
+var TITLE = "The return statement";
- startTest();
- writeHeaderToLog( SECTION + " The return statement");
+startTest();
+writeHeaderToLog( SECTION + " The return statement");
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ eval("return;");
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- eval("return;");
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "return outside of a function" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "return outside of a function" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/string-001.js b/mozilla/js/tests/ecma_2/Exceptions/string-001.js
index 9ba39afb1a3..a51c4d46f36 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/string-001.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/string-001.js
@@ -1,50 +1,48 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: string-001.js
- Corresponds To: 15.5.4.2-2-n.js
- ECMA Section: 15.5.4.2 String.prototype.toString()
+ File Name: string-001.js
+ Corresponds To: 15.5.4.2-2-n.js
+ ECMA Section: 15.5.4.2 String.prototype.toString()
- Description: Returns this string value. Note that, for a String
- object, the toString() method happens to return the same
- thing as the valueOf() method.
+ Description: Returns this string value. Note that, for a String
+ object, the toString() method happens to return the same
+ thing as the valueOf() method.
- The toString function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The toString function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "string-001";
- var VERSION = "JS1_4";
- var TITLE = "String.prototype.toString";
+var SECTION = "string-001";
+var VERSION = "JS1_4";
+var TITLE = "String.prototype.toString";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ OBJECT = new Object();
+ OBJECT.toString = String.prototype.toString();
+ result = OBJECT.toString();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- OBJECT = new Object();
- OBJECT.toString = String.prototype.toString();
- result = OBJECT.toString();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; "+
+ " OBJECT.toString = String.prototype.toString; OBJECT.toString()" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJECT = new Object; "+
- " OBJECT.toString = String.prototype.toString; OBJECT.toString()" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Exceptions/string-002.js b/mozilla/js/tests/ecma_2/Exceptions/string-002.js
index 857271efe07..5b26f134547 100644
--- a/mozilla/js/tests/ecma_2/Exceptions/string-002.js
+++ b/mozilla/js/tests/ecma_2/Exceptions/string-002.js
@@ -1,49 +1,47 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: string-002.js
- Corresponds To: 15.5.4.3-3-n.js
- ECMA Section: 15.5.4.3 String.prototype.valueOf()
+ File Name: string-002.js
+ Corresponds To: 15.5.4.3-3-n.js
+ ECMA Section: 15.5.4.3 String.prototype.valueOf()
- Description: Returns this string value.
+ Description: Returns this string value.
- The valueOf function is not generic; it generates a
- runtime error if its this value is not a String object.
- Therefore it connot be transferred to the other kinds of
- objects for use as a method.
+ The valueOf function is not generic; it generates a
+ runtime error if its this value is not a String object.
+ Therefore it connot be transferred to the other kinds of
+ objects for use as a method.
- Author: christine@netscape.com
- Date: 1 october 1997
+ Author: christine@netscape.com
+ Date: 1 october 1997
*/
- var SECTION = "string-002";
- var VERSION = "JS1_4";
- var TITLE = "String.prototype.valueOf";
+var SECTION = "string-002";
+var VERSION = "JS1_4";
+var TITLE = "String.prototype.valueOf";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var result = "Failed";
+var exception = "No exception thrown";
+var expect = "Passed";
- var result = "Failed";
- var exception = "No exception thrown";
- var expect = "Passed";
+try {
+ var OBJECT =new Object();
+ OBJECT.valueOf = String.prototype.valueOf;
+ result = OBJECT.valueOf();
+} catch ( e ) {
+ result = expect;
+ exception = e.toString();
+}
- try {
- var OBJECT =new Object();
- OBJECT.valueOf = String.prototype.valueOf;
- result = OBJECT.valueOf();
- } catch ( e ) {
- result = expect;
- exception = e.toString();
- }
+new TestCase(
+ SECTION,
+ "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
+ "result = OBJECT.valueOf();" +
+ " (threw " + exception +")",
+ expect,
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "OBJECT = new Object; OBJECT.valueOf = String.prototype.valueOf;"+
- "result = OBJECT.valueOf();" +
- " (threw " + exception +")",
- expect,
- result );
-
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/StrictEquality-001.js b/mozilla/js/tests/ecma_2/Expressions/StrictEquality-001.js
index c3ac50735cf..1d7cfb1c038 100644
--- a/mozilla/js/tests/ecma_2/Expressions/StrictEquality-001.js
+++ b/mozilla/js/tests/ecma_2/Expressions/StrictEquality-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: StrictEquality-001.js
* ECMA Section: 11.9.6.js
@@ -6,65 +7,62 @@
* Author: christine@netscape.com
* Date: 4 september 1998
*/
- var SECTION = "StrictEquality-001 - 11.9.6";
- var VERSION = "ECMA_2";
- var TITLE = "The strict equality operator ( === )";
+var SECTION = "StrictEquality-001 - 11.9.6";
+var VERSION = "ECMA_2";
+var TITLE = "The strict equality operator ( === )";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- // 1. If Type(x) is different from Type(y) return false
+// 1. If Type(x) is different from Type(y) return false
- StrictEquality( true, new Boolean(true), false );
- StrictEquality( new Boolean(), false, false );
- StrictEquality( "", new String(), false );
- StrictEquality( new String("hi"), "hi", false );
+StrictEquality( true, new Boolean(true), false );
+StrictEquality( new Boolean(), false, false );
+StrictEquality( "", new String(), false );
+StrictEquality( new String("hi"), "hi", false );
- // 2. If Type(x) is not Number go to step 9.
+// 2. If Type(x) is not Number go to step 9.
- // 3. If x is NaN, return false
- StrictEquality( NaN, NaN, false );
- StrictEquality( NaN, 0, false );
+// 3. If x is NaN, return false
+StrictEquality( NaN, NaN, false );
+StrictEquality( NaN, 0, false );
- // 4. If y is NaN, return false.
- StrictEquality( 0, NaN, false );
+// 4. If y is NaN, return false.
+StrictEquality( 0, NaN, false );
- // 5. if x is the same number value as y, return true
+// 5. if x is the same number value as y, return true
- // 6. If x is +0 and y is -0, return true
+// 6. If x is +0 and y is -0, return true
- // 7. If x is -0 and y is +0, return true
+// 7. If x is -0 and y is +0, return true
- // 8. Return false.
+// 8. Return false.
- // 9. If Type(x) is String, then return true if x and y are exactly
- // the same sequence of characters ( same length and same characters
- // in corresponding positions.) Otherwise return false.
+// 9. If Type(x) is String, then return true if x and y are exactly
+// the same sequence of characters ( same length and same characters
+// in corresponding positions.) Otherwise return false.
- // 10. If Type(x) is Boolean, return true if x and y are both true or
- // both false. otherwise return false.
+// 10. If Type(x) is Boolean, return true if x and y are both true or
+// both false. otherwise return false.
- // Return true if x and y refer to the same object. Otherwise return
- // false.
+// Return true if x and y refer to the same object. Otherwise return
+// false.
- // Return false.
+// Return false.
- test();
+test();
function StrictEquality( x, y, expect ) {
- result = ( x === y );
+ result = ( x === y );
- testcases[tc++] = new TestCase(
- SECTION,
- x +" === " + y,
- expect,
- result );
+ new TestCase(
+ SECTION,
+ x +" === " + y,
+ expect,
+ result );
}
diff --git a/mozilla/js/tests/ecma_2/Expressions/browser.js b/mozilla/js/tests/ecma_2/Expressions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-001.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-001.js
index 2e7412ad8c4..6a81aa40b7f 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-001.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: instanceof-001.js
* ECMA Section: 11.8.6
@@ -8,110 +9,98 @@
* Author: christine@netscape.com
* Date: 2 September 1998
*/
- var SECTION = "instanceof-001";
- var VERSION = "ECMA_2";
- var TITLE = "instanceof"
+var SECTION = "instanceof-001";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
- function InstanceOf( object_1, object_2, expect ) {
- result = object_1 instanceof object_2;
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "(" + object_1 + ") instanceof " + object_2,
- expect,
- result );
- }
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
- function Gen3(value) {
- this.value = value;
- this.generation = 3;
- this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
- }
- Gen3.name = 3;
- Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
- function Gen2(value) {
- this.value = value;
- this.generation = 2;
- }
- Gen2.name = 2;
- Gen2.prototype = new Gen3();
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
- function Gen1(value) {
- this.value = value;
- this.generation = 1;
- }
- Gen1.name = 1;
- Gen1.prototype = new Gen2();
-
- function Gen0(value) {
- this.value = value;
- this.generation = 0;
- }
- Gen0.name = 0;
- Gen0.prototype = new Gen1();
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
- function GenA(value) {
- this.value = value;
- this.generation = "A";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenA.prototype = new Gen0();
- GenA.name = "A";
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
- function GenB(value) {
- this.value = value;
- this.generation = "B";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenB.name = "B"
- GenB.prototype = void 0;
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+GenB.prototype = void 0;
- // RelationalExpression is not an object.
+// RelationalExpression is not an object.
- InstanceOf( true, Boolean, false );
- InstanceOf( new Boolean(false), Boolean, true );
+InstanceOf( true, Boolean, false );
+InstanceOf( new Boolean(false), Boolean, true );
- // Identifier is not a function
+// __proto__ of RelationalExpression is null. should return false
+genA = new GenA();
+genA.__proto__ = null;
-// InstanceOf( true, true, false );
-// InstanceOf( new Boolean(true), false, false );
+InstanceOf( genA, GenA, false );
- // Identifier is a function, prototype of Identifier is not an object
+// RelationalExpression.__proto__ == (but not ===) Identifier.prototype
-// InstanceOf( new GenB(), GenB, false );
+InstanceOf( new Gen2(), Gen0, false );
+InstanceOf( new Gen2(), Gen1, false );
+InstanceOf( new Gen2(), Gen2, true );
+InstanceOf( new Gen2(), Gen3, true );
- // __proto__ of RelationalExpression is null. should return false
- genA = new GenA();
- genA.__proto__ = null;
+// RelationalExpression.__proto__.__proto__ === Identifier.prototype
+InstanceOf( new Gen0(), Gen0, true );
+InstanceOf( new Gen0(), Gen1, true );
+InstanceOf( new Gen0(), Gen2, true );
+InstanceOf( new Gen0(), Gen3, true );
- InstanceOf( genA, GenA, false );
+InstanceOf( new Gen0(), Object, true );
+InstanceOf( new Gen0(), Function, false );
- // RelationalExpression.__proto__ == (but not ===) Identifier.prototype
+InstanceOf( Gen0, Function, true );
+InstanceOf( Gen0, Object, true );
- InstanceOf( new Gen2(), Gen0, false );
- InstanceOf( new Gen2(), Gen1, false );
- InstanceOf( new Gen2(), Gen2, true );
- InstanceOf( new Gen2(), Gen3, true );
-
- // RelationalExpression.__proto__.__proto__ === Identifier.prototype
- InstanceOf( new Gen0(), Gen0, true );
- InstanceOf( new Gen0(), Gen1, true );
- InstanceOf( new Gen0(), Gen2, true );
- InstanceOf( new Gen0(), Gen3, true );
-
- InstanceOf( new Gen0(), Object, true );
- InstanceOf( new Gen0(), Function, false );
-
- InstanceOf( Gen0, Function, true );
- InstanceOf( Gen0, Object, true );
-
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-002.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-002.js
index 68697d06b04..a597d482c9b 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-002.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-002.js
@@ -1,124 +1,122 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: instanceof-002.js
- Section:
- Description: Determining Instance Relationships
+ File Name: instanceof-002.js
+ Section:
+ Description: Determining Instance Relationships
- This test is the same as js1_3/inherit/proto-002, except that it uses
- the builtin instanceof operator rather than a user-defined function
- called InstanceOf.
+ This test is the same as js1_3/inherit/proto-002, except that it uses
+ the builtin instanceof operator rather than a user-defined function
+ called InstanceOf.
- This tests Object Hierarchy and Inheritance, as described in the document
- Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
- 15:19:34 on http://devedge.netscape.com/. Current URL:
- http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
+ This tests Object Hierarchy and Inheritance, as described in the document
+ Object Hierarchy and Inheritance in JavaScript, last modified on 12/18/97
+ 15:19:34 on http://devedge.netscape.com/. Current URL:
+ http://devedge.netscape.com/docs/manuals/communicator/jsobj/contents.htm
- This tests the syntax ObjectName.prototype = new PrototypeObject using the
- Employee example in the document referenced above.
+ This tests the syntax ObjectName.prototype = new PrototypeObject using the
+ Employee example in the document referenced above.
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
// onerror = err;
- var SECTION = "instanceof-002";
- var VERSION = "ECMA_2";
- var TITLE = "Determining Instance Relationships";
+var SECTION = "instanceof-002";
+var VERSION = "ECMA_2";
+var TITLE = "Determining Instance Relationships";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
-
- var tc = 0;
- var testcases = new Array();
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
function InstanceOf( object, constructor ) {
- while ( object != null ) {
- if ( object == constructor.prototype ) {
- return true;
- }
- object = object.__proto__;
+ while ( object != null ) {
+ if ( object == constructor.prototype ) {
+ return true;
}
- return false;
+ object = object.__proto__;
+ }
+ return false;
}
function Employee ( name, dept ) {
- this.name = name || "";
- this.dept = dept || "general";
+ this.name = name || "";
+ this.dept = dept || "general";
}
function Manager () {
- this.reports = [];
+ this.reports = [];
}
Manager.prototype = new Employee();
function WorkerBee ( name, dept, projs ) {
- this.base = Employee;
- this.base( name, dept)
+ this.base = Employee;
+ this.base( name, dept)
this.projects = projs || new Array();
}
WorkerBee.prototype = new Employee();
function SalesPerson () {
- this.dept = "sales";
- this.quota = 100;
+ this.dept = "sales";
+ this.quota = 100;
}
SalesPerson.prototype = new WorkerBee();
function Engineer ( name, projs, machine ) {
- this.base = WorkerBee;
- this.base( name, "engineering", projs )
+ this.base = WorkerBee;
+ this.base( name, "engineering", projs )
this.machine = machine || "";
}
Engineer.prototype = new WorkerBee();
-var pat = new Engineer()
+var pat = new Engineer();
- testcases[tc++] = new TestCase( SECTION,
- "pat.__proto__ == Engineer.prototype",
- true,
- pat.__proto__ == Engineer.prototype );
+new TestCase( SECTION,
+ "pat.__proto__ == Engineer.prototype",
+ true,
+ pat.__proto__ == Engineer.prototype );
- testcases[tc++] = new TestCase( SECTION,
- "pat.__proto__.__proto__ == WorkerBee.prototype",
- true,
- pat.__proto__.__proto__ == WorkerBee.prototype );
+new TestCase( SECTION,
+ "pat.__proto__.__proto__ == WorkerBee.prototype",
+ true,
+ pat.__proto__.__proto__ == WorkerBee.prototype );
- testcases[tc++] = new TestCase( SECTION,
- "pat.__proto__.__proto__.__proto__ == Employee.prototype",
- true,
- pat.__proto__.__proto__.__proto__ == Employee.prototype );
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__ == Employee.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__ == Employee.prototype );
- testcases[tc++] = new TestCase( SECTION,
- "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype",
- true,
- pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype );
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__ == Object.prototype );
- testcases[tc++] = new TestCase( SECTION,
- "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null",
- true,
- pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null );
+new TestCase( SECTION,
+ "pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null",
+ true,
+ pat.__proto__.__proto__.__proto__.__proto__.__proto__ == null );
- testcases[tc++] = new TestCase( SECTION,
- "pat instanceof Engineer",
- true,
- pat instanceof Engineer );
+new TestCase( SECTION,
+ "pat instanceof Engineer",
+ true,
+ pat instanceof Engineer );
- testcases[tc++] = new TestCase( SECTION,
- "pat instanceof WorkerBee )",
- true,
- pat instanceof WorkerBee );
+new TestCase( SECTION,
+ "pat instanceof WorkerBee )",
+ true,
+ pat instanceof WorkerBee );
- testcases[tc++] = new TestCase( SECTION,
- "pat instanceof Employee )",
- true,
- pat instanceof Employee );
+new TestCase( SECTION,
+ "pat instanceof Employee )",
+ true,
+ pat instanceof Employee );
- testcases[tc++] = new TestCase( SECTION,
- "pat instanceof Object )",
- true,
- pat instanceof Object );
+new TestCase( SECTION,
+ "pat instanceof Object )",
+ true,
+ pat instanceof Object );
- testcases[tc++] = new TestCase( SECTION,
- "pat instanceof SalesPerson )",
- false,
- pat instanceof SalesPerson );
- test();
+new TestCase( SECTION,
+ "pat instanceof SalesPerson )",
+ false,
+ pat instanceof SalesPerson );
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-003-n.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-003-n.js
index f48108ee418..e7155c01293 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-003-n.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-003-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: instanceof-001.js
* ECMA Section: 11.8.6
@@ -8,86 +9,75 @@
* Author: christine@netscape.com
* Date: 2 September 1998
*/
- var SECTION = "instanceof-001";
- var VERSION = "ECMA_2";
- var TITLE = "instanceof"
+var SECTION = "instanceof-003-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function InstanceOf( object_1, object_2, expect ) {
- function InstanceOf( object_1, object_2, expect ) {
- result = object_1 instanceof object_2;
+ result = object_1 instanceof object_2;
- testcases[tc++] = new TestCase(
- SECTION,
- "(" + object_1 + ") instanceof " + object_2,
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
- function Gen3(value) {
- this.value = value;
- this.generation = 3;
- this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
- }
- Gen3.name = 3;
- Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
- function Gen2(value) {
- this.value = value;
- this.generation = 2;
- }
- Gen2.name = 2;
- Gen2.prototype = new Gen3();
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
- function Gen1(value) {
- this.value = value;
- this.generation = 1;
- }
- Gen1.name = 1;
- Gen1.prototype = new Gen2();
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
- function Gen0(value) {
- this.value = value;
- this.generation = 0;
- }
- Gen0.name = 0;
- Gen0.prototype = new Gen1();
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
- function GenA(value) {
- this.value = value;
- this.generation = "A";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenA.prototype = new Gen0();
- GenA.name = "A";
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
- function GenB(value) {
- this.value = value;
- this.generation = "B";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenB.name = "B"
- GenB.prototype = void 0;
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+GenB.prototype = void 0;
- // RelationalExpression is not an object.
+// Identifier is not a function
+DESCRIPTION = "Identifier is not a function";
+EXPECTED = "error";
- InstanceOf( true, Boolean, false );
-// InstanceOf( new Boolean(false), Boolean, true );
+InstanceOf( true, true, "error" );
- // Identifier is not a function
-
- InstanceOf( true, true, false );
-// InstanceOf( new Boolean(true), false, false );
-
- // Identifier is a function, prototype of Identifier is not an object
-
-// InstanceOf( new GenB(), GenB, false );
-
-
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-004-n.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-004-n.js
index 664a5536a6c..4e0a96e57cb 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-004-n.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-004-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: instanceof-001.js
* ECMA Section: 11.8.6
@@ -8,85 +9,75 @@
* Author: christine@netscape.com
* Date: 2 September 1998
*/
- var SECTION = "instanceof-001";
- var VERSION = "ECMA_2";
- var TITLE = "instanceof"
+var SECTION = "instanceof-004-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
- function InstanceOf( object_1, object_2, expect ) {
- result = object_1 instanceof object_2;
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "(" + object_1 + ") instanceof " + object_2,
- expect,
- result );
- }
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
- function Gen3(value) {
- this.value = value;
- this.generation = 3;
- this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
- }
- Gen3.name = 3;
- Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
- function Gen2(value) {
- this.value = value;
- this.generation = 2;
- }
- Gen2.name = 2;
- Gen2.prototype = new Gen3();
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
- function Gen1(value) {
- this.value = value;
- this.generation = 1;
- }
- Gen1.name = 1;
- Gen1.prototype = new Gen2();
-
- function Gen0(value) {
- this.value = value;
- this.generation = 0;
- }
- Gen0.name = 0;
- Gen0.prototype = new Gen1();
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
- function GenA(value) {
- this.value = value;
- this.generation = "A";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenA.prototype = new Gen0();
- GenA.name = "A";
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
- function GenB(value) {
- this.value = value;
- this.generation = "B";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenB.name = "B"
- GenB.prototype = void 0;
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+GenB.prototype = void 0;
- // RelationalExpression is not an object.
+// Identifier is not a function
- InstanceOf( true, Boolean, false );
- InstanceOf( new Boolean(false), Boolean, true );
+DESCRIPTION = "Identifier is not a function";
+EXPECTED = "error";
- // Identifier is not a function
+InstanceOf( new Boolean(true), false, "error" );
- InstanceOf( new Boolean(true), false, false );
-
- // Identifier is a function, prototype of Identifier is not an object
-
-// InstanceOf( new GenB(), GenB, false );
-
-
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-005-n.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-005-n.js
index c3a621d9b78..a93e1813d21 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-005-n.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-005-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: instanceof-001.js
* ECMA Section: 11.8.6
@@ -8,77 +9,76 @@
* Author: christine@netscape.com
* Date: 2 September 1998
*/
- var SECTION = "instanceof-001";
- var VERSION = "ECMA_2";
- var TITLE = "instanceof"
+var SECTION = "instanceof-005-n";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
- function InstanceOf( object_1, object_2, expect ) {
- result = object_1 instanceof object_2;
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "(" + object_1 + ") instanceof " + object_2,
- expect,
- result );
- }
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
- function Gen3(value) {
- this.value = value;
- this.generation = 3;
- this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
- }
- Gen3.name = 3;
- Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
- function Gen2(value) {
- this.value = value;
- this.generation = 2;
- }
- Gen2.name = 2;
- Gen2.prototype = new Gen3();
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
- function Gen1(value) {
- this.value = value;
- this.generation = 1;
- }
- Gen1.name = 1;
- Gen1.prototype = new Gen2();
-
- function Gen0(value) {
- this.value = value;
- this.generation = 0;
- }
- Gen0.name = 0;
- Gen0.prototype = new Gen1();
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
- function GenA(value) {
- this.value = value;
- this.generation = "A";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenA.prototype = new Gen0();
- GenA.name = "A";
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
- function GenB(value) {
- this.value = value;
- this.generation = "B";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenB.name = "B"
- GenB.prototype = void 0;
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+GenB.prototype = void 0;
- // Identifier is a function, prototype of Identifier is not an object
+// Identifier is a function, prototype of Identifier is not an object
- InstanceOf( new GenB(), GenB, false );
+DESCRIPTION = "Identifier is a function, prototype of Identifier is not an object";
+EXPECTED = "error";
+InstanceOf( new GenB(), GenB, "error" );
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/instanceof-006.js b/mozilla/js/tests/ecma_2/Expressions/instanceof-006.js
index f1be0b4be97..def13858039 100644
--- a/mozilla/js/tests/ecma_2/Expressions/instanceof-006.js
+++ b/mozilla/js/tests/ecma_2/Expressions/instanceof-006.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: instanceof-001.js
* ECMA Section: 11.8.6
@@ -8,76 +9,73 @@
* Author: christine@netscape.com
* Date: 2 September 1998
*/
- var SECTION = "instanceof-001";
- var VERSION = "ECMA_2";
- var TITLE = "instanceof"
+var SECTION = "instanceof-001";
+var VERSION = "ECMA_2";
+var TITLE = "instanceof"
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function InstanceOf( object_1, object_2, expect ) {
+ result = object_1 instanceof object_2;
- function InstanceOf( object_1, object_2, expect ) {
- result = object_1 instanceof object_2;
+ new TestCase(
+ SECTION,
+ "(" + object_1 + ") instanceof " + object_2,
+ expect,
+ result );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "(" + object_1 + ") instanceof " + object_2,
- expect,
- result );
- }
+function Gen3(value) {
+ this.value = value;
+ this.generation = 3;
+ this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
+}
+Gen3.name = 3;
+Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
- function Gen3(value) {
- this.value = value;
- this.generation = 3;
- this.toString = new Function ( "return \"(Gen\"+this.generation+\" instance)\"" );
- }
- Gen3.name = 3;
- Gen3.__proto__.toString = new Function( "return \"(\"+this.name+\" object)\"");
+function Gen2(value) {
+ this.value = value;
+ this.generation = 2;
+}
+Gen2.name = 2;
+Gen2.prototype = new Gen3();
- function Gen2(value) {
- this.value = value;
- this.generation = 2;
- }
- Gen2.name = 2;
- Gen2.prototype = new Gen3();
+function Gen1(value) {
+ this.value = value;
+ this.generation = 1;
+}
+Gen1.name = 1;
+Gen1.prototype = new Gen2();
- function Gen1(value) {
- this.value = value;
- this.generation = 1;
- }
- Gen1.name = 1;
- Gen1.prototype = new Gen2();
-
- function Gen0(value) {
- this.value = value;
- this.generation = 0;
- }
- Gen0.name = 0;
- Gen0.prototype = new Gen1();
+function Gen0(value) {
+ this.value = value;
+ this.generation = 0;
+}
+Gen0.name = 0;
+Gen0.prototype = new Gen1();
- function GenA(value) {
- this.value = value;
- this.generation = "A";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+function GenA(value) {
+ this.value = value;
+ this.generation = "A";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenA.prototype = new Gen0();
- GenA.name = "A";
+}
+GenA.prototype = new Gen0();
+GenA.name = "A";
- function GenB(value) {
- this.value = value;
- this.generation = "B";
- this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
- }
- GenB.name = "B"
- GenB.prototype = void 0;
+function GenB(value) {
+ this.value = value;
+ this.generation = "B";
+ this.toString = new Function ( "return \"(instance of Gen\"+this.generation+\")\"" );
+}
+GenB.name = "B"
+GenB.prototype = void 0;
- // RelationalExpression is not an object.
+// RelationalExpression is not an object.
// InstanceOf( true, Boolean, false );
- InstanceOf( new Boolean(false), Boolean, true );
+InstanceOf( new Boolean(false), Boolean, true );
- test();
\ No newline at end of file
+test();
diff --git a/mozilla/js/tests/ecma_2/Expressions/shell.js b/mozilla/js/tests/ecma_2/Expressions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/FunctionObjects/apply-001-n.js b/mozilla/js/tests/ecma_2/FunctionObjects/apply-001-n.js
index 2d6af031434..fd914d6fce9 100644
--- a/mozilla/js/tests/ecma_2/FunctionObjects/apply-001-n.js
+++ b/mozilla/js/tests/ecma_2/FunctionObjects/apply-001-n.js
@@ -38,18 +38,26 @@
*
* ***** END LICENSE BLOCK ***** */
-print ("STATUS: f.apply crash test.");
+writeLineToLog("STATUS: f.apply crash test.");
-print ("BUGNUMBER: 21836");
+writeLineToLog("BUGNUMBER: 21836");
function f ()
{
}
-test ();
+var SECTION = "apply-001-n";
+var VERSION = "ECMA_1";
+startTest();
+var TITLE = "f.apply(2,2) doesn't crash";
+
+writeHeaderToLog( SECTION + " "+ TITLE);
+
+DESCRIPTION = "f.apply(2,2) doesn't crash";
+EXPECTED = "error";
+
+new TestCase( SECTION, "f.apply(2,2) doesn't crash", "error", eval("f.apply(2,2)") );
+
+test();
-function test ()
-{
- f.apply(2,2);
-}
diff --git a/mozilla/js/tests/ecma_2/FunctionObjects/browser.js b/mozilla/js/tests/ecma_2/FunctionObjects/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/FunctionObjects/call-1.js b/mozilla/js/tests/ecma_2/FunctionObjects/call-1.js
index 9ea9074752f..63c99b0c071 100644
--- a/mozilla/js/tests/ecma_2/FunctionObjects/call-1.js
+++ b/mozilla/js/tests/ecma_2/FunctionObjects/call-1.js
@@ -1,40 +1,37 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: call-1.js
- Section: Function.prototype.call
- Description:
+ File Name: call-1.js
+ Section: Function.prototype.call
+ Description:
- Author: christine@netscape.com
- Date: 12 november 1997
+ Author: christine@netscape.com
+ Date: 12 november 1997
*/
- var SECTION = "call-1";
- var VERSION = "ECMA_2";
- var TITLE = "Function.prototype.call";
+var SECTION = "call-1";
+var VERSION = "ECMA_2";
+var TITLE = "Function.prototype.call";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+new TestCase( SECTION,
+ "ToString.call( this, this )",
+ GLOBAL,
+ ToString.call( this, this ) );
+new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype ) );
- testcases[tc++] = new TestCase( SECTION,
- "ToString.call( this, this )",
- GLOBAL,
- ToString.call( this, this ) );
+new TestCase( SECTION,
+ "ToString.call( Boolean, Boolean.prototype.valueOf() )",
+ "false",
+ ToString.call( Boolean, Boolean.prototype.valueOf() ) );
- testcases[tc++] = new TestCase( SECTION,
- "ToString.call( Boolean, Boolean.prototype )",
- "false",
- ToString.call( Boolean, Boolean.prototype ) );
-
- testcases[tc++] = new TestCase( SECTION,
- "ToString.call( Boolean, Boolean.prototype.valueOf() )",
- "false",
- ToString.call( Boolean, Boolean.prototype.valueOf() ) );
-
- test();
+test();
function ToString( obj ) {
- return obj +"";
-}
\ No newline at end of file
+ return obj +"";
+}
diff --git a/mozilla/js/tests/ecma_2/FunctionObjects/shell.js b/mozilla/js/tests/ecma_2/FunctionObjects/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/LexicalConventions/browser.js b/mozilla/js/tests/ecma_2/LexicalConventions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-001.js b/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-001.js
index 6af945bc7c3..1c908f39155 100644
--- a/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-001.js
+++ b/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: LexicalConventions/regexp-literals-001.js
* ECMA Section: 7.8.5
@@ -7,32 +8,32 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "LexicalConventions/regexp-literals-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "Regular Expression Literals";
+var SECTION = "LexicalConventions/regexp-literals-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "Regular Expression Literals";
- startTest();
+startTest();
- // Regular Expression Literals may not be empty; // should be regarded
- // as a comment, not a RegExp literal.
+// Regular Expression Literals may not be empty; // should be regarded
+// as a comment, not a RegExp literal.
- s = //;
+s = //;
- "passed";
+"passed";
- AddTestCase(
- "// should be a comment, not a regular expression literal",
- "passed",
- String(s));
+AddTestCase(
+ "// should be a comment, not a regular expression literal",
+ "passed",
+ String(s));
- AddTestCase(
- "// typeof object should be type of object declared on following line",
- "passed",
- (typeof s) == "string" ? "passed" : "failed" );
+AddTestCase(
+ "// typeof object should be type of object declared on following line",
+ "passed",
+ (typeof s) == "string" ? "passed" : "failed" );
- AddTestCase(
- "// should not return an object of the type RegExp",
- "passed",
- (typeof s == "object") ? "failed" : "passed" );
+AddTestCase(
+ "// should not return an object of the type RegExp",
+ "passed",
+ (typeof s == "object") ? "failed" : "passed" );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-002.js b/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-002.js
index c67184b166e..123741b7f04 100644
--- a/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-002.js
+++ b/mozilla/js/tests/ecma_2/LexicalConventions/regexp-literals-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: LexicalConventions/regexp-literals-002.js
* ECMA Section: 7.8.5
@@ -6,17 +7,17 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "LexicalConventions/regexp-literals-002.js";
- var VERSION = "ECMA_2";
- var TITLE = "Regular Expression Literals";
+var SECTION = "LexicalConventions/regexp-literals-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "Regular Expression Literals";
- startTest();
+startTest();
- // A regular expression literal represents an object of type RegExp.
+// A regular expression literal represents an object of type RegExp.
- AddTestCase(
- "// A regular expression literal represents an object of type RegExp.",
- "true",
- (/x*/ instanceof RegExp).toString() );
+AddTestCase(
+ "// A regular expression literal represents an object of type RegExp.",
+ "true",
+ (/x*/ instanceof RegExp).toString() );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/LexicalConventions/shell.js b/mozilla/js/tests/ecma_2/LexicalConventions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/README b/mozilla/js/tests/ecma_2/README
new file mode 100755
index 00000000000..6da6cdd5149
--- /dev/null
+++ b/mozilla/js/tests/ecma_2/README
@@ -0,0 +1 @@
+ECMA 262 Edition 2
diff --git a/mozilla/js/tests/ecma_2/RegExp/browser.js b/mozilla/js/tests/ecma_2/RegExp/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/RegExp/constructor-001.js b/mozilla/js/tests/ecma_2/RegExp/constructor-001.js
index be904e57623..62f9a0686af 100644
--- a/mozilla/js/tests/ecma_2/RegExp/constructor-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/constructor-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/constructor-001.js
* ECMA Section: 15.7.3.3
@@ -6,61 +7,61 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/constructor-001";
- var VERSION = "ECMA_2";
- var TITLE = "new RegExp()";
+var SECTION = "RegExp/constructor-001";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp()";
- startTest();
+startTest();
- /*
- * for each test case, verify:
- * - verify that [[Class]] property is RegExp
- * - prototype property should be set to RegExp.prototype
- * - source is set to the empty string
- * - global property is set to false
- * - ignoreCase property is set to false
- * - multiline property is set to false
- * - lastIndex property is set to 0
- */
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
- RegExp.prototype.getClassProperty = Object.prototype.toString;
- var re = new RegExp();
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
- AddTestCase(
- "new RegExp().__proto__",
- RegExp.prototype,
- re.__proto__
- );
+AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
- AddTestCase(
- "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
- "(new RegExp()).getClassProperty()",
- "[object RegExp]",
- re.getClassProperty() );
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
- AddTestCase(
- "(new RegExp()).source",
- "",
- re.source );
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
- AddTestCase(
- "(new RegExp()).global",
- false,
- re.global );
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
- AddTestCase(
- "(new RegExp()).ignoreCase",
- false,
- re.ignoreCase );
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
- AddTestCase(
- "(new RegExp()).multiline",
- false,
- re.multiline );
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
- AddTestCase(
- "(new RegExp()).lastIndex",
- 0,
- re.lastIndex );
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
- test()
+test()
diff --git a/mozilla/js/tests/ecma_2/RegExp/exec-001.js b/mozilla/js/tests/ecma_2/RegExp/exec-001.js
index 69edc1103e4..10e139469f2 100644
--- a/mozilla/js/tests/ecma_2/RegExp/exec-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/exec-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/exec-001.js
* ECMA Section: 15.7.5.3
@@ -6,29 +7,29 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/exec-001";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp.prototype.exec(string)";
+var SECTION = "RegExp/exec-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
- startTest();
+startTest();
- /*
- * for each test case, verify:
- * - type of object returned
- * - length of the returned array
- * - value of lastIndex
- * - value of index
- * - value of input
- * - value of the array indices
- */
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
- // test cases without subpatterns
- // test cases with subpatterns
- // global property is true
- // global property is false
- // test cases in which the exec returns null
+// test cases without subpatterns
+// test cases with subpatterns
+// global property is true
+// global property is false
+// test cases in which the exec returns null
- testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
+// testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/RegExp/exec-002.js b/mozilla/js/tests/ecma_2/RegExp/exec-002.js
index c811b616551..14dfeb3a1d8 100644
--- a/mozilla/js/tests/ecma_2/RegExp/exec-002.js
+++ b/mozilla/js/tests/ecma_2/RegExp/exec-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/exec-002.js
* ECMA Section: 15.7.5.3
@@ -8,175 +9,175 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/exec-002";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp.prototype.exec(string)";
+var SECTION = "RegExp/exec-002";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp.prototype.exec(string)";
- startTest();
+startTest();
- /*
- * for each test case, verify:
- * - type of object returned
- * - length of the returned array
- * - value of lastIndex
- * - value of index
- * - value of input
- * - value of the array indices
- */
+/*
+ * for each test case, verify:
+ * - type of object returned
+ * - length of the returned array
+ * - value of lastIndex
+ * - value of index
+ * - value of input
+ * - value of the array indices
+ */
- AddRegExpCases(
- /(a|d|q|)x/i,
- "bcaDxqy",
- 3,
- ["Dx", "D"] );
+AddRegExpCases(
+ /(a|d|q|)x/i,
+ "bcaDxqy",
+ 3,
+ ["Dx", "D"] );
- AddRegExpCases(
- /(a|(e|q))(x|y)/,
- "bcaddxqy",
- 6,
- ["qy","q","q","y"] );
+AddRegExpCases(
+ /(a|(e|q))(x|y)/,
+ "bcaddxqy",
+ 6,
+ ["qy","q","q","y"] );
- AddRegExpCases(
- /a+b+d/,
- "aabbeeaabbs",
- 0,
- null );
+AddRegExpCases(
+ /a+b+d/,
+ "aabbeeaabbs",
+ 0,
+ null );
- AddRegExpCases(
- /a*b/,
- "aaadaabaaa",
- 4,
- ["aab"] );
+AddRegExpCases(
+ /a*b/,
+ "aaadaabaaa",
+ 4,
+ ["aab"] );
- AddRegExpCases(
- /a*b/,
- "dddb",
- 3,
- ["b"] );
+AddRegExpCases(
+ /a*b/,
+ "dddb",
+ 3,
+ ["b"] );
- AddRegExpCases(
- /a*b/,
- "xxx",
- 0,
- null );
+AddRegExpCases(
+ /a*b/,
+ "xxx",
+ 0,
+ null );
- AddRegExpCases(
- /x\d\dy/,
- "abcx45ysss235",
- 3,
- ["x45y"] );
+AddRegExpCases(
+ /x\d\dy/,
+ "abcx45ysss235",
+ 3,
+ ["x45y"] );
- AddRegExpCases(
- /[^abc]def[abc]+/,
- "abxdefbb",
- 2,
- ["xdefbb"] );
+AddRegExpCases(
+ /[^abc]def[abc]+/,
+ "abxdefbb",
+ 2,
+ ["xdefbb"] );
- AddRegExpCases(
- /(a*)baa/,
- "ccdaaabaxaabaa",
- 9,
- ["aabaa", "aa"] );
+AddRegExpCases(
+ /(a*)baa/,
+ "ccdaaabaxaabaa",
+ 9,
+ ["aabaa", "aa"] );
- AddRegExpCases(
- /(a*)baa/,
- "aabaa",
- 0,
- ["aabaa", "aa"] );
+AddRegExpCases(
+ /(a*)baa/,
+ "aabaa",
+ 0,
+ ["aabaa", "aa"] );
- AddRegExpCases(
- /q(a|b)*q/,
- "xxqababqyy",
- 2,
- ["qababq", "b"] );
+AddRegExpCases(
+ /q(a|b)*q/,
+ "xxqababqyy",
+ 2,
+ ["qababq", "b"] );
- AddRegExpCases(
- /(a(.|[^d])c)*/,
- "adcaxc",
- 0,
- ["adcaxc", "axc", "x"] );
+AddRegExpCases(
+ /(a(.|[^d])c)*/,
+ "adcaxc",
+ 0,
+ ["adcaxc", "axc", "x"] );
- AddRegExpCases(
- /(a*)b\1/,
- "abaaaxaabaayy",
- 0,
- ["aba", "a"] );
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
- AddRegExpCases(
- /(a*)b\1/,
- "abaaaxaabaayy",
- 0,
- ["aba", "a"] );
+AddRegExpCases(
+ /(a*)b\1/,
+ "abaaaxaabaayy",
+ 0,
+ ["aba", "a"] );
- AddRegExpCases(
- /(a*)b\1/,
- "cccdaaabaxaabaayy",
- 6,
- ["aba", "a"] );
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabaxaabaayy",
+ 6,
+ ["aba", "a"] );
- AddRegExpCases(
- /(a*)b\1/,
- "cccdaaabqxaabaayy",
- 7,
- ["b", ""] );
+AddRegExpCases(
+ /(a*)b\1/,
+ "cccdaaabqxaabaayy",
+ 7,
+ ["b", ""] );
- AddRegExpCases(
- /"(.|[^"\\\\])*"/,
+AddRegExpCases(
+ /"(.|[^"\\\\])*"/,
'xx\"makudonarudo\"yy',
2,
["\"makudonarudo\"", "o"] );
AddRegExpCases(
/"(.|[^"\\\\])*"/,
- "xx\"ma\"yy",
- 2,
- ["\"ma\"", "a"] );
+ "xx\"ma\"yy",
+ 2,
+ ["\"ma\"", "a"] );
- test();
+test();
function AddRegExpCases(
- regexp, pattern, index, matches_array ) {
+regexp, pattern, index, matches_array ) {
- // prevent a runtime error
+// prevent a runtime error
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + pattern +")",
- matches_array,
- regexp.exec(pattern) );
+if ( regexp.exec(pattern) == null || matches_array == null ) {
+AddTestCase(
+regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
- return;
- }
- AddTestCase(
- regexp + ".exec(" + pattern +").length",
- matches_array.length,
- regexp.exec(pattern).length );
+return;
+}
+AddTestCase(
+regexp + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
- AddTestCase(
- regexp + ".exec(" + pattern +").index",
- index,
- regexp.exec(pattern).index );
+AddTestCase(
+regexp + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
- AddTestCase(
- regexp + ".exec(" + pattern +").input",
- pattern,
- regexp.exec(pattern).input );
+AddTestCase(
+regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
- AddTestCase(
- regexp + ".exec(" + pattern +").toString()",
- matches_array.toString(),
- regexp.exec(pattern).toString() );
+AddTestCase(
+regexp + ".exec(" + pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
/*
- var limit = matches_array.length > regexp.exec(pattern).length
- ? matches_array.length
- : regexp.exec(pattern).length;
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- regexp + ".exec(" + pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
*/
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/function-001.js b/mozilla/js/tests/ecma_2/RegExp/function-001.js
index 67c4f21d493..ceae37fb66c 100644
--- a/mozilla/js/tests/ecma_2/RegExp/function-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/function-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/function-001.js
* ECMA Section: 15.7.2.1
@@ -6,61 +7,61 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/function-001";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp( pattern, flags )";
+var SECTION = "RegExp/function-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp( pattern, flags )";
- startTest();
+startTest();
- /*
- * for each test case, verify:
- * - verify that [[Class]] property is RegExp
- * - prototype property should be set to RegExp.prototype
- * - source is set to the empty string
- * - global property is set to false
- * - ignoreCase property is set to false
- * - multiline property is set to false
- * - lastIndex property is set to 0
- */
+/*
+ * for each test case, verify:
+ * - verify that [[Class]] property is RegExp
+ * - prototype property should be set to RegExp.prototype
+ * - source is set to the empty string
+ * - global property is set to false
+ * - ignoreCase property is set to false
+ * - multiline property is set to false
+ * - lastIndex property is set to 0
+ */
- RegExp.prototype.getClassProperty = Object.prototype.toString;
- var re = new RegExp();
+RegExp.prototype.getClassProperty = Object.prototype.toString;
+var re = new RegExp();
- AddTestCase(
- "new RegExp().__proto__",
- RegExp.prototype,
- re.__proto__
- );
+AddTestCase(
+ "new RegExp().__proto__",
+ RegExp.prototype,
+ re.__proto__
+ );
- AddTestCase(
- "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
- "(new RegExp()).getClassProperty()",
- "[object RegExp]",
- re.getClassProperty() );
+AddTestCase(
+ "RegExp.prototype.getClassProperty = Object.prototype.toString; " +
+ "(new RegExp()).getClassProperty()",
+ "[object RegExp]",
+ re.getClassProperty() );
- AddTestCase(
- "(new RegExp()).source",
- "",
- re.source );
+AddTestCase(
+ "(new RegExp()).source",
+ "",
+ re.source );
- AddTestCase(
- "(new RegExp()).global",
- false,
- re.global );
+AddTestCase(
+ "(new RegExp()).global",
+ false,
+ re.global );
- AddTestCase(
- "(new RegExp()).ignoreCase",
- false,
- re.ignoreCase );
+AddTestCase(
+ "(new RegExp()).ignoreCase",
+ false,
+ re.ignoreCase );
- AddTestCase(
- "(new RegExp()).multiline",
- false,
- re.multiline );
+AddTestCase(
+ "(new RegExp()).multiline",
+ false,
+ re.multiline );
- AddTestCase(
- "(new RegExp()).lastIndex",
- 0,
- re.lastIndex );
+AddTestCase(
+ "(new RegExp()).lastIndex",
+ 0,
+ re.lastIndex );
- test()
+test()
diff --git a/mozilla/js/tests/ecma_2/RegExp/hex-001.js b/mozilla/js/tests/ecma_2/RegExp/hex-001.js
index 122d59cd3df..6105c4e5d6a 100644
--- a/mozilla/js/tests/ecma_2/RegExp/hex-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/hex-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/hex-001.js
* ECMA Section: 15.7.3.1
@@ -6,58 +7,58 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/hex-001";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";
+var SECTION = "RegExp/hex-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain HexicdecimalEscapeSequences";
- startTest();
+startTest();
- // These examples come from 15.7.1, HexidecimalEscapeSequence
+// These examples come from 15.7.1, HexidecimalEscapeSequence
- AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );
- AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );
- AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );
+AddRegExpCases( new RegExp("\x41"), "new RegExp('\\x41')", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("\x412"),"new RegExp('\\x412')", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( new RegExp("\x1g"), "new RegExp('\\x1g')", "x1g","x1g", 1, 0, ["x1g"] );
- AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );
- AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );
- AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);
- AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x41", "\\x41", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "\x412", "\\x412", 1, 0, ["A"] );
+AddRegExpCases( new RegExp("^x"), "new RegExp('^x')", "x412", "x412", 1, 0, ["x"]);
+AddRegExpCases( new RegExp("A"), "new RegExp('A')", "A2", "A2", 1, 0, ["A"] );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
- // prevent a runtime error
-
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- str_regexp + ".exec(" + pattern +")",
- matches_array,
- regexp.exec(pattern) );
-
- return;
- }
+ // prevent a runtime error
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").length",
- length,
- regexp.exec(pattern).length );
+ str_regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+ return;
+ }
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").index",
- index,
- regexp.exec(pattern).index );
-
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").input",
- pattern,
- regexp.exec(pattern).input );
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/multiline-001.js b/mozilla/js/tests/ecma_2/RegExp/multiline-001.js
index 51a601cf105..4d337423809 100644
--- a/mozilla/js/tests/ecma_2/RegExp/multiline-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/multiline-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/multiline-001.js
* ECMA Section:
@@ -6,57 +7,57 @@
* Date: 19 February 1999
*/
- var SECTION = "RegExp/multiline-001";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp: multiline flag";
- var BUGNUMBER="343901";
+var SECTION = "RegExp/multiline-001";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp: multiline flag";
+var BUGNUMBER="343901";
- startTest();
+startTest();
- var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
- "northern flicker\npileated\n";
+var woodpeckers = "ivory-billed\ndowny\nhairy\nacorn\nyellow-bellied sapsucker\n" +
+"northern flicker\npileated\n";
- AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] );
+AddRegExpCases( /.*[y]$/m, woodpeckers, woodpeckers.indexOf("downy"), ["downy"] );
- AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] );
+AddRegExpCases( /.*[d]$/m, woodpeckers, woodpeckers.indexOf("ivory-billed"), ["ivory-billed"] );
- test();
+test();
function AddRegExpCases
- ( regexp, pattern, index, matches_array ) {
+( regexp, pattern, index, matches_array ) {
- // prevent a runtime error
-
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + pattern +")",
- matches_array,
- regexp.exec(pattern) );
-
- return;
- }
+ // prevent a runtime error
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
AddTestCase(
- regexp.toString() + ".exec(" + pattern +").length",
- matches_array.length,
- regexp.exec(pattern).length );
+ regexp + ".exec(" + pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+ return;
+ }
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ regexp.toString() + ".exec(" + pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ regexp + ".exec(" + pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- regexp.toString() + ".exec(" + pattern +").index",
- index,
- regexp.exec(pattern).index );
-
- AddTestCase(
- regexp + ".exec(" + pattern +").input",
- pattern,
- regexp.exec(pattern).input );
-
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- regexp + ".exec(" + pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ regexp + ".exec(" + pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/octal-001.js b/mozilla/js/tests/ecma_2/RegExp/octal-001.js
index d9d0571639d..d6b4a0afa39 100644
--- a/mozilla/js/tests/ecma_2/RegExp/octal-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/octal-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/octal-001.js
* ECMA Section: 15.7.1
@@ -6,67 +7,67 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/octal-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp patterns that contain OctalEscapeSequences";
- var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
+var SECTION = "RegExp/octal-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346196";
- startTest();
+startTest();
// backreference
- AddRegExpCases(
- /(.)\1/,
- "/(.)\\1/",
- "HI!!",
- "HI!",
- 2,
- ["!!", "!"] );
+AddRegExpCases(
+ /(.)\1/,
+ "/(.)\\1/",
+ "HI!!",
+ "HI!",
+ 2,
+ ["!!", "!"] );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
- // prevent a runtime error
+ // prevent a runtime error
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + str_pattern +")",
- matches_array,
- regexp.exec(pattern) );
-
- return;
- }
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").length",
- matches_array.length,
- regexp.exec(pattern).length );
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").index",
- index,
- regexp.exec(pattern).index );
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").input",
- pattern,
- regexp.exec(pattern).input );
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").toString()",
- matches_array.toString(),
- regexp.exec(pattern).toString() );
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
/*
- var limit = matches_array.length > regexp.exec(pattern).length
- ? matches_array.length
- : regexp.exec(pattern).length;
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
*/
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/octal-002.js b/mozilla/js/tests/ecma_2/RegExp/octal-002.js
index 69c810066e7..8339b61afc5 100644
--- a/mozilla/js/tests/ecma_2/RegExp/octal-002.js
+++ b/mozilla/js/tests/ecma_2/RegExp/octal-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/octal-002.js
* ECMA Section: 15.7.1
@@ -6,82 +7,82 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/octal-002.js";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp patterns that contain OctalEscapeSequences";
- var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189";
+var SECTION = "RegExp/octal-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346189";
- startTest();
+startTest();
// backreference
- AddRegExpCases(
- /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
- "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
- "aabbccaaabbbccc",
- "aabbccaaabbbccc",
- 0,
- ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaaabbbccc",
+ "aabbccaaabbbccc",
+ 0,
+ ["aabbccaaa", "a", "a", "b", "b", "c", "c", "a", "a"] );
- AddRegExpCases(
- /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
- "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
- "aabbccaabbcc",
- "aabbccaabbcc",
- 0,
- ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)\\9",
+ "aabbccaabbcc",
+ "aabbccaabbcc",
+ 0,
+ ["aabbccaabb", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
- AddRegExpCases(
- /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
- "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
- "aabbccaababcc",
- "aabbccaababcc",
- 0,
- ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
+AddRegExpCases(
+ /(.)(.)(.)(.)(.)(.)(.)(.)(.)\8/,
+ "/(.)(.)(.)(.)(.)(.)(.)(.)(.)\\8",
+ "aabbccaababcc",
+ "aabbccaababcc",
+ 0,
+ ["aabbccaaba", "a", "a", "b", "b", "c", "c", "a", "a", "b"] );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
- // prevent a runtime error
+ // prevent a runtime error
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + str_pattern +")",
- matches_array,
- regexp.exec(pattern) );
-
- return;
- }
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").length",
- matches_array.length,
- regexp.exec(pattern).length );
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").index",
- index,
- regexp.exec(pattern).index );
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").input",
- pattern,
- regexp.exec(pattern).input );
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").toString()",
- matches_array.toString(),
- regexp.exec(pattern).toString() );
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ regexp.exec(pattern).toString() );
/*
- var limit = matches_array.length > regexp.exec(pattern).length
- ? matches_array.length
- : regexp.exec(pattern).length;
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
*/
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/octal-003.js b/mozilla/js/tests/ecma_2/RegExp/octal-003.js
index ac6de01e88d..cc512f36af1 100644
--- a/mozilla/js/tests/ecma_2/RegExp/octal-003.js
+++ b/mozilla/js/tests/ecma_2/RegExp/octal-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/octal-003.js
* ECMA Section: 15.7.1
@@ -23,59 +24,59 @@
* See the testcase ecma_3/RegExp/octal-002.js for an elaboration.
*
*/
- var SECTION = "RegExp/octal-003.js";
- var VERSION = "ECMA_2";
- var TITLE = "RegExp patterns that contain OctalEscapeSequences";
- var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132";
+var SECTION = "RegExp/octal-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "RegExp patterns that contain OctalEscapeSequences";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=346132";
- startTest();
+startTest();
- AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null );
+AddRegExpCases( /.\011/, "/\\011/", "a" + String.fromCharCode(0) + "11", "a\\011", 0, null );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
+ regexp, str_regexp, pattern, str_pattern, index, matches_array ) {
- // prevent a runtime error
+ // prevent a runtime error
- if ( regexp.exec(pattern) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + str_pattern +")",
- matches_array,
- regexp.exec(pattern) );
-
- return;
- }
+ if ( regexp.exec(pattern) == null || matches_array == null ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").length",
- matches_array.length,
- regexp.exec(pattern).length );
+ regexp + ".exec(" + str_pattern +")",
+ matches_array,
+ regexp.exec(pattern) );
+ return;
+ }
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").length",
+ matches_array.length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").input",
+ escape(pattern),
+ escape(regexp.exec(pattern).input) );
+
+ AddTestCase(
+ str_regexp + ".exec(" + str_pattern +").toString()",
+ matches_array.toString(),
+ escape(regexp.exec(pattern).toString()) );
+
+ var limit = matches_array.length > regexp.exec(pattern).length
+ ? matches_array.length
+ : regexp.exec(pattern).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
AddTestCase(
- str_regexp + ".exec(" + str_pattern +").index",
- index,
- regexp.exec(pattern).index );
-
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").input",
- escape(pattern),
- escape(regexp.exec(pattern).input) );
-
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +").toString()",
- matches_array.toString(),
- escape(regexp.exec(pattern).toString()) );
-
- var limit = matches_array.length > regexp.exec(pattern).length
- ? matches_array.length
- : regexp.exec(pattern).length;
-
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
- matches_array[matches],
- escape(regexp.exec(pattern)[matches]) );
- }
+ str_regexp + ".exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ escape(regexp.exec(pattern)[matches]) );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/properties-001.js b/mozilla/js/tests/ecma_2/RegExp/properties-001.js
index 57638b6ed3e..b01325f609e 100644
--- a/mozilla/js/tests/ecma_2/RegExp/properties-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/properties-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/properties-001.js
* ECMA Section: 15.7.6.js
@@ -6,80 +7,80 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/properties-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "Properties of RegExp Instances";
- var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346000";
+var SECTION = "RegExp/properties-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "Properties of RegExp Instances";
+var BUGNUMBER ="http://scopus/bugsplat/show_bug.cgi?id=346000";
- startTest();
+startTest();
- AddRegExpCases( new RegExp, "", false, false, false, 0 );
- AddRegExpCases( /.*/, ".*", false, false, false, 0 );
- AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
- AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 );
- AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
- AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
- AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
- AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
+AddRegExpCases( new RegExp, "", false, false, false, 0 );
+AddRegExpCases( /.*/, ".*", false, false, false, 0 );
+AddRegExpCases( /[\d]{5}/g, "[\\d]{5}", true, false, false, 0 );
+AddRegExpCases( /[\S]?$/i, "[\\S]?$", false, true, false, 0 );
+AddRegExpCases( /^([a-z]*)[^\w\s\f\n\r]+/m, "^([a-z]*)[^\\w\\s\\f\\n\\r]+", false, false, true, 0 );
+AddRegExpCases( /[\D]{1,5}[\ -][\d]/gi, "[\\D]{1,5}[\\ -][\\d]", true, true, false, 0 );
+AddRegExpCases( /[a-zA-Z0-9]*/gm, "[a-zA-Z0-9]*", true, false, true, 0 );
+AddRegExpCases( /x|y|z/gim, "x|y|z", true, true, true, 0 );
- AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
- AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
- AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
+AddRegExpCases( /\u0051/im, "\\u0051", false, true, true, 0 );
+AddRegExpCases( /\x45/gm, "\\x45", true, false, true, 0 );
+AddRegExpCases( /\097/gi, "\\097", true, true, false, 0 );
- test();
+test();
function AddRegExpCases( re, s, g, i, m, l ) {
- AddTestCase( re + ".test == RegExp.prototype.test",
- true,
- re.test == RegExp.prototype.test );
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
- AddTestCase( re + ".toString == RegExp.prototype.toString",
- true,
- re.toString == RegExp.prototype.toString );
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
- AddTestCase( re + ".contructor == RegExp.prototype.constructor",
- true,
- re.constructor == RegExp.prototype.constructor );
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
- AddTestCase( re + ".compile == RegExp.prototype.compile",
- true,
- re.compile == RegExp.prototype.compile );
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
- AddTestCase( re + ".exec == RegExp.prototype.exec",
- true,
- re.exec == RegExp.prototype.exec );
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
- // properties
+ // properties
- AddTestCase( re + ".source",
- s,
- re.source );
+ AddTestCase( re + ".source",
+ s,
+ re.source );
/*
* http://bugzilla.mozilla.org/show_bug.cgi?id=225550 changed
* the behavior of toString() and toSource() on empty regexps.
* So branch if |s| is the empty string -
*/
-var S = s? s : '(?:)';
+ var S = s? s : '(?:)';
- AddTestCase( re + ".toString()",
- "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
- re.toString() );
+ AddTestCase( re + ".toString()",
+ "/" + S +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
- AddTestCase( re + ".global",
- g,
- re.global );
+ AddTestCase( re + ".global",
+ g,
+ re.global );
- AddTestCase( re + ".ignoreCase",
- i,
- re.ignoreCase );
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
- AddTestCase( re + ".multiline",
- m,
- re.multiline);
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
- AddTestCase( re + ".lastIndex",
- l,
- re.lastIndex );
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/properties-002.js b/mozilla/js/tests/ecma_2/RegExp/properties-002.js
index 2496d5fe3e2..78f52fa7941 100644
--- a/mozilla/js/tests/ecma_2/RegExp/properties-002.js
+++ b/mozilla/js/tests/ecma_2/RegExp/properties-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/properties-002.js
* ECMA Section: 15.7.6.js
@@ -6,7 +7,7 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- //-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
var SECTION = "RegExp/properties-002.js";
var VERSION = "ECMA_2";
var TITLE = "Properties of RegExp Instances";
@@ -77,49 +78,49 @@ test();
function AddRegExpCases( re, s, g, i, m, l ){
- AddTestCase( re + ".test == RegExp.prototype.test",
- true,
- re.test == RegExp.prototype.test );
+ AddTestCase( re + ".test == RegExp.prototype.test",
+ true,
+ re.test == RegExp.prototype.test );
- AddTestCase( re + ".toString == RegExp.prototype.toString",
- true,
- re.toString == RegExp.prototype.toString );
+ AddTestCase( re + ".toString == RegExp.prototype.toString",
+ true,
+ re.toString == RegExp.prototype.toString );
- AddTestCase( re + ".contructor == RegExp.prototype.constructor",
- true,
- re.constructor == RegExp.prototype.constructor );
+ AddTestCase( re + ".contructor == RegExp.prototype.constructor",
+ true,
+ re.constructor == RegExp.prototype.constructor );
- AddTestCase( re + ".compile == RegExp.prototype.compile",
- true,
- re.compile == RegExp.prototype.compile );
+ AddTestCase( re + ".compile == RegExp.prototype.compile",
+ true,
+ re.compile == RegExp.prototype.compile );
- AddTestCase( re + ".exec == RegExp.prototype.exec",
- true,
- re.exec == RegExp.prototype.exec );
+ AddTestCase( re + ".exec == RegExp.prototype.exec",
+ true,
+ re.exec == RegExp.prototype.exec );
- // properties
+ // properties
- AddTestCase( re + ".source",
- s,
- re.source );
+ AddTestCase( re + ".source",
+ s,
+ re.source );
- AddTestCase( re + ".toString()",
- "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
- re.toString() );
+ AddTestCase( re + ".toString()",
+ "/" + s +"/" + (g?"g":"") + (i?"i":"") +(m?"m":""),
+ re.toString() );
- AddTestCase( re + ".global",
- g,
- re.global );
+ AddTestCase( re + ".global",
+ g,
+ re.global );
- AddTestCase( re + ".ignoreCase",
- i,
- re.ignoreCase );
+ AddTestCase( re + ".ignoreCase",
+ i,
+ re.ignoreCase );
- AddTestCase( re + ".multiline",
- m,
- re.multiline);
+ AddTestCase( re + ".multiline",
+ m,
+ re.multiline);
- AddTestCase( re + ".lastIndex",
- l,
- re.lastIndex );
+ AddTestCase( re + ".lastIndex",
+ l,
+ re.lastIndex );
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/regexp-enumerate-001.js b/mozilla/js/tests/ecma_2/RegExp/regexp-enumerate-001.js
index 9752fa1cdef..1106f8b63b3 100644
--- a/mozilla/js/tests/ecma_2/RegExp/regexp-enumerate-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/regexp-enumerate-001.js
@@ -1,98 +1,83 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
- File Name: regexp-enumerate-001.js
- ECMA V2 Section:
- Description: Regression Test.
+ File Name: regexp-enumerate-001.js
+ ECMA V2 Section:
+ Description: Regression Test.
- If instance Native Object have properties that are enumerable,
- JavaScript enumerated through the properties twice. This only
- happened if objects had been instantiated, but their properties
- had not been enumerated. ie, the object inherited properties
- from its prototype that are enumerated.
+ If instance Native Object have properties that are enumerable,
+ JavaScript enumerated through the properties twice. This only
+ happened if objects had been instantiated, but their properties
+ had not been enumerated. ie, the object inherited properties
+ from its prototype that are enumerated.
- In the core JavaScript, this is only a problem with RegExp
- objects, since the inherited properties of most core JavaScript
- objects are not enumerated.
+ In the core JavaScript, this is only a problem with RegExp
+ objects, since the inherited properties of most core JavaScript
+ objects are not enumerated.
- Author: christine@netscape.com, pschwartau@netscape.com
- Date: 12 November 1997
- Modified: 14 July 2002
- Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
- ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5
- RegExp properties should be DontEnum
-*
-*/
+ Author: christine@netscape.com, pschwartau@netscape.com
+ Date: 12 November 1997
+ Modified: 14 July 2002
+ Reason: See http://bugzilla.mozilla.org/show_bug.cgi?id=155291
+ ECMA-262 Ed.3 Sections 15.10.7.1 through 15.10.7.5
+ RegExp properties should be DontEnum
+ *
+ */
// onerror = err;
- var SECTION = "regexp-enumerate-001";
- var VERSION = "ECMA_2";
- var TITLE = "Regression Test for Enumerating Properties";
+var SECTION = "regexp-enumerate-001";
+var VERSION = "ECMA_2";
+var TITLE = "Regression Test for Enumerating Properties";
- var BUGNUMBER="339403";
+var BUGNUMBER="339403";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- /*
- * This test expects RegExp instances to have four enumerated properties:
- * source, global, ignoreCase, and lastIndex
- *
- * 99.01.25: now they also have a multiLine instance property.
- *
- */
+/*
+ * This test expects RegExp instances to have four enumerated properties:
+ * source, global, ignoreCase, and lastIndex
+ *
+ * 99.01.25: now they also have a multiLine instance property.
+ *
+ */
- var r = new RegExp();
+var r = new RegExp();
- var e = new Array();
+var e = new Array();
- var t = new TestRegExp();
+var t = new TestRegExp();
- for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
+for ( p in r ) { e[e.length] = { property:p, value:r[p] }; t.addProperty( p, r[p]) };
- testcases[testcases.length] = new TestCase( SECTION,
- "r = new RegExp(); e = new Array(); "+
- "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
- 0,
- e.length );
+new TestCase( SECTION,
+ "r = new RegExp(); e = new Array(); "+
+ "for ( p in r ) { e[e.length] = { property:p, value:r[p] }; e.length",
+ 0,
+ e.length );
- test();
+test();
function TestRegExp() {
- this.addProperty = addProperty;
+ this.addProperty = addProperty;
}
function addProperty(name, value) {
- var pass = false;
+ var pass = false;
- if ( eval("this."+name) != void 0 ) {
- pass = true;
- } else {
- eval( "this."+ name+" = "+ false );
- }
+ if ( eval("this."+name) != void 0 ) {
+ pass = true;
+ } else {
+ eval( "this."+ name+" = "+ false );
+ }
- testcases[testcases.length] = new TestCase( SECTION,
- "Property: " + name +" already enumerated?",
- false,
- pass );
+ new TestCase( SECTION,
+ "Property: " + name +" already enumerated?",
+ false,
+ pass );
- if ( testcases[ testcases.length-1].passed == false ) {
- testcases[testcases.length-1].reason = "property already enumerated";
+ if ( testcases[ testcases.length-1].passed == false ) {
+ testcases[testcases.length-1].reason = "property already enumerated";
- }
+ }
}
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma_2/RegExp/regress-001.js b/mozilla/js/tests/ecma_2/RegExp/regress-001.js
index afd45fe0339..059d650f2ee 100644
--- a/mozilla/js/tests/ecma_2/RegExp/regress-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/regress-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/regress-001.js
* ECMA Section: N/A
@@ -8,32 +9,32 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/hex-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "JS regexp anchoring on empty match bug";
- var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=2157";
+var SECTION = "RegExp/hex-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "JS regexp anchoring on empty match bug";
+var BUGNUMBER = "http://bugzilla.mozilla.org/show_bug.cgi?id=2157";
- startTest();
+startTest();
- AddRegExpCases( /a||b/(''),
- "//a||b/('')",
- 1,
- [''] );
+AddRegExpCases( /a||b/(''),
+ "//a||b/('')",
+ 1,
+ [''] );
- test();
+test();
function AddRegExpCases( regexp, str_regexp, length, matches_array ) {
+ AddTestCase(
+ "( " + str_regexp + " ).length",
+ regexp.length,
+ regexp.length );
+
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- "( " + str_regexp + " ).length",
- regexp.length,
- regexp.length );
-
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- "( " + str_regexp + " )[" + matches +"]",
- matches_array[matches],
- regexp[matches] );
- }
+ "( " + str_regexp + " )[" + matches +"]",
+ matches_array[matches],
+ regexp[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/RegExp/shell.js b/mozilla/js/tests/ecma_2/RegExp/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/RegExp/unicode-001.js b/mozilla/js/tests/ecma_2/RegExp/unicode-001.js
index 17d05824568..bc2fd5773e3 100644
--- a/mozilla/js/tests/ecma_2/RegExp/unicode-001.js
+++ b/mozilla/js/tests/ecma_2/RegExp/unicode-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: RegExp/unicode-001.js
* ECMA Section: 15.7.3.1
@@ -6,48 +7,48 @@
* Author: christine@netscape.com
* Date: 19 February 1999
*/
- var SECTION = "RegExp/unicode-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "new RegExp( pattern, flags )";
+var SECTION = "RegExp/unicode-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "new RegExp( pattern, flags )";
- startTest();
+startTest();
- // These examples come from 15.7.1, UnicodeEscapeSequence
+// These examples come from 15.7.1, UnicodeEscapeSequence
- AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] );
- AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
- AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
- AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] );
+AddRegExpCases( /\u0041/, "/\\u0041/", "A", "A", 1, 0, ["A"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u00412/, "/\\u00412/", "A2", "A2", 1, 0, ["A2"] );
+AddRegExpCases( /\u001g/, "/\\u001g/", "u001g", "u001g", 1, 0, ["u001g"] );
- AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] );
- AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] );
- AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]);
- AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] );
+AddRegExpCases( /A/, "/A/", "\u0041", "\\u0041", 1, 0, ["A"] );
+AddRegExpCases( /A/, "/A/", "\u00412", "\\u00412", 1, 0, ["A"] );
+AddRegExpCases( /A2/, "/A2/", "\u00412", "\\u00412", 1, 0, ["A2"]);
+AddRegExpCases( /A/, "/A/", "A2", "A2", 1, 0, ["A"] );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+ regexp, str_regexp, pattern, str_pattern, length, index, matches_array ) {
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").length",
+ length,
+ regexp.exec(pattern).length );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").index",
+ index,
+ regexp.exec(pattern).index );
+
+ AddTestCase(
+ str_regexp + " .exec(" + str_pattern +").input",
+ pattern,
+ regexp.exec(pattern).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- str_regexp + " .exec(" + str_pattern +").length",
- length,
- regexp.exec(pattern).length );
-
- AddTestCase(
- str_regexp + " .exec(" + str_pattern +").index",
- index,
- regexp.exec(pattern).index );
-
- AddTestCase(
- str_regexp + " .exec(" + str_pattern +").input",
- pattern,
- regexp.exec(pattern).input );
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- str_regexp + " .exec(" + str_pattern +")[" + matches +"]",
- matches_array[matches],
- regexp.exec(pattern)[matches] );
- }
+ str_regexp + " .exec(" + str_pattern +")[" + matches +"]",
+ matches_array[matches],
+ regexp.exec(pattern)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/Statements/browser.js b/mozilla/js/tests/ecma_2/Statements/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-001.js b/mozilla/js/tests/ecma_2/Statements/dowhile-001.js
index ffd53009b2c..c4d5ce11d63 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-001
* ECMA Section:
@@ -8,34 +9,31 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "dowhile-002";
- var VERSION = "ECMA_2";
- var TITLE = "do...while with a labeled continue statement";
+var SECTION = "dowhile-002";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+LabeledContinue( 0, 1 );
+LabeledContinue( 1, 1 );
+LabeledContinue( -1, 1 );
+LabeledContinue( 5, 5 );
- LabeledContinue( 0, 1 );
- LabeledContinue( 1, 1 );
- LabeledContinue( -1, 1 );
- LabeledContinue( 5, 5 );
-
- test();
+test();
function LabeledContinue( limit, expect ) {
- i = 0;
- woohoo:
- do {
- i++;
- continue woohoo;
- } while ( i < limit );
+ i = 0;
+woohoo:
+ do {
+ i++;
+ continue woohoo;
+ } while ( i < limit );
- testcases[tc++] = new TestCase(
- SECTION,
- "do while ( " + i +" < " + limit +" )",
- expect,
- i );
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-002.js b/mozilla/js/tests/ecma_2/Statements/dowhile-002.js
index e921b49f005..1d6c84928fc 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-002.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-002
* ECMA Section:
@@ -10,59 +11,56 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "dowhile-002";
- var VERSION = "ECMA_2";
- var TITLE = "do...while with a labeled continue statement";
+var SECTION = "dowhile-002";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+LabeledContinue( 0, 1 );
+LabeledContinue( 1, 1 );
+LabeledContinue( -1, 1 );
+LabeledContinue( 5, 5 );
- LabeledContinue( 0, 1 );
- LabeledContinue( 1, 1 );
- LabeledContinue( -1, 1 );
- LabeledContinue( 5, 5 );
+test();
- test();
-
-// The labeled statment contains statements after the labeled break.
+// The labeled statement contains statements after the labeled break.
// Verify that the statements after the break are not executed.
function LabeledContinue( limit, expect ) {
- i = 0;
- result1 = "pass";
- result2 = "pass";
+ i = 0;
+ result1 = "pass";
+ result2 = "pass";
- woohoo: {
- do {
- i++;
- if ( ! (i < limit) ) {
- break woohoo;
- result1 = "fail: evaluated statement after a labeled break";
- }
- } while ( true );
+woohoo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break woohoo;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
- result2 = "failed: broke out of loop, but not out of labeled block";
- }
+ result2 = "failed: broke out of loop, but not out of labeled block";
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- "do while ( " + i +" < " + limit +" )",
- expect,
- i );
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
- testcases[tc++] = new TestCase(
- SECTION,
- "breaking out of a do... while loop",
- "pass",
- result1 );
+ new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
- testcases[tc++] = new TestCase(
- SECTION,
- "breaking out of a labeled do...while loop",
- "pass",
- result2 );
+ new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-003.js b/mozilla/js/tests/ecma_2/Statements/dowhile-003.js
index a1ca517d911..fee66f2a477 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-003.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-003
* ECMA Section:
@@ -9,52 +10,49 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "dowhile-003";
- var VERSION = "ECMA_2";
- var TITLE = "do...while with a labeled continue statement";
+var SECTION = "dowhile-003";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( new DoWhileObject( 1, 1, 0 ));
+DoWhile( new DoWhileObject( 1000, 1000, 0 ));
+DoWhile( new DoWhileObject( 1001, 1001, 0 ));
+DoWhile( new DoWhileObject( 1002, 1001, 1 ));
+DoWhile( new DoWhileObject( -1, 1001, -1002 ));
- DoWhile( new DoWhileObject( 1, 1, 0 ));
- DoWhile( new DoWhileObject( 1000, 1000, 0 ));
- DoWhile( new DoWhileObject( 1001, 1001, 0 ));
- DoWhile( new DoWhileObject( 1002, 1001, 1 ));
- DoWhile( new DoWhileObject( -1, 1001, -1002 ));
-
- test();
+test();
function DoWhileObject( value, iterations, endvalue ) {
- this.value = value;
- this.iterations = iterations;
- this.endvalue = endvalue;
+ this.value = value;
+ this.iterations = iterations;
+ this.endvalue = endvalue;
}
function DoWhile( object ) {
- var i = 0;
+ var i = 0;
- do {
- object.value = --object.value;
- i++;
- if ( i > 1000 )
- break;
- } while( object.value );
+ do {
+ object.value = --object.value;
+ i++;
+ if ( i > 1000 )
+ break;
+ } while( object.value );
- testcases[tc++] = new TestCase(
- SECTION,
- "loop iterations",
- object.iterations,
- i
+ new TestCase(
+ SECTION,
+ "loop iterations",
+ object.iterations,
+ i
);
- testcases[tc++] = new TestCase(
- SECTION,
- "object.value",
- object.endvalue,
- Number( object.value )
+ new TestCase(
+ SECTION,
+ "object.value",
+ object.endvalue,
+ Number( object.value )
);
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-004.js b/mozilla/js/tests/ecma_2/Statements/dowhile-004.js
index 3c96fc48ccb..e75a380a654 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-004.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-004
* ECMA Section:
@@ -9,56 +10,53 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "dowhile-004";
- var VERSION = "ECMA_2";
- var TITLE = "do...while with a labeled continue statement";
+var SECTION = "dowhile-004";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( 0, 1 );
+DoWhile( 1, 1 );
+DoWhile( -1, 1 );
+DoWhile( 5, 5 );
- DoWhile( 0, 1 );
- DoWhile( 1, 1 );
- DoWhile( -1, 1 );
- DoWhile( 5, 5 );
-
- test();
+test();
function DoWhile( limit, expect ) {
- i = 0;
- result1 = "pass";
- result2 = "failed: broke out of labeled statement unexpectedly";
+ i = 0;
+ result1 = "pass";
+ result2 = "failed: broke out of labeled statement unexpectedly";
- foo: {
- do {
- i++;
- if ( ! (i < limit) ) {
- break;
- result1 = "fail: evaluated statement after a labeled break";
- }
- } while ( true );
+foo: {
+ do {
+ i++;
+ if ( ! (i < limit) ) {
+ break;
+ result1 = "fail: evaluated statement after a labeled break";
+ }
+ } while ( true );
- result2 = "pass";
- }
+ result2 = "pass";
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- "do while ( " + i +" < " + limit +" )",
- expect,
- i );
+ new TestCase(
+ SECTION,
+ "do while ( " + i +" < " + limit +" )",
+ expect,
+ i );
- testcases[tc++] = new TestCase(
- SECTION,
- "breaking out of a do... while loop",
- "pass",
- result1 );
+ new TestCase(
+ SECTION,
+ "breaking out of a do... while loop",
+ "pass",
+ result1 );
- testcases[tc++] = new TestCase(
- SECTION,
- "breaking out of a labeled do...while loop",
- "pass",
- result2 );
+ new TestCase(
+ SECTION,
+ "breaking out of a labeled do...while loop",
+ "pass",
+ result2 );
}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-005.js b/mozilla/js/tests/ecma_2/Statements/dowhile-005.js
index ce56cb9942a..a08da1aba61 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-005.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-005.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-005
* ECMA Section:
@@ -12,59 +13,56 @@
* Author: christine@netscape.com
* Date: 26 August 1998
*/
- var SECTION = "dowhile-005";
- var VERSION = "ECMA_2";
- var TITLE = "do...while with a labeled continue statement";
- var BUGNUMBER = "316293";
+var SECTION = "dowhile-005";
+var VERSION = "ECMA_2";
+var TITLE = "do...while with a labeled continue statement";
+var BUGNUMBER = "316293";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- NestedLabel();
+NestedLabel();
- test();
+test();
- function NestedLabel() {
- i = 0;
- result1 = "pass";
- result2 = "fail: did not hit code after inner loop";
- result3 = "pass";
+function NestedLabel() {
+ i = 0;
+ result1 = "pass";
+ result2 = "fail: did not hit code after inner loop";
+ result3 = "pass";
- outer: {
- do {
- inner: {
+outer: {
+ do {
+ inner: {
// print( i );
- break inner;
- result1 = "fail: did break out of inner label";
- }
- result2 = "pass";
- break outer;
- print (i);
- } while ( i++ < 100 );
+ break inner;
+ result1 = "fail: did break out of inner label";
+ }
+ result2 = "pass";
+ break outer;
+ writeLineToLog(i);
+ } while ( i++ < 100 );
- }
+ }
- result3 = "fail: did not break out of outer label";
+ result3 = "fail: did not break out of outer label";
- testcases[tc++] = new TestCase(
- SECTION,
- "number of loop iterations",
- 0,
- i );
+ new TestCase(
+ SECTION,
+ "number of loop iterations",
+ 0,
+ i );
- testcases[tc++] = new TestCase(
- SECTION,
- "break out of inner loop",
- "pass",
- result1 );
+ new TestCase(
+ SECTION,
+ "break out of inner loop",
+ "pass",
+ result1 );
- testcases[tc++] = new TestCase(
- SECTION,
- "break out of outer loop",
- "pass",
- result2 );
- }
\ No newline at end of file
+ new TestCase(
+ SECTION,
+ "break out of outer loop",
+ "pass",
+ result2 );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-006.js b/mozilla/js/tests/ecma_2/Statements/dowhile-006.js
index 67dce64f3a6..2c2709c04f7 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-006.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-006.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-006
* ECMA Section:
@@ -8,79 +9,76 @@
* Author: christine@netscape.com
* Date: 26 August 1998
*/
- var SECTION = "dowhile-006";
- var VERSION = "ECMA_2";
- var TITLE = "do...while";
+var SECTION = "dowhile-006";
+var VERSION = "ECMA_2";
+var TITLE = "do...while";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( new DoWhileObject( false, false, 10 ) );
+DoWhile( new DoWhileObject( true, false, 2 ) );
+DoWhile( new DoWhileObject( false, true, 3 ) );
+DoWhile( new DoWhileObject( true, true, 4 ) );
- DoWhile( new DoWhileObject( false, false, 10 ) );
- DoWhile( new DoWhileObject( true, false, 2 ) );
- DoWhile( new DoWhileObject( false, true, 3 ) );
- DoWhile( new DoWhileObject( true, true, 4 ) );
-
- test();
+test();
function looping( object ) {
- object.iterations--;
+ object.iterations--;
- if ( object.iterations <= 0 ) {
- return false;
- } else {
- return true;
- }
+ if ( object.iterations <= 0 ) {
+ return false;
+ } else {
+ return true;
+ }
}
function DoWhileObject( breakOut, breakIn, iterations, loops ) {
- this.iterations = iterations;
- this.loops = loops;
- this.breakOut = breakOut;
- this.breakIn = breakIn;
- this.looping = looping;
+ this.iterations = iterations;
+ this.loops = loops;
+ this.breakOut = breakOut;
+ this.breakIn = breakIn;
+ this.looping = looping;
}
function DoWhile( object ) {
- var result1 = false;
- var result2 = false;
+ var result1 = false;
+ var result2 = false;
- outie: {
- innie: {
- do {
- if ( object.breakOut )
- break outie;
+outie: {
+innie: {
+ do {
+ if ( object.breakOut )
+ break outie;
- if ( object.breakIn )
- break innie;
+ if ( object.breakIn )
+ break innie;
- } while ( looping(object) );
+ } while ( looping(object) );
- // statements should be executed if:
- // do...while exits normally
- // do...while exits abruptly with no label
+ // statements should be executed if:
+ // do...while exits normally
+ // do...while exits abruptly with no label
- result1 = true;
+ result1 = true;
- }
-
- // statements should be executed if:
- // do...while breaks out with label "innie"
- // do...while exits normally
- // do...while does not break out with "outie"
-
- result2 = true;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "hit code after loop in inner loop",
- ( object.breakIn || object.breakOut ) ? false : true ,
- result1 );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "hit code after loop in outer loop",
- ( object.breakOut ) ? false : true,
- result2 );
+}
+
+// statements should be executed if:
+// do...while breaks out with label "innie"
+// do...while exits normally
+// do...while does not break out with "outie"
+
+result2 = true;
+ }
+
+ new TestCase(
+ SECTION,
+ "hit code after loop in inner loop",
+ ( object.breakIn || object.breakOut ) ? false : true ,
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "hit code after loop in outer loop",
+ ( object.breakOut ) ? false : true,
+ result2 );
}
diff --git a/mozilla/js/tests/ecma_2/Statements/dowhile-007.js b/mozilla/js/tests/ecma_2/Statements/dowhile-007.js
index 849e70e1247..b56a632112a 100644
--- a/mozilla/js/tests/ecma_2/Statements/dowhile-007.js
+++ b/mozilla/js/tests/ecma_2/Statements/dowhile-007.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: dowhile-007
* ECMA Section:
@@ -8,87 +9,84 @@
* Author: christine@netscape.com
* Date: 26 August 1998
*/
- var SECTION = "dowhile-007";
- var VERSION = "ECMA_2";
- var TITLE = "do...while";
+var SECTION = "dowhile-007";
+var VERSION = "ECMA_2";
+var TITLE = "do...while";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( new DoWhileObject( false, false, false, false ));
+DoWhile( new DoWhileObject( true, false, false, false ));
+DoWhile( new DoWhileObject( true, true, false, false ));
+DoWhile( new DoWhileObject( true, true, true, false ));
+DoWhile( new DoWhileObject( true, true, true, true ));
+DoWhile( new DoWhileObject( false, false, false, true ));
+DoWhile( new DoWhileObject( false, false, true, true ));
+DoWhile( new DoWhileObject( false, true, true, true ));
+DoWhile( new DoWhileObject( false, false, true, false ));
- DoWhile( new DoWhileObject( false, false, false, false ));
- DoWhile( new DoWhileObject( true, false, false, false ));
- DoWhile( new DoWhileObject( true, true, false, false ));
- DoWhile( new DoWhileObject( true, true, true, false ));
- DoWhile( new DoWhileObject( true, true, true, true ));
- DoWhile( new DoWhileObject( false, false, false, true ));
- DoWhile( new DoWhileObject( false, false, true, true ));
- DoWhile( new DoWhileObject( false, true, true, true ));
- DoWhile( new DoWhileObject( false, false, true, false ));
-
- test();
+test();
function DoWhileObject( out1, out2, out3, in1 ) {
- this.breakOutOne = out1;
- this.breakOutTwo = out2;
- this.breakOutThree = out3;
- this.breakIn = in1;
+ this.breakOutOne = out1;
+ this.breakOutTwo = out2;
+ this.breakOutThree = out3;
+ this.breakIn = in1;
}
function DoWhile( object ) {
- result1 = false;
- result2 = false;
- result3 = false;
- result4 = false;
+ result1 = false;
+ result2 = false;
+ result3 = false;
+ result4 = false;
- outie:
- do {
- if ( object.breakOutOne ) {
- break outie;
- }
- result1 = true;
+outie:
+ do {
+ if ( object.breakOutOne ) {
+ break outie;
+ }
+ result1 = true;
- innie:
- do {
- if ( object.breakOutTwo ) {
- break outie;
- }
- result2 = true;
+ innie:
+ do {
+ if ( object.breakOutTwo ) {
+ break outie;
+ }
+ result2 = true;
- if ( object.breakIn ) {
- break innie;
- }
- result3 = true;
+ if ( object.breakIn ) {
+ break innie;
+ }
+ result3 = true;
- } while ( false );
- if ( object.breakOutThree ) {
- break outie;
- }
- result4 = true;
- } while ( false );
+ } while ( false );
+ if ( object.breakOutThree ) {
+ break outie;
+ }
+ result4 = true;
+ } while ( false );
- testcases[tc++] = new TestCase(
- SECTION,
- "break one: ",
- (object.breakOutOne) ? false : true,
- result1 );
+ new TestCase(
+ SECTION,
+ "break one: ",
+ (object.breakOutOne) ? false : true,
+ result1 );
- testcases[tc++] = new TestCase(
- SECTION,
- "break two: ",
- (object.breakOutOne||object.breakOutTwo) ? false : true,
- result2 );
+ new TestCase(
+ SECTION,
+ "break two: ",
+ (object.breakOutOne||object.breakOutTwo) ? false : true,
+ result2 );
- testcases[tc++] = new TestCase(
- SECTION,
- "break three: ",
- (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true,
- result3 );
+ new TestCase(
+ SECTION,
+ "break three: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakIn) ? false : true,
+ result3 );
- testcases[tc++] = new TestCase(
- SECTION,
- "break four: ",
- (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true,
- result4 );
+ new TestCase(
+ SECTION,
+ "break four: ",
+ (object.breakOutOne||object.breakOutTwo||object.breakOutThree) ? false: true,
+ result4 );
}
diff --git a/mozilla/js/tests/ecma_2/Statements/forin-001.js b/mozilla/js/tests/ecma_2/Statements/forin-001.js
index 63119af6e38..3745888e67b 100644
--- a/mozilla/js/tests/ecma_2/Statements/forin-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/forin-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: forin-001.js
* ECMA Section:
@@ -18,9 +19,6 @@
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
ForIn_1( { length:4, company:"netscape", year:2000, 0:"zero" } );
ForIn_2( { length:4, company:"netscape", year:2000, 0:"zero" } );
ForIn_3( { length:4, company:"netscape", year:2000, 0:"zero" } );
@@ -47,7 +45,7 @@
}
for ( var i = 0; i < PropertyArray.length; i++ ) {
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object[" + PropertyArray[i] +"]",
object[PropertyArray[i]],
@@ -55,7 +53,7 @@
);
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object.length",
PropertyArray.length,
@@ -77,7 +75,7 @@
}
for ( i = 0; i < PropertyArray.length; i++ ) {
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object[" + PropertyArray[i] +"]",
object[PropertyArray[i]],
@@ -85,7 +83,7 @@
);
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object.length",
PropertyArray.length,
@@ -108,19 +106,19 @@
checkBreak = "fail";
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"check break out of for...in",
"pass",
checkBreak );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"properties.length",
1,
properties.length );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object["+properties[0]+"]",
values[0],
@@ -149,25 +147,25 @@
result3++;
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify labeled statement is only executed once",
true,
result1 == 1 );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify statements in for loop are evaluated",
true,
result2 == i );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled for...in loop",
true,
result4 == 0 );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled block",
true,
@@ -195,25 +193,25 @@
result3++;
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify labeled statement is only executed once",
true,
result1 == 1 );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify statements in for loop are evaluated",
true,
result2 == i );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled for...in loop",
true,
result4 == 0 );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled block",
true,
@@ -238,19 +236,19 @@
result4++;
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify statements in for loop are evaluated",
true,
result2 == i );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled for...in loop",
true,
result4 == 0 );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"verify break out of labeled block",
true,
@@ -273,19 +271,19 @@
checkBreak = "fail";
}
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"check break out of for...in",
"pass",
checkBreak );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"properties.length",
1,
properties.length );
- testcases[tc++] = new TestCase(
+ new TestCase(
SECTION,
"object["+properties[0]+"]",
values[0],
diff --git a/mozilla/js/tests/ecma_2/Statements/forin-002.js b/mozilla/js/tests/ecma_2/Statements/forin-002.js
index 1f527a9ae1d..4c678a2d5fa 100644
--- a/mozilla/js/tests/ecma_2/Statements/forin-002.js
+++ b/mozilla/js/tests/ecma_2/Statements/forin-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: forin-002.js
* ECMA Section:
@@ -9,65 +10,62 @@
* Author: christine@netscape.com
* Date: 28 August 1998
*/
- var SECTION = "forin-002";
- var VERSION = "ECMA_2";
- var TITLE = "The for...in statement";
+var SECTION = "forin-002";
+var VERSION = "ECMA_2";
+var TITLE = "The for...in statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function MyObject( value ) {
+ this.value = value;
+ this.valueOf = new Function ( "return this.value" );
+ this.toString = new Function ( "return this.value + \"\"" );
+ this.toNumber = new Function ( "return this.value + 0" );
+ this.toBoolean = new Function ( "return Boolean( this.value )" );
+}
- function MyObject( value ) {
- this.value = value;
- this.valueOf = new Function ( "return this.value" );
- this.toString = new Function ( "return this.value + \"\"" );
- this.toNumber = new Function ( "return this.value + 0" );
- this.toBoolean = new Function ( "return Boolean( this.value )" );
+ForIn_1(this);
+ForIn_2(this);
+
+ForIn_1(new MyObject(true));
+ForIn_2(new MyObject(new Boolean(true)));
+
+ForIn_2(3);
+
+test();
+
+/**
+ * For ... In in a With Block
+ *
+ */
+function ForIn_1( object) {
+ with ( object ) {
+ for ( property in object ) {
+ new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
}
+ }
+}
- ForIn_1(this);
- ForIn_2(this);
-
- ForIn_1(new MyObject(true));
- ForIn_2(new MyObject(new Boolean(true)));
-
- ForIn_2(3);
-
- test();
-
- /**
- * For ... In in a With Block
- *
- */
- function ForIn_1( object) {
- with ( object ) {
- for ( property in object ) {
- testcases[tc++] = new TestCase(
- SECTION,
- "with loop in a for...in loop. ("+object+")["+property +"] == "+
- "eval ( " + property +" )",
- true,
- object[property] == eval(property) );
- }
- }
- }
-
- /**
- * With block in a For...In loop
- *
- */
- function ForIn_2(object) {
- for ( property in object ) {
- with ( object ) {
- testcases[tc++] = new TestCase(
- SECTION,
- "with loop in a for...in loop. ("+object+")["+property +"] == "+
- "eval ( " + property +" )",
- true,
- object[property] == eval(property) );
- }
- }
+/**
+ * With block in a For...In loop
+ *
+ */
+function ForIn_2(object) {
+ for ( property in object ) {
+ with ( object ) {
+ new TestCase(
+ SECTION,
+ "with loop in a for...in loop. ("+object+")["+property +"] == "+
+ "eval ( " + property +" )",
+ true,
+ object[property] == eval(property) );
}
+ }
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/if-001.js b/mozilla/js/tests/ecma_2/Statements/if-001.js
index 0da212d39fa..c5a9f43875f 100644
--- a/mozilla/js/tests/ecma_2/Statements/if-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/if-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: if-001.js
* ECMA Section:
@@ -9,31 +10,28 @@
* Author: christine@netscape.com
* Date: 28 August 1998
*/
- var SECTION = "for-001";
- var VERSION = "ECMA_2";
- var TITLE = "The if statement";
- var BUGNUMBER="148822";
+var SECTION = "for-001";
+var VERSION = "ECMA_2";
+var TITLE = "The if statement";
+var BUGNUMBER="148822";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var a = 0;
+var b = 0;
+var result = "passed";
- var a = 0;
- var b = 0;
- var result = "passed";
+if ( a = b ) {
+ result = "failed: a = b should return 0";
+}
- if ( a = b ) {
- result = "failed: a = b should return 0";
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "if ( a = b ), where a and b are both equal to 0",
- "passed",
- result );
+new TestCase(
+ SECTION,
+ "if ( a = b ), where a and b are both equal to 0",
+ "passed",
+ result );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Statements/label-001.js b/mozilla/js/tests/ecma_2/Statements/label-001.js
index 83b51ce665f..14d7d93be45 100644
--- a/mozilla/js/tests/ecma_2/Statements/label-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/label-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: label-001.js
* ECMA Section:
@@ -9,31 +10,28 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "label-003";
- var VERSION = "ECMA_2";
- var TITLE = "Labeled statements";
+var SECTION = "label-003";
+var VERSION = "ECMA_2";
+var TITLE = "Labeled statements";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+LabelTest(0, 0);
+LabelTest(1, 1)
+ LabelTest(-1, 1000);
+LabelTest(false, 0);
+LabelTest(true, 1);
- LabelTest(0, 0);
- LabelTest(1, 1)
- LabelTest(-1, 1000);
- LabelTest(false, 0);
- LabelTest(true, 1);
+test();
- test();
+function LabelTest( limit, expect) {
+woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } };
- function LabelTest( limit, expect) {
- woo: for ( var result = 0; result < 1000; result++ ) { if (result == limit) { break woo; } else { continue woo; } };
-
- testcases[tc++] = new TestCase(
- SECTION,
- "break out of a labeled for loop: "+ limit,
- expect,
- result );
- }
+new TestCase(
+ SECTION,
+ "break out of a labeled for loop: "+ limit,
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/label-002.js b/mozilla/js/tests/ecma_2/Statements/label-002.js
index 64b01a8c152..82e2fdf57a9 100644
--- a/mozilla/js/tests/ecma_2/Statements/label-002.js
+++ b/mozilla/js/tests/ecma_2/Statements/label-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: label-002.js
* ECMA Section:
@@ -9,45 +10,42 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "label-002";
- var VERSION = "ECMA_2";
- var TITLE = "Labeled statements";
+var SECTION = "label-002";
+var VERSION = "ECMA_2";
+var TITLE = "Labeled statements";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
+LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
- LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
- LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
+LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
+LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
- LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
- LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
+test();
- test();
+function LabelTest( object, expect1, expect2 ) {
+ result = "";
- function LabelTest( object, expect1, expect2 ) {
- result = "";
+yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
- yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
+ new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
+ true,
+ result == expect1 || result == expect2 );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
- true,
- result == expect1 || result == expect2 );
- }
+function LabelTest2( object, expect1, expect2 ) {
+ result = "";
- function LabelTest2( object, expect1, expect2 ) {
- result = "";
+yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
- yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
-
- testcases[tc++] = new TestCase(
- SECTION,
- "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
- true,
- result == expect1 || result == expect2 );
- }
+new TestCase(
+ SECTION,
+ "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
+ true,
+ result == expect1 || result == expect2 );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/shell.js b/mozilla/js/tests/ecma_2/Statements/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/Statements/switch-001.js b/mozilla/js/tests/ecma_2/Statements/switch-001.js
index 6336518a78a..3f97cd5bf36 100644
--- a/mozilla/js/tests/ecma_2/Statements/switch-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/switch-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: switch-001.js
* ECMA Section:
@@ -9,56 +10,51 @@
* Date: 11 August 1998
*
*/
- var SECTION = "switch-001";
- var VERSION = "ECMA_2";
- var TITLE = "The switch statement";
+var SECTION = "switch-001";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
- var BUGNUMBER="315767";
+var BUGNUMBER="315767";
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
+SwitchTest( 0, 126 );
+SwitchTest( 1, 124 );
+SwitchTest( 2, 120 );
+SwitchTest( 3, 112 );
+SwitchTest( 4, 64 );
+SwitchTest( 5, 96 );
+SwitchTest( true, 96 );
+SwitchTest( false, 96 );
+SwitchTest( null, 96 );
+SwitchTest( void 0, 96 );
+SwitchTest( "0", 96 );
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+test();
- var tc = 0;
- var testcases = new Array();
+function SwitchTest( input, expect ) {
+ var result = 0;
- SwitchTest( 0, 126 );
- SwitchTest( 1, 124 );
- SwitchTest( 2, 120 );
- SwitchTest( 3, 112 );
- SwitchTest( 4, 64 );
- SwitchTest( 5, 96 );
- SwitchTest( true, 96 );
- SwitchTest( false, 96 );
- SwitchTest( null, 96 );
- SwitchTest( void 0, 96 );
- SwitchTest( "0", 96 );
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ case 4:
+ result +=64;
+ }
- test();
-
- function SwitchTest( input, expect ) {
- var result = 0;
-
- switch ( input ) {
- case 0:
- result += 2;
- case 1:
- result += 4;
- case 2:
- result += 8;
- case 3:
- result += 16;
- default:
- result += 32;
- case 4:
- result +=64;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "switch with no breaks, case expressions are numbers. input is "+
- input,
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "switch with no breaks, case expressions are numbers. input is "+
+ input,
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/switch-002.js b/mozilla/js/tests/ecma_2/Statements/switch-002.js
index 20746a804a8..76b51c877cf 100644
--- a/mozilla/js/tests/ecma_2/Statements/switch-002.js
+++ b/mozilla/js/tests/ecma_2/Statements/switch-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: switch-002.js
* ECMA Section:
@@ -9,52 +10,49 @@
* Date: 11 August 1998
*
*/
- var SECTION = "switch-002";
- var VERSION = "ECMA_2";
- var TITLE = "The switch statement";
+var SECTION = "switch-002";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+SwitchTest( 0, 6 );
+SwitchTest( 1, 4 );
+SwitchTest( 2, 56 );
+SwitchTest( 3, 48 );
+SwitchTest( 4, 64 );
+SwitchTest( true, 32 );
+SwitchTest( false, 32 );
+SwitchTest( null, 32 );
+SwitchTest( void 0, 32 );
+SwitchTest( "0", 32 );
- SwitchTest( 0, 6 );
- SwitchTest( 1, 4 );
- SwitchTest( 2, 56 );
- SwitchTest( 3, 48 );
- SwitchTest( 4, 64 );
- SwitchTest( true, 32 );
- SwitchTest( false, 32 );
- SwitchTest( null, 32 );
- SwitchTest( void 0, 32 );
- SwitchTest( "0", 32 );
+test();
- test();
+function SwitchTest( input, expect ) {
+ var result = 0;
- function SwitchTest( input, expect ) {
- var result = 0;
+ switch ( input ) {
+ case 0:
+ result += 2;
+ case 1:
+ result += 4;
+ break;
+ case 2:
+ result += 8;
+ case 3:
+ result += 16;
+ default:
+ result += 32;
+ break;
+ case 4:
+ result += 64;
+ }
- switch ( input ) {
- case 0:
- result += 2;
- case 1:
- result += 4;
- break;
- case 2:
- result += 8;
- case 3:
- result += 16;
- default:
- result += 32;
- break;
- case 4:
- result += 64;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "switch with no breaks: input is " + input,
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/switch-003.js b/mozilla/js/tests/ecma_2/Statements/switch-003.js
index 6a1389c81ad..da77ecc3bdd 100644
--- a/mozilla/js/tests/ecma_2/Statements/switch-003.js
+++ b/mozilla/js/tests/ecma_2/Statements/switch-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: switch-003.js
* ECMA Section:
@@ -9,46 +10,43 @@
* Date: 11 August 1998
*
*/
- var SECTION = "switch-003";
- var VERSION = "ECMA_2";
- var TITLE = "The switch statement";
+var SECTION = "switch-003";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- SwitchTest( "a", "abc" );
- SwitchTest( "b", "bc" );
- SwitchTest( "c", "c" );
- SwitchTest( "d", "*abc" );
- SwitchTest( "v", "*abc" );
- SwitchTest( "w", "w*abc" );
- SwitchTest( "x", "xw*abc" );
- SwitchTest( "y", "yxw*abc" );
- SwitchTest( "z", "zyxw*abc" );
+SwitchTest( "a", "abc" );
+SwitchTest( "b", "bc" );
+SwitchTest( "c", "c" );
+SwitchTest( "d", "*abc" );
+SwitchTest( "v", "*abc" );
+SwitchTest( "w", "w*abc" );
+SwitchTest( "x", "xw*abc" );
+SwitchTest( "y", "yxw*abc" );
+SwitchTest( "z", "zyxw*abc" );
// SwitchTest( new java.lang.String("z"), "*abc" );
- test();
+test();
- function SwitchTest( input, expect ) {
- var result = "";
+function SwitchTest( input, expect ) {
+ var result = "";
- switch ( input ) {
- case "z": result += "z";
- case "y": result += "y";
- case "x": result += "x";
- case "w": result += "w";
- default: result += "*";
- case "a": result += "a";
- case "b": result += "b";
- case "c": result += "c";
- }
+ switch ( input ) {
+ case "z": result += "z";
+ case "y": result += "y";
+ case "x": result += "x";
+ case "w": result += "w";
+ default: result += "*";
+ case "a": result += "a";
+ case "b": result += "b";
+ case "c": result += "c";
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- "switch with no breaks: input is " + input,
- expect,
- result );
- }
\ No newline at end of file
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/switch-004.js b/mozilla/js/tests/ecma_2/Statements/switch-004.js
index 23da926d330..cb061638b2e 100644
--- a/mozilla/js/tests/ecma_2/Statements/switch-004.js
+++ b/mozilla/js/tests/ecma_2/Statements/switch-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: switch-003.js
* ECMA Section:
@@ -14,78 +15,75 @@
* Date: 11 August 1998
*
*/
- var SECTION = "switch-003";
- var VERSION = "ECMA_2";
- var TITLE = "The switch statement";
- var BUGNUMBER= "315988";
+var SECTION = "switch-003";
+var VERSION = "ECMA_2";
+var TITLE = "The switch statement";
+var BUGNUMBER= "315988";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+ONE = new Number(1);
+ZERO = new Number(0);
+var A = new String("A");
+var B = new String("B");
+TRUE = new Boolean( true );
+FALSE = new Boolean( false );
+UNDEFINED = void 0;
+NULL = null;
- ONE = new Number(1);
- ZERO = new Number(0);
- var A = new String("A");
- var B = new String("B");
- TRUE = new Boolean( true );
- FALSE = new Boolean( false );
- UNDEFINED = void 0;
- NULL = null;
+SwitchTest( ZERO, "ZERO" );
+SwitchTest( NULL, "NULL" );
+SwitchTest( UNDEFINED, "UNDEFINED" );
+SwitchTest( FALSE, "FALSE" );
+SwitchTest( false, "false" );
+SwitchTest( 0, "0" );
- SwitchTest( ZERO, "ZERO" );
- SwitchTest( NULL, "NULL" );
- SwitchTest( UNDEFINED, "UNDEFINED" );
- SwitchTest( FALSE, "FALSE" );
- SwitchTest( false, "false" );
- SwitchTest( 0, "0" );
+SwitchTest ( TRUE, "TRUE" );
+SwitchTest( 1, "1" );
+SwitchTest( ONE, "ONE" );
+SwitchTest( true, "true" );
- SwitchTest ( TRUE, "TRUE" );
- SwitchTest( 1, "1" );
- SwitchTest( ONE, "ONE" );
- SwitchTest( true, "true" );
+SwitchTest( "a", "a" );
+SwitchTest( A, "A" );
+SwitchTest( "b", "b" );
+SwitchTest( B, "B" );
- SwitchTest( "a", "a" );
- SwitchTest( A, "A" );
- SwitchTest( "b", "b" );
- SwitchTest( B, "B" );
+SwitchTest( new Boolean( true ), "default" );
+SwitchTest( new Boolean(false ), "default" );
+SwitchTest( new String( "A" ), "default" );
+SwitchTest( new Number( 0 ), "default" );
- SwitchTest( new Boolean( true ), "default" );
- SwitchTest( new Boolean(false ), "default" );
- SwitchTest( new String( "A" ), "default" );
- SwitchTest( new Number( 0 ), "default" );
+test();
- test();
+function SwitchTest( input, expect ) {
+ var result = "";
- function SwitchTest( input, expect ) {
- var result = "";
+ switch ( input ) {
+ default: result += "default"; break;
+ case "a": result += "a"; break;
+ case "b": result += "b"; break;
+ case A: result += "A"; break;
+ case B: result += "B"; break;
+ case new Boolean(true): result += "new TRUE"; break;
+ case new Boolean(false): result += "new FALSE"; break;
+ case NULL: result += "NULL"; break;
+ case UNDEFINED: result += "UNDEFINED"; break;
+ case true: result += "true"; break;
+ case false: result += "false"; break;
+ case TRUE: result += "TRUE"; break;
+ case FALSE: result += "FALSE"; break;
+ case 0: result += "0"; break;
+ case 1: result += "1"; break;
+ case new Number(0) : result += "new ZERO"; break;
+ case new Number(1) : result += "new ONE"; break;
+ case ONE: result += "ONE"; break;
+ case ZERO: result += "ZERO"; break;
+ }
- switch ( input ) {
- default: result += "default"; break;
- case "a": result += "a"; break;
- case "b": result += "b"; break;
- case A: result += "A"; break;
- case B: result += "B"; break;
- case new Boolean(true): result += "new TRUE"; break;
- case new Boolean(false): result += "new FALSE"; break;
- case NULL: result += "NULL"; break;
- case UNDEFINED: result += "UNDEFINED"; break;
- case true: result += "true"; break;
- case false: result += "false"; break;
- case TRUE: result += "TRUE"; break;
- case FALSE: result += "FALSE"; break;
- case 0: result += "0"; break;
- case 1: result += "1"; break;
- case new Number(0) : result += "new ZERO"; break;
- case new Number(1) : result += "new ONE"; break;
- case ONE: result += "ONE"; break;
- case ZERO: result += "ZERO"; break;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "switch with no breaks: input is " + input,
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "switch with no breaks: input is " + input,
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-001.js b/mozilla/js/tests/ecma_2/Statements/try-001.js
index bcd0eac2c82..d8401bf6506 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-001.js
* ECMA Section:
@@ -12,71 +13,68 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
+var SECTION = "";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
- var INVALID_JAVA_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE );
+TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE );
+TryNewJavaInteger( 0, 0 );
+TryNewJavaInteger( -1, -1 );
+TryNewJavaInteger( 1, 1 );
+TryNewJavaInteger( Infinity, Infinity );
- TryNewJavaInteger( "3.14159", INVALID_JAVA_INTEGER_VALUE );
- TryNewJavaInteger( NaN, INVALID_JAVA_INTEGER_VALUE );
- TryNewJavaInteger( 0, 0 );
- TryNewJavaInteger( -1, -1 );
- TryNewJavaInteger( 1, 1 );
- TryNewJavaInteger( Infinity, Infinity );
+test();
- test();
+/**
+ * Check to see if the input is valid for java.lang.Integer. If it is
+ * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid,
+ * return Number( v )
+ *
+ */
- /**
- * Check to see if the input is valid for java.lang.Integer. If it is
- * not valid, throw INVALID_JAVA_INTEGER_VALUE. If input is valid,
- * return Number( v )
- *
- */
+function newJavaInteger( v ) {
+ value = Number( v );
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_JAVA_INTEGER_VALUE );
+ } else {
+ return value;
+ }
+}
- function newJavaInteger( v ) {
- value = Number( v );
- if ( Math.floor(value) != value || isNaN(value) ) {
- throw ( INVALID_JAVA_INTEGER_VALUE );
- } else {
- return value;
- }
- }
+/**
+ * Call newJavaInteger( value ) from within a try block. Catch any
+ * exception, and store it in result. Verify that we got the right
+ * return value from newJavaInteger in cases in which we do not expect
+ * exceptions, and that we got the exception in cases where an exception
+ * was expected.
+ */
+function TryNewJavaInteger( value, expect ) {
+ var finalTest = false;
- /**
- * Call newJavaInteger( value ) from within a try block. Catch any
- * exception, and store it in result. Verify that we got the right
- * return value from newJavaInteger in cases in which we do not expect
- * exceptions, and that we got the exception in cases where an exception
- * was expected.
- */
- function TryNewJavaInteger( value, expect ) {
- var finalTest = false;
+ try {
+ result = newJavaInteger( value );
+ } catch ( e ) {
+ result = String( e );
+ } finally {
+ finalTest = true;
+ }
+ new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" )",
+ expect,
+ result);
- try {
- result = newJavaInteger( value );
- } catch ( e ) {
- result = String( e );
- } finally {
- finalTest = true;
- }
- testcases[tc++] = new TestCase(
- SECTION,
- "newJavaValue( " + value +" )",
- expect,
- result);
+ new TestCase(
+ SECTION,
+ "newJavaValue( " + value +" ) hit finally block",
+ true,
+ finalTest);
- testcases[tc++] = new TestCase(
- SECTION,
- "newJavaValue( " + value +" ) hit finally block",
- true,
- finalTest);
-
- }
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-003.js b/mozilla/js/tests/ecma_2/Statements/try-003.js
index de1e2139e3a..a696a3755a3 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-003.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-003.js
* ECMA Section:
@@ -8,72 +9,69 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-003";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
- var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585";
+var SECTION = "try-003";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+var BUGNUMBER="http://scopus.mcom.com/bugsplat/show_bug.cgi?id=313585";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+// Tests start here.
- // Tests start here.
+TrySomething( "x = \"hi\"", false );
+TrySomething( "throw \"boo\"", true );
+TrySomething( "throw 3", true );
- TrySomething( "x = \"hi\"", false );
- TrySomething( "throw \"boo\"", true );
- TrySomething( "throw 3", true );
+test();
- test();
-
- /**
- * This function contains a try block with no catch block,
- * but it does have a finally block. Try to evaluate expressions
- * that do and do not throw exceptions.
- */
-
- function TrySomething( expression, throwing ) {
- innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
- if (throwing) {
- outerCatch = "FAILED: NO EXCEPTION CAUGHT";
- } else {
- outerCatch = "PASS";
- }
- outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
-
- try {
- try {
- eval( expression );
- } finally {
- innerFinally = "PASS";
- }
- } catch ( e ) {
- if (throwing) {
- outerCatch = "PASS";
- } else {
- outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
- }
- } finally {
- outerFinally = "PASS";
- }
-
-
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" )",
- "PASS",
- innerFinally );
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" )",
- "PASS",
- outerCatch );
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" )",
- "PASS",
- outerFinally );
+/**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ */
+function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+ try {
+ try {
+ eval( expression );
+ } finally {
+ innerFinally = "PASS";
}
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ innerFinally );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerCatch );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" )",
+ "PASS",
+ outerFinally );
+
+
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-004.js b/mozilla/js/tests/ecma_2/Statements/try-004.js
index b36dc4415c9..0298c789372 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-004.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-004.js
* ECMA Section:
@@ -8,44 +9,41 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-004";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
+var SECTION = "try-004";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+TryToCatch( "Math.PI", Math.PI );
+TryToCatch( "Thrower(5)", "Caught 5" );
+TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
- TryToCatch( "Math.PI", Math.PI );
- TryToCatch( "Thrower(5)", "Caught 5" );
- TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+test();
- test();
+function Thrower( v ) {
+ throw "Caught " + v;
+}
- function Thrower( v ) {
- throw "Caught " + v;
- }
+/**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
- /**
- * Evaluate a string. Catch any exceptions thrown. If no exception is
- * expected, verify the result of the evaluation. If an exception is
- * expected, verify that we got the right exception.
- */
+function TryToCatch( value, expect ) {
+ try {
+ result = eval( value );
+ } catch ( e ) {
+ result = e;
+ }
- function TryToCatch( value, expect ) {
- try {
- result = eval( value );
- } catch ( e ) {
- result = e;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + value +" )",
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-005.js b/mozilla/js/tests/ecma_2/Statements/try-005.js
index 94b5beb2fe6..7c5733935c5 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-005.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-005.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-005.js
* ECMA Section:
@@ -10,45 +11,42 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-005";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
+var SECTION = "try-005";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+TryToCatch( "Math.PI", Math.PI );
+TryToCatch( "Thrower(5)", "Caught 5" );
+TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
- TryToCatch( "Math.PI", Math.PI );
- TryToCatch( "Thrower(5)", "Caught 5" );
- TryToCatch( "Thrower(\"some random exception\")", "Caught some random exception" );
+test();
- test();
+function Thrower( v ) {
+ throw "Caught " + v;
+}
+function Eval( v ) {
+ return eval( v );
+}
- function Thrower( v ) {
- throw "Caught " + v;
- }
- function Eval( v ) {
- return eval( v );
- }
+/**
+ * Evaluate a string. Catch any exceptions thrown. If no exception is
+ * expected, verify the result of the evaluation. If an exception is
+ * expected, verify that we got the right exception.
+ */
- /**
- * Evaluate a string. Catch any exceptions thrown. If no exception is
- * expected, verify the result of the evaluation. If an exception is
- * expected, verify that we got the right exception.
- */
+function TryToCatch( value, expect ) {
+ try {
+ result = Eval( value );
+ } catch ( e ) {
+ result = e;
+ }
- function TryToCatch( value, expect ) {
- try {
- result = Eval( value );
- } catch ( e ) {
- result = e;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + value +" )",
- expect,
- result );
- }
+ new TestCase(
+ SECTION,
+ "eval( " + value +" )",
+ expect,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-006.js b/mozilla/js/tests/ecma_2/Statements/try-006.js
index 924f24d5dcc..f373f1d1b6c 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-006.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-006.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-006.js
* ECMA Section:
@@ -9,76 +10,73 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-006";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
+var SECTION = "try-006";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+/**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+}
+var EXCEPTION_STRING = "Exception thrown:";
- /**
- * This is the "check" function for test objects that will
- * throw an exception.
- */
- function throwException() {
- throw EXCEPTION_STRING +": " + this.valueOf();
+/**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+function noException() {
+ return this.valueOf();
+}
+
+/**
+ * Add test cases here
+ */
+TryWith( new TryObject( "hello", throwException, true ));
+TryWith( new TryObject( "hola", noException, false ));
+
+/**
+ * Run the test.
+ */
+
+test();
+
+/**
+ * This is the object that will be the "this" in a with block.
+ */
+function TryObject( value, fun, exception ) {
+ this.value = value;
+ this.exception = exception;
+
+ this.valueOf = new Function ( "return this.value" );
+ this.check = fun;
+}
+
+/**
+ * This function has the try block that has a with block within it.
+ * Test cases are added in this function. Within the with block, the
+ * object's "check" function is called. If the test object's exception
+ * property is true, we expect the result to be the exception value.
+ * If exception is false, then we expect the result to be the value of
+ * the object.
+ */
+function TryWith( object ) {
+ try {
+ with ( object ) {
+ result = check();
}
- var EXCEPTION_STRING = "Exception thrown:";
+ } catch ( e ) {
+ result = e;
+ }
- /**
- * This is the "check" function for test objects that do not
- * throw an exception
- */
- function noException() {
- return this.valueOf();
- }
-
- /**
- * Add test cases here
- */
- TryWith( new TryObject( "hello", throwException, true ));
- TryWith( new TryObject( "hola", noException, false ));
-
- /**
- * Run the test.
- */
-
- test();
-
- /**
- * This is the object that will be the "this" in a with block.
- */
- function TryObject( value, fun, exception ) {
- this.value = value;
- this.exception = exception;
-
- this.valueOf = new Function ( "return this.value" );
- this.check = fun;
- }
-
- /**
- * This function has the try block that has a with block within it.
- * Test cases are added in this function. Within the with block, the
- * object's "check" function is called. If the test object's exception
- * property is true, we expect the result to be the exception value.
- * If exception is false, then we expect the result to be the value of
- * the object.
- */
- function TryWith( object ) {
- try {
- with ( object ) {
- result = check();
- }
- } catch ( e ) {
- result = e;
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "TryWith( " + object.value +" )",
- (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()),
- result );
- }
+ new TestCase(
+ SECTION,
+ "TryWith( " + object.value +" )",
+ (object.exception ? EXCEPTION_STRING +": " + object.valueOf() : object.valueOf()),
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-007.js b/mozilla/js/tests/ecma_2/Statements/try-007.js
index 14a960abc21..7a8024a874d 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-007.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-007.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-007.js
* ECMA Section:
@@ -9,44 +10,41 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-007";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement: for-in";
+var SECTION = "try-007";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: for-in";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+/**
+ * This is the "check" function for test objects that will
+ * throw an exception.
+ */
+function throwException() {
+ throw EXCEPTION_STRING +": " + this.valueOf();
+}
+var EXCEPTION_STRING = "Exception thrown:";
- /**
- * This is the "check" function for test objects that will
- * throw an exception.
- */
- function throwException() {
- throw EXCEPTION_STRING +": " + this.valueOf();
- }
- var EXCEPTION_STRING = "Exception thrown:";
+/**
+ * This is the "check" function for test objects that do not
+ * throw an exception
+ */
+function noException() {
+ return this.valueOf();
+}
- /**
- * This is the "check" function for test objects that do not
- * throw an exception
- */
- function noException() {
- return this.valueOf();
- }
+/**
+ * Add test cases here
+ */
+TryForIn( new TryObject( "hello", throwException, true ));
+TryForIn( new TryObject( "hola", noException, false ));
- /**
- * Add test cases here
- */
- TryForIn( new TryObject( "hello", throwException, true ));
- TryForIn( new TryObject( "hola", noException, false ));
+/**
+ * Run the test.
+ */
- /**
- * Run the test.
- */
-
- test();
+test();
/**
* This is the object that will be the "this" in a with block.
@@ -55,11 +53,11 @@
*
*/
function TryObject( value, fun, exception ) {
- this.value = value;
- this.exception = exception;
+ this.value = value;
+ this.exception = exception;
- this.check = fun;
- this.valueOf = function () { return this.value; }
+ this.check = fun;
+ this.valueOf = function () { return this.value; }
}
/**
@@ -69,21 +67,21 @@ function TryObject( value, fun, exception ) {
* exceptions are properly caught.
*/
- function TryForIn( object ) {
- try {
- for ( p in object ) {
- if ( typeof object[p] == "function" ) {
- result = object[p]();
- }
- }
- } catch ( e ) {
- result = e;
+function TryForIn( object ) {
+ try {
+ for ( p in object ) {
+ if ( typeof object[p] == "function" ) {
+ result = object[p]();
+ }
}
+ } catch ( e ) {
+ result = e;
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- "TryForIn( " + object+ " )",
- (object.exception ? EXCEPTION_STRING +": " + object.value : object.value),
- result );
+ new TestCase(
+ SECTION,
+ "TryForIn( " + object+ " )",
+ (object.exception ? EXCEPTION_STRING +": " + object.value : object.value),
+ result );
- }
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-008.js b/mozilla/js/tests/ecma_2/Statements/try-008.js
index 78092b69d71..d7006ad6e81 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-008.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-008.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-008.js
* ECMA Section:
@@ -9,48 +10,45 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-008";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement: try in a constructor";
+var SECTION = "try-008";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a constructor";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+function Integer( value, exception ) {
+ try {
+ this.value = checkValue( value );
+ } catch ( e ) {
+ this.value = e.toString();
+ }
- function Integer( value, exception ) {
- try {
- this.value = checkValue( value );
- } catch ( e ) {
- this.value = e.toString();
- }
+ new TestCase(
+ SECTION,
+ "Integer( " + value +" )",
+ (exception ? INVALID_INTEGER_VALUE +": " + value : this.value),
+ this.value );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "Integer( " + value +" )",
- (exception ? INVALID_INTEGER_VALUE +": " + value : this.value),
- this.value );
- }
+var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
- var INVALID_INTEGER_VALUE = "Invalid value for java.lang.Integer constructor";
+function checkValue( value ) {
+ if ( Math.floor(value) != value || isNaN(value) ) {
+ throw ( INVALID_INTEGER_VALUE +": " + value );
+ } else {
+ return value;
+ }
+}
- function checkValue( value ) {
- if ( Math.floor(value) != value || isNaN(value) ) {
- throw ( INVALID_INTEGER_VALUE +": " + value );
- } else {
- return value;
- }
- }
+// add test cases
- // add test cases
-
- new Integer( 3, false );
- new Integer( NaN, true );
- new Integer( 0, false );
- new Integer( Infinity, false );
- new Integer( -2.12, true );
- new Integer( Math.LN2, true );
+new Integer( 3, false );
+new Integer( NaN, true );
+new Integer( 0, false );
+new Integer( Infinity, false );
+new Integer( -2.12, true );
+new Integer( Math.LN2, true );
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/Statements/try-009.js b/mozilla/js/tests/ecma_2/Statements/try-009.js
index 778e64784fa..c89925d5025 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-009.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-009.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-009.js
* ECMA Section:
@@ -10,54 +11,51 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-009";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement: try in a while block";
+var SECTION = "try-009";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a while block";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- var EXCEPTION_STRING = "Exception thrown: ";
- var NO_EXCEPTION_STRING = "No exception thrown: ";
+var EXCEPTION_STRING = "Exception thrown: ";
+var NO_EXCEPTION_STRING = "No exception thrown: ";
- TryInWhile( new TryObject( "hello", ThrowException, true ) );
- TryInWhile( new TryObject( "aloha", NoException, false ));
+TryInWhile( new TryObject( "hello", ThrowException, true ) );
+TryInWhile( new TryObject( "aloha", NoException, false ));
- test();
+test();
- function TryObject( value, throwFunction, result ) {
- this.value = value;
- this.thrower = throwFunction;
- this.result = result;
+function TryObject( value, throwFunction, result ) {
+ this.value = value;
+ this.thrower = throwFunction;
+ this.result = result;
+}
+function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+}
+function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+}
+function TryInWhile( object ) {
+ result = null;
+ while ( true ) {
+ try {
+ object.thrower();
+ result = NO_EXCEPTION_STRING + object.value;
+ break;
+ } catch ( e ) {
+ result = e;
+ break;
}
- function ThrowException() {
- throw EXCEPTION_STRING + this.value;
- }
- function NoException() {
- return NO_EXCEPTION_STRING + this.value;
- }
- function TryInWhile( object ) {
- result = null;
- while ( true ) {
- try {
- object.thrower();
- result = NO_EXCEPTION_STRING + object.value;
- break;
- } catch ( e ) {
- result = e;
- break;
- }
- }
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- "( "+ object +".thrower() )",
- (object.result
- ? EXCEPTION_STRING + object.value :
- NO_EXCEPTION_STRING + object.value),
- result );
- }
+ new TestCase(
+ SECTION,
+ "( "+ object +".thrower() )",
+ (object.result
+ ? EXCEPTION_STRING + object.value :
+ NO_EXCEPTION_STRING + object.value),
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-010.js b/mozilla/js/tests/ecma_2/Statements/try-010.js
index eeb7f88c6b6..3337a0a9283 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-010.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-010.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-010.js
* ECMA Section:
@@ -10,61 +11,58 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-010";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement: try in a tryblock";
+var SECTION = "try-010";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement: try in a tryblock";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
- var EXCEPTION_STRING = "Exception thrown: ";
- var NO_EXCEPTION_STRING = "No exception thrown: ";
+var EXCEPTION_STRING = "Exception thrown: ";
+var NO_EXCEPTION_STRING = "No exception thrown: ";
- NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) );
- NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 ));
- NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 ));
- NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 ));
+NestedTry( new TryObject( "No Exceptions Thrown", NoException, NoException, 43 ) );
+NestedTry( new TryObject( "Throw Exception in Outer Try", ThrowException, NoException, 48 ));
+NestedTry( new TryObject( "Throw Exception in Inner Try", NoException, ThrowException, 45 ));
+NestedTry( new TryObject( "Throw Exception in Both Trys", ThrowException, ThrowException, 48 ));
- test();
+test();
- function TryObject( description, tryOne, tryTwo, result ) {
- this.description = description;
- this.tryOne = tryOne;
- this.tryTwo = tryTwo;
- this.result = result;
+function TryObject( description, tryOne, tryTwo, result ) {
+ this.description = description;
+ this.tryOne = tryOne;
+ this.tryTwo = tryTwo;
+ this.result = result;
+}
+function ThrowException() {
+ throw EXCEPTION_STRING + this.value;
+}
+function NoException() {
+ return NO_EXCEPTION_STRING + this.value;
+}
+function NestedTry( object ) {
+ result = 0;
+ try {
+ object.tryOne();
+ result += 1;
+ try {
+ object.tryTwo();
+ result += 2;
+ } catch ( e ) {
+ result +=4;
+ } finally {
+ result += 8;
}
- function ThrowException() {
- throw EXCEPTION_STRING + this.value;
- }
- function NoException() {
- return NO_EXCEPTION_STRING + this.value;
- }
- function NestedTry( object ) {
- result = 0;
- try {
- object.tryOne();
- result += 1;
- try {
- object.tryTwo();
- result += 2;
- } catch ( e ) {
- result +=4;
- } finally {
- result += 8;
- }
- } catch ( e ) {
- result += 16;
- } finally {
- result += 32;
- }
+ } catch ( e ) {
+ result += 16;
+ } finally {
+ result += 32;
+ }
- testcases[tc++] = new TestCase(
- SECTION,
- object.description,
- object.result,
- result );
- }
+ new TestCase(
+ SECTION,
+ object.description,
+ object.result,
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/try-012.js b/mozilla/js/tests/ecma_2/Statements/try-012.js
index f8c8e0014f8..00406e3cccc 100644
--- a/mozilla/js/tests/ecma_2/Statements/try-012.js
+++ b/mozilla/js/tests/ecma_2/Statements/try-012.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: try-012.js
* ECMA Section:
@@ -9,84 +10,81 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "try-012";
- var VERSION = "ECMA_2";
- var TITLE = "The try statement";
- var BUGNUMBER="336872";
+var SECTION = "try-012";
+var VERSION = "ECMA_2";
+var TITLE = "The try statement";
+var BUGNUMBER="336872";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+// Tests start here.
- // Tests start here.
+TrySomething( "x = \"hi\"", true );
+TrySomething( "throw \"boo\"", true );
+TrySomething( "throw 3", true );
- TrySomething( "x = \"hi\"", true );
- TrySomething( "throw \"boo\"", true );
- TrySomething( "throw 3", true );
+test();
- test();
+/**
+ * This function contains a try block with no catch block,
+ * but it does have a finally block. Try to evaluate expressions
+ * that do and do not throw exceptions.
+ *
+ * The productioni TryStatement Block Finally is evaluated as follows:
+ * 1. Evaluate Block
+ * 2. Evaluate Finally
+ * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has
+ * the completion type throw)
+ * 4. return result 2 (does not get hit in this case)
+ *
+ */
- /**
- * This function contains a try block with no catch block,
- * but it does have a finally block. Try to evaluate expressions
- * that do and do not throw exceptions.
- *
- * The productioni TryStatement Block Finally is evaluated as follows:
- * 1. Evaluate Block
- * 2. Evaluate Finally
- * 3. If Result(2).type is normal return result 1 (in the test case, result 1 has
- * the completion type throw)
- * 4. return result 2 (does not get hit in this case)
- *
- */
-
- function TrySomething( expression, throwing ) {
- innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
- if (throwing) {
- outerCatch = "FAILED: NO EXCEPTION CAUGHT";
- } else {
- outerCatch = "PASS";
- }
- outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
+function TrySomething( expression, throwing ) {
+ innerFinally = "FAIL: DID NOT HIT INNER FINALLY BLOCK";
+ if (throwing) {
+ outerCatch = "FAILED: NO EXCEPTION CAUGHT";
+ } else {
+ outerCatch = "PASS";
+ }
+ outerFinally = "FAIL: DID NOT HIT OUTER FINALLY BLOCK";
- // If the inner finally does not throw an exception, the result
- // of the try block should be returned. (Type of inner return
- // value should be throw if finally executes correctly
+ // If the inner finally does not throw an exception, the result
+ // of the try block should be returned. (Type of inner return
+ // value should be throw if finally executes correctly
- try {
- try {
- throw 0;
- } finally {
- innerFinally = "PASS";
- eval( expression );
- }
- } catch ( e ) {
- if (throwing) {
- outerCatch = "PASS";
- } else {
- outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
- }
- } finally {
- outerFinally = "PASS";
- }
-
-
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" ): evaluated inner finally block",
- "PASS",
- innerFinally );
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" ): evaluated outer catch block ",
- "PASS",
- outerCatch );
- testcases[tc++] = new TestCase(
- SECTION,
- "eval( " + expression +" ): evaluated outer finally block",
- "PASS",
- outerFinally );
+ try {
+ try {
+ throw 0;
+ } finally {
+ innerFinally = "PASS";
+ eval( expression );
}
+ } catch ( e ) {
+ if (throwing) {
+ outerCatch = "PASS";
+ } else {
+ outerCatch = "FAIL: HIT OUTER CATCH BLOCK";
+ }
+ } finally {
+ outerFinally = "PASS";
+ }
+
+
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated inner finally block",
+ "PASS",
+ innerFinally );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer catch block ",
+ "PASS",
+ outerCatch );
+ new TestCase(
+ SECTION,
+ "eval( " + expression +" ): evaluated outer finally block",
+ "PASS",
+ outerFinally );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/while-001.js b/mozilla/js/tests/ecma_2/Statements/while-001.js
index f9c0d64cbaa..ed2e2b62974 100644
--- a/mozilla/js/tests/ecma_2/Statements/while-001.js
+++ b/mozilla/js/tests/ecma_2/Statements/while-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: while-001
* ECMA Section:
@@ -9,31 +10,28 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "while-001";
- var VERSION = "ECMA_2";
- var TITLE = "while statement";
+var SECTION = "while-001";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile();
+test();
- DoWhile();
- test();
+function DoWhile() {
+ result = "pass";
- function DoWhile() {
- result = "pass";
+ while (false) {
+ result = "fail";
+ break;
+ }
- while (false) {
- result = "fail";
- break;
- }
+ new TestCase(
+ SECTION,
+ "while statement: don't evaluate statement is expression is false",
+ "pass",
+ result );
- testcases[tc++] = new TestCase(
- SECTION,
- "while statement: don't evaluate statement is expression is false",
- "pass",
- result );
-
- }
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/while-002.js b/mozilla/js/tests/ecma_2/Statements/while-002.js
index 3fda04bc493..afd60c1d636 100644
--- a/mozilla/js/tests/ecma_2/Statements/while-002.js
+++ b/mozilla/js/tests/ecma_2/Statements/while-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: while-002
* ECMA Section:
@@ -9,75 +10,72 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "while-002";
- var VERSION = "ECMA_2";
- var TITLE = "while statement";
+var SECTION = "while-002";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( new DoWhileObject(
+ "while expression is null",
+ null,
+ "result = \"fail: should not have evaluated statements in while block;break"
+ ) );
- DoWhile( new DoWhileObject(
- "while expression is null",
- null,
- "result = \"fail: should not have evaluated statements in while block;break"
- ) );
+DoWhile( new DoWhileObject(
+ "while expression is undefined",
+ void 0,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
- DoWhile( new DoWhileObject(
- "while expression is undefined",
- void 0,
- "result = \"fail: should not have evaluated statements in while block; break"
- ));
+DoWhile( new DoWhileObject(
+ "while expression is 0",
+ 0,
+ "result = \"fail: should not have evaluated statements in while block; break;"
+ ));
- DoWhile( new DoWhileObject(
- "while expression is 0",
- 0,
- "result = \"fail: should not have evaluated statements in while block; break;"
- ));
+DoWhile( new DoWhileObject(
+ "while expression is eval(\"\")",
+ eval(""),
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
- DoWhile( new DoWhileObject(
- "while expression is eval(\"\")",
- eval(""),
- "result = \"fail: should not have evaluated statements in while block; break"
- ));
+DoWhile( new DoWhileObject(
+ "while expression is NaN",
+ NaN,
+ "result = \"fail: should not have evaluated statements in while block; break"
+ ));
- DoWhile( new DoWhileObject(
- "while expression is NaN",
- NaN,
- "result = \"fail: should not have evaluated statements in while block; break"
- ));
+test();
- test();
+function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+}
- function DoWhileObject( d, e, s ) {
- this.description = d;
- this.whileExpression = e;
- this.statements = s;
- }
+function DoWhile( object ) {
+ result = "pass";
- function DoWhile( object ) {
- result = "pass";
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ }
- while ( expression = object.whileExpression ) {
- eval( object.statements );
- }
+ // verify that the while expression was evaluated
- // verify that the while expression was evaluated
+ new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
- testcases[tc++] = new TestCase(
- SECTION,
- "verify that while expression was evaluated (should be "+
- object.whileExpression +")",
- "pass",
- (object.whileExpression == expression ||
- ( isNaN(object.whileExpression) && isNaN(expression) )
- ) ? "pass" : "fail" );
-
- testcases[tc++] = new TestCase(
- SECTION,
- object.description,
- "pass",
- result );
- }
\ No newline at end of file
+ new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/while-003.js b/mozilla/js/tests/ecma_2/Statements/while-003.js
index 0164f054e6c..0cc3b8afa65 100644
--- a/mozilla/js/tests/ecma_2/Statements/while-003.js
+++ b/mozilla/js/tests/ecma_2/Statements/while-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: while-003
* ECMA Section:
@@ -8,77 +9,74 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "while-003";
- var VERSION = "ECMA_2";
- var TITLE = "while statement";
+var SECTION = "while-003";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile( new DoWhileObject(
+ "while expression is true",
+ true,
+ "result = \"pass\";" ));
- DoWhile( new DoWhileObject(
- "while expression is true",
- true,
- "result = \"pass\";" ));
+DoWhile( new DoWhileObject(
+ "while expression is 1",
+ 1,
+ "result = \"pass\";" ));
- DoWhile( new DoWhileObject(
- "while expression is 1",
- 1,
- "result = \"pass\";" ));
+DoWhile( new DoWhileObject(
+ "while expression is new Boolean(false)",
+ new Boolean(false),
+ "result = \"pass\";" ));
- DoWhile( new DoWhileObject(
- "while expression is new Boolean(false)",
- new Boolean(false),
- "result = \"pass\";" ));
+DoWhile( new DoWhileObject(
+ "while expression is new Object()",
+ new Object(),
+ "result = \"pass\";" ));
- DoWhile( new DoWhileObject(
- "while expression is new Object()",
- new Object(),
- "result = \"pass\";" ));
-
- DoWhile( new DoWhileObject(
- "while expression is \"hi\"",
- "hi",
- "result = \"pass\";" ));
+DoWhile( new DoWhileObject(
+ "while expression is \"hi\"",
+ "hi",
+ "result = \"pass\";" ));
/*
- DoWhile( new DoWhileObject(
- "while expression has a continue in it",
- "true",
- "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";"
- ));
+ DoWhile( new DoWhileObject(
+ "while expression has a continue in it",
+ "true",
+ "if ( i == void 0 ) i = 0; result=\"pass\"; if ( ++i == 1 ) {continue;} else {break;} result=\"fail\";"
+ ));
*/
- test();
+test();
- function DoWhileObject( d, e, s ) {
- this.description = d;
- this.whileExpression = e;
- this.statements = s;
- }
+function DoWhileObject( d, e, s ) {
+ this.description = d;
+ this.whileExpression = e;
+ this.statements = s;
+}
- function DoWhile( object ) {
- result = "fail: statements in while block were not evaluated";
+function DoWhile( object ) {
+ result = "fail: statements in while block were not evaluated";
- while ( expression = object.whileExpression ) {
- eval( object.statements );
- break;
- }
+ while ( expression = object.whileExpression ) {
+ eval( object.statements );
+ break;
+ }
- // verify that the while expression was evaluated
+ // verify that the while expression was evaluated
- testcases[tc++] = new TestCase(
- SECTION,
- "verify that while expression was evaluated (should be "+
- object.whileExpression +")",
- "pass",
- (object.whileExpression == expression ||
- ( isNaN(object.whileExpression) && isNaN(expression) )
- ) ? "pass" : "fail" );
+ new TestCase(
+ SECTION,
+ "verify that while expression was evaluated (should be "+
+ object.whileExpression +")",
+ "pass",
+ (object.whileExpression == expression ||
+ ( isNaN(object.whileExpression) && isNaN(expression) )
+ ) ? "pass" : "fail" );
- testcases[tc++] = new TestCase(
- SECTION,
- object.description,
- "pass",
- result );
- }
\ No newline at end of file
+ new TestCase(
+ SECTION,
+ object.description,
+ "pass",
+ result );
+}
diff --git a/mozilla/js/tests/ecma_2/Statements/while-004.js b/mozilla/js/tests/ecma_2/Statements/while-004.js
index 48faeb0cda9..61dcaf629c6 100644
--- a/mozilla/js/tests/ecma_2/Statements/while-004.js
+++ b/mozilla/js/tests/ecma_2/Statements/while-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: while-004
* ECMA Section:
@@ -6,209 +7,206 @@
* Author: christine@netscape.com
* Date: 11 August 1998
*/
- var SECTION = "while-004";
- var VERSION = "ECMA_2";
- var TITLE = "while statement";
- var BUGNUMBER="316725";
+var SECTION = "while-004";
+var VERSION = "ECMA_2";
+var TITLE = "while statement";
+var BUGNUMBER="316725";
- startTest();
- writeHeaderToLog( SECTION + " "+ TITLE);
+startTest();
+writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
+DoWhile_1();
+DoWhile_2();
+DoWhile_3();
+DoWhile_4();
+DoWhile_5();
- DoWhile_1();
- DoWhile_2();
- DoWhile_3();
- DoWhile_4();
- DoWhile_5();
+test();
- test();
+/**
+ * Break out of a while by calling return.
+ *
+ * Tests: 12.6.2 step 6.
+ */
+function dowhile() {
+ result = "pass";
- /**
- * Break out of a while by calling return.
- *
- * Tests: 12.6.2 step 6.
- */
- function dowhile() {
- result = "pass";
+ while (true) {
+ return result;
+ result = "fail: hit code after return statement";
+ break;
+ }
+}
- while (true) {
- return result;
- result = "fail: hit code after return statement";
- break;
- }
+function DoWhile_1() {
+ description = "return statement in a while block";
+
+ result = dowhile();
+
+ new TestCase(
+ SECTION,
+ "DoWhile_1" + description,
+ "pass",
+ result );
+}
+
+/**
+ * While with a labeled continue statement. Verify that statements
+ * after the continue statement are not evaluated.
+ *
+ * Tests: 12.6.2 step 8.
+ *
+ */
+function DoWhile_2() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
+
+theloop:
+ while( i++ < 10 ) {
+ j++;
+ continue theloop;
+ result1 = "failed: hit code after continue statement";
+ }
+ result2 = "pass";
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")",
+ true,
+ j == 10 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_2: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+}
+
+/**
+ * While with a labeled break.
+ *
+ */
+function DoWhile_3() {
+ var description = "while with a labeled break statement";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not get to code after label";
+
+woohoo: {
+ while( true ) {
+ break woohoo;
+ result1 = "fail: got to code after a break";
}
+ result2 = "fail: got to code outside of loop but inside label";
+ }
- function DoWhile_1() {
- description = "return statement in a while block";
+ result3 = "pass";
- result = dowhile();
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of loop",
+ "pass",
+ result1 );
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_1" + description,
- "pass",
- result );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description +" - verify break out of label",
+ "pass",
+ result2 );
+
+ new TestCase(
+ SECTION,
+ "DoWhile_3: " +description + " - verify correct exit from label",
+ "pass",
+ result3 );
+}
+
+
+/**
+ * Labled while with an unlabeled break
+ *
+ */
+function DoWhile_4() {
+ var description = "labeled while with an unlabeled break";
+ var result1 = "pass";
+ var result2 = "pass";
+ var result3 = "fail: did not evaluate statement after label";
+
+woohooboy: {
+ while( true ) {
+ break woohooboy;
+ result1 = "fail: got to code after the break";
}
+ result2 = "fail: broke out of while, but not out of label";
+ }
+ result3 = "pass";
- /**
- * While with a labeled continue statement. Verify that statements
- * after the continue statement are not evaluated.
- *
- * Tests: 12.6.2 step 8.
- *
- */
- function DoWhile_2() {
- var description = "while with a labeled continue statement";
- var result1 = "pass";
- var result2 = "fail: did not execute code after loop, but inside label";
- var i = 0;
- var j = 0;
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify break out of while loop",
+ "pass",
+ result1 );
- theloop:
- while( i++ < 10 ) {
- j++;
- continue theloop;
- result1 = "failed: hit code after continue statement";
- }
- result2 = "pass";
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description + " - verify break out of label",
+ "pass",
+ result2 );
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_2: " +description + " - code inside the loop, before the continue should be executed ("+j+")",
- true,
- j == 10 );
+ new TestCase(
+ SECTION,
+ "DoWhile_4: " +description +" - verify that statements after label are evaluated",
+ "pass",
+ result3 );
+}
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_2: " +description +" - code after labeled continue should not be executed",
- "pass",
- result1 );
+/**
+ * in this case, should behave the same way as
+ *
+ *
+ */
+function DoWhile_5() {
+ var description = "while with a labeled continue statement";
+ var result1 = "pass";
+ var result2 = "fail: did not execute code after loop, but inside label";
+ var i = 0;
+ var j = 0;
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_2: " +description +" - code after loop but inside label should be executed",
- "pass",
- result2 );
+theloop: {
+ j++;
+ while( i++ < 10 ) {
+ continue;
+ result1 = "failed: hit code after continue statement";
}
+ result2 = "pass";
+ }
- /**
- * While with a labeled break.
- *
- */
- function DoWhile_3() {
- var description = "while with a labeled break statement";
- var result1 = "pass";
- var result2 = "pass";
- var result3 = "fail: did not get to code after label";
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description + " - continue should not execute statements above the loop",
+ true,
+ ( j == 1 ) );
- woohoo: {
- while( true ) {
- break woohoo;
- result1 = "fail: got to code after a break";
- }
- result2 = "fail: got to code outside of loop but inside label";
- }
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after labeled continue should not be executed",
+ "pass",
+ result1 );
- result3 = "pass";
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_3: " +description +" - verify break out of loop",
- "pass",
- result1 );
-
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_3: " +description +" - verify break out of label",
- "pass",
- result2 );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_3: " +description + " - verify correct exit from label",
- "pass",
- result3 );
- }
-
-
- /**
- * Labled while with an unlabeled break
- *
- */
- function DoWhile_4() {
- var description = "labeled while with an unlabeled break";
- var result1 = "pass";
- var result2 = "pass";
- var result3 = "fail: did not evaluate statement after label";
-
- woohooboy: {
- while( true ) {
- break woohooboy;
- result1 = "fail: got to code after the break";
- }
- result2 = "fail: broke out of while, but not out of label";
- }
- result3 = "pass";
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_4: " +description +" - verify break out of while loop",
- "pass",
- result1 );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_4: " +description + " - verify break out of label",
- "pass",
- result2 );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_4: " +description +" - verify that statements after label are evaluated",
- "pass",
- result3 );
- }
-
- /**
- * in this case, should behave the same way as
- *
- *
- */
- function DoWhile_5() {
- var description = "while with a labeled continue statement";
- var result1 = "pass";
- var result2 = "fail: did not execute code after loop, but inside label";
- var i = 0;
- var j = 0;
-
- theloop: {
- j++;
- while( i++ < 10 ) {
- continue;
- result1 = "failed: hit code after continue statement";
- }
- result2 = "pass";
- }
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_5: " +description + " - continue should not execute statements above the loop",
- true,
- ( j == 1 ) );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_5: " +description +" - code after labeled continue should not be executed",
- "pass",
- result1 );
-
- testcases[tc++] = new TestCase(
- SECTION,
- "DoWhile_5: " +description +" - code after loop but inside label should be executed",
- "pass",
- result2 );
- }
+ new TestCase(
+ SECTION,
+ "DoWhile_5: " +description +" - code after loop but inside label should be executed",
+ "pass",
+ result2 );
+}
diff --git a/mozilla/js/tests/ecma_2/String/browser.js b/mozilla/js/tests/ecma_2/String/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/String/match-001.js b/mozilla/js/tests/ecma_2/String/match-001.js
index 738264eea63..7edf2af08fb 100644
--- a/mozilla/js/tests/ecma_2/String/match-001.js
+++ b/mozilla/js/tests/ecma_2/String/match-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/match-001.js
* ECMA Section: 15.6.4.9
@@ -29,72 +30,72 @@
* transferred to other kinds of objects for use as a method.
*/
- var SECTION = "String/match-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.match( regexp )";
+var SECTION = "String/match-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
- startTest();
+startTest();
- // the regexp argument is not a RegExp object
- // this is not a string object
+// the regexp argument is not a RegExp object
+// this is not a string object
- // cases in which the regexp global property is false
+// cases in which the regexp global property is false
- AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] );
+AddRegExpCases( 3, "3", "1234567890", 1, 2, ["3"] );
- // cases in which the regexp object global property is true
+// cases in which the regexp object global property is true
- AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] );
- AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10,
- ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] );
+AddGlobalRegExpCases( /34/g, "/34/g", "343443444", 3, ["34", "34", "34"] );
+AddGlobalRegExpCases( /\d{1}/g, "/d{1}/g", "123456abcde7890", 10,
+ ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"] );
- AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5,
- ["12", "34", "56", "78", "90"] );
+AddGlobalRegExpCases( /\d{2}/g, "/d{2}/g", "123456abcde7890", 5,
+ ["12", "34", "56", "78", "90"] );
- AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2,
- ["ab", "cd"] );
+AddGlobalRegExpCases( /\D{2}/g, "/d{2}/g", "123456abcde7890", 2,
+ ["ab", "cd"] );
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, string, length, index, matches_array ) {
+ regexp, str_regexp, string, length, index, matches_array ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- length,
- string.match(regexp).length );
-
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +").index",
- index,
- string.match(regexp).index );
-
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +").input",
- string,
- string.match(regexp).input );
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
function AddGlobalRegExpCases(
- regexp, str_regexp, string, length, matches_array ) {
+ regexp, str_regexp, string, length, matches_array ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ length,
+ string.match(regexp).length );
+
+ for ( var matches = 0; matches < matches_array.length; matches++ ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- length,
- string.match(regexp).length );
-
- for ( var matches = 0; matches < matches_array.length; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/String/match-002.js b/mozilla/js/tests/ecma_2/String/match-002.js
index 83ac2fa4bde..aac35cc7374 100644
--- a/mozilla/js/tests/ecma_2/String/match-002.js
+++ b/mozilla/js/tests/ecma_2/String/match-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/match-002.js
* ECMA Section: 15.6.4.9
@@ -33,136 +34,136 @@
*
*/
- var SECTION = "String/match-002.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.match( regexp )";
+var SECTION = "String/match-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
- startTest();
+startTest();
- // the regexp argument is not a RegExp object
- // this is not a string object
+// the regexp argument is not a RegExp object
+// this is not a string object
- AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/,
- "/([\d]{5})([-\ ]?[\d]{4})?$/",
- "Boston, Mass. 02134",
- 14,
- ["02134", "02134", undefined]);
+AddRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/",
+ "Boston, Mass. 02134",
+ 14,
+ ["02134", "02134", undefined]);
- AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g,
- "/([\d]{5})([-\ ]?[\d]{4})?$/g",
- "Boston, Mass. 02134",
- ["02134"]);
+AddGlobalRegExpCases( /([\d]{5})([-\ ]?[\d]{4})?$/g,
+ "/([\d]{5})([-\ ]?[\d]{4})?$/g",
+ "Boston, Mass. 02134",
+ ["02134"]);
- // set the value of lastIndex
- re = /([\d]{5})([-\ ]?[\d]{4})?$/;
- re.lastIndex = 0;
+// set the value of lastIndex
+re = /([\d]{5})([-\ ]?[\d]{4})?$/;
+re.lastIndex = 0;
- s = "Boston, MA 02134";
+s = "Boston, MA 02134";
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0",
- s,
- s.lastIndexOf("0"),
- ["02134", "02134", undefined]);
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex =0",
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
- re.lastIndex = s.length;
+re.lastIndex = s.length;
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.length,
- s,
- s.lastIndexOf("0"),
- ["02134", "02134", undefined] );
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.length,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined] );
- re.lastIndex = s.lastIndexOf("0");
+re.lastIndex = s.lastIndexOf("0");
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.lastIndexOf("0"),
- s,
- s.lastIndexOf("0"),
- ["02134", "02134", undefined]);
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0"),
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
- re.lastIndex = s.lastIndexOf("0") + 1;
+re.lastIndex = s.lastIndexOf("0") + 1;
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.lastIndexOf("0") +1,
- s,
- s.lastIndexOf("0"),
- ["02134", "02134", undefined]);
+AddRegExpCases( re,
+ "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+ s.lastIndexOf("0") +1,
+ s,
+ s.lastIndexOf("0"),
+ ["02134", "02134", undefined]);
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, string, index, matches_array ) {
+ regexp, str_regexp, string, index, matches_array ) {
// prevent a runtime error
- if ( regexp.exec(string) == null || matches_array == null ) {
- AddTestCase(
- string + ".match(" + regexp +")",
- matches_array,
- string.match(regexp) );
-
- return;
- }
-
+ if ( regexp.exec(string) == null || matches_array == null ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- matches_array.length,
- string.match(regexp).length );
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").index",
- index,
- string.match(regexp).index );
-
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +").input",
- string,
- string.match(regexp).input );
-
- var limit = matches_array.length > string.match(regexp).length ?
- matches_array.length :
- string.match(regexp).length;
-
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
function AddGlobalRegExpCases(
- regexp, str_regexp, string, matches_array ) {
+ regexp, str_regexp, string, matches_array ) {
// prevent a runtime error
- if ( regexp.exec(string) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + string +")",
- matches_array,
- regexp.exec(string) );
-
- return;
- }
-
+ if ( regexp.exec(string) == null || matches_array == null ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- matches_array.length,
- string.match(regexp).length );
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
- var limit = matches_array.length > string.match(regexp).length ?
- matches_array.length :
- string.match(regexp).length;
+ return;
+ }
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/String/match-003.js b/mozilla/js/tests/ecma_2/String/match-003.js
index f63e9e28c5b..995941b746a 100644
--- a/mozilla/js/tests/ecma_2/String/match-003.js
+++ b/mozilla/js/tests/ecma_2/String/match-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/match-003.js
* ECMA Section: 15.6.4.9
@@ -29,14 +30,14 @@
* transferred to other kinds of objects for use as a method.
*/
- var SECTION = "String/match-003.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.match( regexp )";
+var SECTION = "String/match-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
- startTest();
+startTest();
- // the regexp argument is not a RegExp object
- // this is not a string object
+// the regexp argument is not a RegExp object
+// this is not a string object
// [if regexp.global is true] set the regexp.lastIndex property to 0 and
@@ -48,79 +49,79 @@
// of RegExp.prototype.exec.
- // set the value of lastIndex
- re = /([\d]{5})([-\ ]?[\d]{4})?$/g;
+// set the value of lastIndex
+re = /([\d]{5})([-\ ]?[\d]{4})?$/g;
- s = "Boston, MA 02134";
+s = "Boston, MA 02134";
- AddGlobalRegExpCases( re,
- "re = " + re,
- s,
- ["02134" ]);
+AddGlobalRegExpCases( re,
+ "re = " + re,
+ s,
+ ["02134" ]);
- re.lastIndex = 0;
+re.lastIndex = 0;
- AddGlobalRegExpCases(
- re,
- "re = " + re + "; re.lastIndex = 0 ",
- s,
- ["02134"]);
+AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = 0 ",
+ s,
+ ["02134"]);
- re.lastIndex = s.length;
+re.lastIndex = s.length;
- AddGlobalRegExpCases(
- re,
- "re = " + re + "; re.lastIndex = " + s.length,
- s,
- ["02134"] );
+AddGlobalRegExpCases(
+ re,
+ "re = " + re + "; re.lastIndex = " + s.length,
+ s,
+ ["02134"] );
- re.lastIndex = s.lastIndexOf("0");
+re.lastIndex = s.lastIndexOf("0");
- AddGlobalRegExpCases(
- re,
- "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"),
- s,
- ["02134"]);
+AddGlobalRegExpCases(
+ re,
+ "re = "+ re +"; re.lastIndex = " + s.lastIndexOf("0"),
+ s,
+ ["02134"]);
- re.lastIndex = s.lastIndexOf("0") + 1;
+re.lastIndex = s.lastIndexOf("0") + 1;
- AddGlobalRegExpCases(
- re,
- "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1),
- s,
- ["02134"]);
+AddGlobalRegExpCases(
+ re,
+ "re = " +re+ "; re.lastIndex = " + (s.lastIndexOf("0") +1),
+ s,
+ ["02134"]);
- test();
+test();
function AddGlobalRegExpCases(
- regexp, str_regexp, string, matches_array ) {
+ regexp, str_regexp, string, matches_array ) {
// prevent a runtime error
- if ( string.match(regexp) == null || matches_array == null ) {
- AddTestCase(
- string + ".match(" + str_regexp +")",
- matches_array,
- string.match(regexp) );
-
- return;
- }
-
+ if ( string.match(regexp) == null || matches_array == null ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- matches_array.length,
- string.match(regexp).length );
+ string + ".match(" + str_regexp +")",
+ matches_array,
+ string.match(regexp) );
- var limit = matches_array.length > string.match(regexp).length ?
- matches_array.length :
- string.match(regexp).length;
+ return;
+ }
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/String/match-004.js b/mozilla/js/tests/ecma_2/String/match-004.js
index c35d9889fb4..9f8febe444e 100644
--- a/mozilla/js/tests/ecma_2/String/match-004.js
+++ b/mozilla/js/tests/ecma_2/String/match-004.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/match-004.js
* ECMA Section: 15.6.4.9
@@ -34,134 +35,134 @@
*
*/
- var SECTION = "String/match-004.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.match( regexp )";
+var SECTION = "String/match-004.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.match( regexp )";
- var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818";
+var BUGNUMBER="http://scopus/bugsplat/show_bug.cgi?id=345818";
- startTest();
+startTest();
- // set the value of lastIndex
- re = /0./;
- s = 10203040506070809000;
+// set the value of lastIndex
+re = /0./;
+s = 10203040506070809000;
- Number.prototype.match = String.prototype.match;
+Number.prototype.match = String.prototype.match;
- AddRegExpCases( re,
- "re = " + re ,
- s,
- String(s),
- 1,
- ["02"]);
+AddRegExpCases( re,
+ "re = " + re ,
+ s,
+ String(s),
+ 1,
+ ["02"]);
- re.lastIndex = 0;
- AddRegExpCases( re,
- "re = " + re +" [lastIndex is " + re.lastIndex+"]",
- s,
- String(s),
- 1,
- ["02"]);
+re.lastIndex = 0;
+AddRegExpCases( re,
+ "re = " + re +" [lastIndex is " + re.lastIndex+"]",
+ s,
+ String(s),
+ 1,
+ ["02"]);
/*
- re.lastIndex = s.length;
+re.lastIndex = s.length;
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.length,
- s,
- s.lastIndexOf("0"),
- null );
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.length,
+s,
+s.lastIndexOf("0"),
+null );
- re.lastIndex = s.lastIndexOf("0");
+re.lastIndex = s.lastIndexOf("0");
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.lastIndexOf("0"),
- s,
- s.lastIndexOf("0"),
- ["02134"]);
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.lastIndexOf("0"),
+s,
+s.lastIndexOf("0"),
+["02134"]);
- re.lastIndex = s.lastIndexOf("0") + 1;
+re.lastIndex = s.lastIndexOf("0") + 1;
- AddRegExpCases( re,
- "re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
- s.lastIndexOf("0") +1,
- s,
- 0,
- null);
+AddRegExpCases( re,
+"re = /([\d]{5})([-\ ]?[\d]{4})?$/; re.lastIndex = " +
+s.lastIndexOf("0") +1,
+s,
+0,
+null);
*/
- test();
+test();
function AddRegExpCases(
- regexp, str_regexp, string, str_string, index, matches_array ) {
+ regexp, str_regexp, string, str_string, index, matches_array ) {
// prevent a runtime error
- if ( regexp.exec(string) == null || matches_array == null ) {
- AddTestCase(
- string + ".match(" + regexp +")",
- matches_array,
- string.match(regexp) );
-
- return;
- }
-
+ if ( regexp.exec(string) == null || matches_array == null ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- matches_array.length,
- string.match(regexp).length );
+ string + ".match(" + regexp +")",
+ matches_array,
+ string.match(regexp) );
+ return;
+ }
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").index",
+ index,
+ string.match(regexp).index );
+
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").input",
+ str_string,
+ string.match(regexp).input );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").index",
- index,
- string.match(regexp).index );
-
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +").input",
- str_string,
- string.match(regexp).input );
-
- var limit = matches_array.length > string.match(regexp).length ?
- matches_array.length :
- string.match(regexp).length;
-
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
function AddGlobalRegExpCases(
- regexp, str_regexp, string, matches_array ) {
+ regexp, str_regexp, string, matches_array ) {
// prevent a runtime error
- if ( regexp.exec(string) == null || matches_array == null ) {
- AddTestCase(
- regexp + ".exec(" + string +")",
- matches_array,
- regexp.exec(string) );
-
- return;
- }
-
+ if ( regexp.exec(string) == null || matches_array == null ) {
AddTestCase(
- "( " + string + " ).match(" + str_regexp +").length",
- matches_array.length,
- string.match(regexp).length );
+ regexp + ".exec(" + string +")",
+ matches_array,
+ regexp.exec(string) );
- var limit = matches_array.length > string.match(regexp).length ?
- matches_array.length :
- string.match(regexp).length;
+ return;
+ }
- for ( var matches = 0; matches < limit; matches++ ) {
- AddTestCase(
- "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
- matches_array[matches],
- string.match(regexp)[matches] );
- }
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +").length",
+ matches_array.length,
+ string.match(regexp).length );
+
+ var limit = matches_array.length > string.match(regexp).length ?
+ matches_array.length :
+ string.match(regexp).length;
+
+ for ( var matches = 0; matches < limit; matches++ ) {
+ AddTestCase(
+ "( " + string + " ).match(" + str_regexp +")[" + matches +"]",
+ matches_array[matches],
+ string.match(regexp)[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/String/replace-001.js b/mozilla/js/tests/ecma_2/String/replace-001.js
index 5ff8dc098c7..46a076005cf 100644
--- a/mozilla/js/tests/ecma_2/String/replace-001.js
+++ b/mozilla/js/tests/ecma_2/String/replace-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/replace-001.js
* ECMA Section: 15.6.4.10
@@ -7,54 +8,54 @@
* Date: 19 February 1999
*/
- var SECTION = "String/replace-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.replace( regexp, replaceValue )";
+var SECTION = "String/replace-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.replace( regexp, replaceValue )";
- startTest();
+startTest();
- /*
- * If regexp is not an object of type RegExp, it is replaced with the
- * result of the expression new RegExp(regexp). Let string denote the
- * result of converting the this value to a string. String is searched
- * for the first occurrence of the regular expression pattern regexp if
- * regexp.global is false, or all occurrences if regexp.global is true.
- *
- * The match is performed as in String.prototype.match, including the
- * update of regexp.lastIndex. Let m be the number of matched
- * parenthesized subexpressions as specified in section 15.7.5.3.
- *
- * If replaceValue is a function, then for each matched substring, call
- * the function with the following m + 3 arguments. Argument 1 is the
- * substring that matched. The next m arguments are all of the matched
- * subexpressions. Argument m + 2 is the length of the left context, and
- * argument m + 3 is string.
- *
- * The result is a string value derived from the original input by
- * replacing each matched substring with the corresponding return value
- * of the function call, converted to a string if need be.
- *
- * Otherwise, let newstring denote the result of converting replaceValue
- * to a string. The result is a string value derived from the original
- * input string by replacing each matched substring with a string derived
- * from newstring by replacing characters in newstring by replacement text
- * as specified in the following table:
- *
- * $& The matched substring.
- * $‘ The portion of string that precedes the matched substring.
- * $’ The portion of string that follows the matched substring.
- * $+ The substring matched by the last parenthesized subexpressions in
- * the regular expression.
- * $n The corresponding matched parenthesized subexpression n, where n
- * is a single digit 0-9. If there are fewer than n subexpressions, “$n
- * is left unchanged.
- *
- * Note that the replace function is intentionally generic; it does not
- * require that its this value be a string object. Therefore, it can be
- * transferred to other kinds of objects for use as a method.
- */
+/*
+ * If regexp is not an object of type RegExp, it is replaced with the
+ * result of the expression new RegExp(regexp). Let string denote the
+ * result of converting the this value to a string. String is searched
+ * for the first occurrence of the regular expression pattern regexp if
+ * regexp.global is false, or all occurrences if regexp.global is true.
+ *
+ * The match is performed as in String.prototype.match, including the
+ * update of regexp.lastIndex. Let m be the number of matched
+ * parenthesized subexpressions as specified in section 15.7.5.3.
+ *
+ * If replaceValue is a function, then for each matched substring, call
+ * the function with the following m + 3 arguments. Argument 1 is the
+ * substring that matched. The next m arguments are all of the matched
+ * subexpressions. Argument m + 2 is the length of the left context, and
+ * argument m + 3 is string.
+ *
+ * The result is a string value derived from the original input by
+ * replacing each matched substring with the corresponding return value
+ * of the function call, converted to a string if need be.
+ *
+ * Otherwise, let newstring denote the result of converting replaceValue
+ * to a string. The result is a string value derived from the original
+ * input string by replacing each matched substring with a string derived
+ * from newstring by replacing characters in newstring by replacement text
+ * as specified in the following table:
+ *
+ * $& The matched substring.
+ * $‘ The portion of string that precedes the matched substring.
+ * $’ The portion of string that follows the matched substring.
+ * $+ The substring matched by the last parenthesized subexpressions in
+ * the regular expression.
+ * $n The corresponding matched parenthesized subexpression n, where n
+ * is a single digit 0-9. If there are fewer than n subexpressions, “$n
+ * is left unchanged.
+ *
+ * Note that the replace function is intentionally generic; it does not
+ * require that its this value be a string object. Therefore, it can be
+ * transferred to other kinds of objects for use as a method.
+ */
- testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
+// testcases[0] = { expect:"PASSED", actual:"PASSED", description:"NO TESTS EXIST" };
- test();
+test();
diff --git a/mozilla/js/tests/ecma_2/String/shell.js b/mozilla/js/tests/ecma_2/String/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/String/split-001.js b/mozilla/js/tests/ecma_2/String/split-001.js
index b2d7c9c6bdd..eae00b8e572 100644
--- a/mozilla/js/tests/ecma_2/String/split-001.js
+++ b/mozilla/js/tests/ecma_2/String/split-001.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/split-001.js
* ECMA Section: 15.6.4.9
@@ -24,83 +25,83 @@
*
*/
- var SECTION = "ecma_2/String/split-001.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.split( regexp, [,limit] )";
+var SECTION = "ecma_2/String/split-001.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
- startTest();
+startTest();
- // the separator is not supplied
- // separator is undefined
- // separator is an empty string
+// the separator is not supplied
+// separator is undefined
+// separator is an empty string
- AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
- AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
+AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
+AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
- // separartor is a regexp
- // separator regexp value global setting is set
- // string is an empty string
- // if separator is an empty string, split each by character
+// separartor is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
- // this is not a String object
+// this is not a String object
- // limit is not a number
- // limit is undefined
- // limit is larger than 2^32-1
- // limit is a negative number
+// limit is not a number
+// limit is undefined
+// limit is larger than 2^32-1
+// limit is a negative number
- test();
+test();
function AddSplitCases( string, separator, str_sep, split_array ) {
- // verify that the result of split is an object of type Array
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
AddTestCase(
- "( " + string + " ).split(" + str_sep +").constructor == Array",
- true,
- string.split(separator).constructor == Array );
-
- // check the number of items in the array
- AddTestCase(
- "( " + string + " ).split(" + str_sep +").length",
- split_array.length,
- string.split(separator).length );
-
- // check the value of each array item
- var limit = (split_array.length > string.split(separator).length )
- ? split_array.length : string.split(separator).length;
-
- for ( var matches = 0; matches < split_array.length; matches++ ) {
- AddTestCase(
- "( " + string + " ).split(" + str_sep +")[" + matches +"]",
- split_array[matches],
- string.split( separator )[matches] );
- }
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
}
function AddLimitedSplitCases(
- string, separator, str_sep, limit, str_limit, split_array ) {
+ string, separator, str_sep, limit, str_limit, split_array ) {
- // verify that the result of split is an object of type Array
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length",
+ length,
+ string.split(separator).length );
+
+ // check the value of each array item
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + str_limit +
- " ).constructor == Array",
- true,
- string.split(separator, limit).constructor == Array );
-
- // check the length of the array
-
- AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + str_limit + " ).length",
- length,
- string.split(separator).length );
-
- // check the value of each array item
-
- for ( var matches = 0; matches < split_array.length; matches++ ) {
- AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]",
- split_array[matches],
- string.split( separator )[matches] );
- }
+ "( " + string + " ).split(" + str_sep +", " + str_limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/String/split-002.js b/mozilla/js/tests/ecma_2/String/split-002.js
index 1007a3143cc..16df9e064bf 100644
--- a/mozilla/js/tests/ecma_2/String/split-002.js
+++ b/mozilla/js/tests/ecma_2/String/split-002.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/split-002.js
* ECMA Section: 15.6.4.9
@@ -24,241 +25,241 @@
*
*/
- var SECTION = "ecma_2/String/split-002.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.split( regexp, [,limit] )";
+var SECTION = "ecma_2/String/split-002.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
- startTest();
+startTest();
- // the separator is not supplied
- // separator is undefined
- // separator is an empty string
+// the separator is not supplied
+// separator is undefined
+// separator is an empty string
// AddSplitCases( "splitme", "", "''", ["s", "p", "l", "i", "t", "m", "e"] );
// AddSplitCases( "splitme", new RegExp(), "new RegExp()", ["s", "p", "l", "i", "t", "m", "e"] );
- // separator is an empty regexp
- // separator is not supplied
+// separator is an empty regexp
+// separator is not supplied
- CompareSplit( "hello", "ll" );
+CompareSplit( "hello", "ll" );
- CompareSplit( "hello", "l" );
- CompareSplit( "hello", "x" );
- CompareSplit( "hello", "h" );
- CompareSplit( "hello", "o" );
- CompareSplit( "hello", "hello" );
- CompareSplit( "hello", undefined );
+CompareSplit( "hello", "l" );
+CompareSplit( "hello", "x" );
+CompareSplit( "hello", "h" );
+CompareSplit( "hello", "o" );
+CompareSplit( "hello", "hello" );
+CompareSplit( "hello", undefined );
- CompareSplit( "hello", "");
- CompareSplit( "hello", "hellothere" );
+CompareSplit( "hello", "");
+CompareSplit( "hello", "hellothere" );
- CompareSplit( new String("hello" ) );
+CompareSplit( new String("hello" ) );
- Number.prototype.split = String.prototype.split;
+Number.prototype.split = String.prototype.split;
- CompareSplit( new Number(100111122133144155), 1 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, 1 );
+CompareSplit( new Number(100111122133144155), 1 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 1 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, 2 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, 0 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, 100 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 );
- CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" );
- CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) );
- CompareSplitWithLimit( "hello", "l", NaN );
- CompareSplitWithLimit( "hello", "l", 0 );
- CompareSplitWithLimit( "hello", "l", 1 );
- CompareSplitWithLimit( "hello", "l", 2 );
- CompareSplitWithLimit( "hello", "l", 3 );
- CompareSplitWithLimit( "hello", "l", 4 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 2 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 0 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, 100 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, void 0 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, Math.pow(2,32)-1 );
+CompareSplitWithLimit(new Number(100111122133144155), 1, "boo" );
+CompareSplitWithLimit(new Number(100111122133144155), 1, -(Math.pow(2,32)-1) );
+CompareSplitWithLimit( "hello", "l", NaN );
+CompareSplitWithLimit( "hello", "l", 0 );
+CompareSplitWithLimit( "hello", "l", 1 );
+CompareSplitWithLimit( "hello", "l", 2 );
+CompareSplitWithLimit( "hello", "l", 3 );
+CompareSplitWithLimit( "hello", "l", 4 );
/*
- CompareSplitWithLimit( "hello", "ll", 0 );
- CompareSplitWithLimit( "hello", "ll", 1 );
- CompareSplitWithLimit( "hello", "ll", 2 );
- CompareSplit( "", " " );
- CompareSplit( "" );
+ CompareSplitWithLimit( "hello", "ll", 0 );
+ CompareSplitWithLimit( "hello", "ll", 1 );
+ CompareSplitWithLimit( "hello", "ll", 2 );
+ CompareSplit( "", " " );
+ CompareSplit( "" );
*/
- // separartor is a regexp
- // separator regexp value global setting is set
- // string is an empty string
- // if separator is an empty string, split each by character
+// separartor is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
- // this is not a String object
+// this is not a String object
- // limit is not a number
- // limit is undefined
- // limit is larger than 2^32-1
- // limit is a negative number
+// limit is not a number
+// limit is undefined
+// limit is larger than 2^32-1
+// limit is a negative number
- test();
+test();
function CompareSplit( string, separator ) {
- split_1 = string.split( separator );
- split_2 = string_split( string, separator );
+ split_1 = string.split( separator );
+ split_2 = string_split( string, separator );
+ AddTestCase(
+ "( " + string +".split(" + separator + ") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
AddTestCase(
- "( " + string +".split(" + separator + ") ).length" ,
- split_2.length,
- split_1.length );
-
- var limit = split_1.length > split_2.length ?
- split_1.length : split_2.length;
-
- for ( var split_item = 0; split_item < limit; split_item++ ) {
- AddTestCase(
- string + ".split(" + separator + ")["+split_item+"]",
- split_2[split_item],
- split_1[split_item] );
- }
+ string + ".split(" + separator + ")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
}
function CompareSplitWithLimit( string, separator, splitlimit ) {
- split_1 = string.split( separator, splitlimit );
- split_2 = string_split( string, separator, splitlimit );
+ split_1 = string.split( separator, splitlimit );
+ split_2 = string_split( string, separator, splitlimit );
+ AddTestCase(
+ "( " + string +".split(" + separator + ", " + splitlimit+") ).length" ,
+ split_2.length,
+ split_1.length );
+
+ var limit = split_1.length > split_2.length ?
+ split_1.length : split_2.length;
+
+ for ( var split_item = 0; split_item < limit; split_item++ ) {
AddTestCase(
- "( " + string +".split(" + separator + ", " + splitlimit+") ).length" ,
- split_2.length,
- split_1.length );
-
- var limit = split_1.length > split_2.length ?
- split_1.length : split_2.length;
-
- for ( var split_item = 0; split_item < limit; split_item++ ) {
- AddTestCase(
- string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]",
- split_2[split_item],
- split_1[split_item] );
- }
+ string + ".split(" + separator + ", " + splitlimit+")["+split_item+"]",
+ split_2[split_item],
+ split_1[split_item] );
+ }
}
function string_split ( __this, separator, limit ) {
- var S = String(__this ); // 1
+ var S = String(__this ); // 1
- var A = new Array(); // 2
+ var A = new Array(); // 2
- if ( limit == undefined ) { // 3
- lim = Math.pow(2, 31 ) -1;
- } else {
- lim = ToUint32( limit );
- }
+ if ( limit == undefined ) { // 3
+ lim = Math.pow(2, 31 ) -1;
+ } else {
+ lim = ToUint32( limit );
+ }
- var s = S.length; // 4
- var p = 0; // 5
+ var s = S.length; // 4
+ var p = 0; // 5
- if ( separator == undefined ) { // 8
- A[0] = S;
- return A;
- }
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
- if ( separator.constructor == RegExp ) // 6
- R = separator;
- else
- R = separator.toString();
+ if ( separator.constructor == RegExp ) // 6
+ R = separator;
+ else
+ R = separator.toString();
- if (lim == 0) return A; // 7
+ if (lim == 0) return A; // 7
- if ( separator == undefined ) { // 8
- A[0] = S;
- return A;
- }
+ if ( separator == undefined ) { // 8
+ A[0] = S;
+ return A;
+ }
- if (s == 0) { // 9
- z = SplitMatch(R, S, 0);
- if (z != false) return A;
- A[0] = S;
- return A;
- }
+ if (s == 0) { // 9
+ z = SplitMatch(R, S, 0);
+ if (z != false) return A;
+ A[0] = S;
+ return A;
+ }
- var q = p; // 10
+ var q = p; // 10
loop:
- while (true ) {
+ while (true ) {
- if ( q == s ) break; // 11
+ if ( q == s ) break; // 11
- z = SplitMatch(R, S, q); // 12
+ z = SplitMatch(R, S, q); // 12
//print("Returned ", z);
- if (z != false) { // 13
- e = z.endIndex; // 14
- cap = z.captures; // 14
- if (e != p) { // 15
+ if (z != false) { // 13
+ e = z.endIndex; // 14
+ cap = z.captures; // 14
+ if (e != p) { // 15
//print("S = ", S, ", p = ", p, ", q = ", q);
- T = S.slice(p, q); // 16
+ T = S.slice(p, q); // 16
//print("T = ", T);
- A[A.length] = T; // 17
- if (A.length == lim) return A; // 18
- p = e; // 19
- i = 0; // 20
- while (true) { // 25
- if (i == cap.length) { // 21
- q = p; // 10
- continue loop;
- }
- i = i + 1; // 22
- A[A.length] = cap[i] // 23
- if (A.length == lim) return A; // 24
- }
- }
- }
+ A[A.length] = T; // 17
+ if (A.length == lim) return A; // 18
+ p = e; // 19
+ i = 0; // 20
+ while (true) { // 25
+ if (i == cap.length) { // 21
+ q = p; // 10
+ continue loop;
+ }
+ i = i + 1; // 22
+ A[A.length] = cap[i] // 23
+ if (A.length == lim) return A; // 24
+ }
+ }
+ }
- q = q + 1; // 26
- }
+ q = q + 1; // 26
+ }
- T = S.slice(p, q);
- A[A.length] = T;
- return A;
+ T = S.slice(p, q);
+ A[A.length] = T;
+ return A;
}
function SplitMatch(R, S, q)
{
- if (R.constructor == RegExp) { // 1
- var reResult = R.match(S, q); // 8
- if (reResult == undefined)
- return false;
- else {
- a = new Array(reResult.length - 1);
- for (var i = 1; i < reResult.length; i++)
- a[a.length] = reResult[i];
- return { endIndex : reResult.index + reResult[0].length, captures : cap };
- }
- }
- else {
- var r = R.length; // 2
- s = S.length; // 3
- if ((q + r) > s) return false; // 4
- for (var i = 0; i < r; i++) {
+ if (R.constructor == RegExp) { // 1
+ var reResult = R.match(S, q); // 8
+ if (reResult == undefined)
+ return false;
+ else {
+ a = new Array(reResult.length - 1);
+ for (var i = 1; i < reResult.length; i++)
+ a[a.length] = reResult[i];
+ return { endIndex : reResult.index + reResult[0].length, captures : cap };
+ }
+ }
+ else {
+ var r = R.length; // 2
+ s = S.length; // 3
+ if ((q + r) > s) return false; // 4
+ for (var i = 0; i < r; i++) {
//print("S.charAt(", q + i, ") = ", S.charAt(q + i), ", R.charAt(", i, ") = ", R.charAt(i));
- if (S.charAt(q + i) != R.charAt(i)) // 5
- return false;
- }
- cap = new Array(); // 6
- return { endIndex : q + r, captures : cap }; // 7
- }
+ if (S.charAt(q + i) != R.charAt(i)) // 5
+ return false;
+ }
+ cap = new Array(); // 6
+ return { endIndex : q + r, captures : cap }; // 7
+ }
}
function ToUint32( n ) {
- n = Number( n );
- var sign = ( n < 0 ) ? -1 : 1;
+ n = Number( n );
+ var sign = ( n < 0 ) ? -1 : 1;
- if ( Math.abs( n ) == 0
- || Math.abs( n ) == Number.POSITIVE_INFINITY
- || n != n) {
- return 0;
- }
- n = sign * Math.floor( Math.abs(n) )
+ if ( Math.abs( n ) == 0
+ || Math.abs( n ) == Number.POSITIVE_INFINITY
+ || n != n) {
+ return 0;
+ }
+ n = sign * Math.floor( Math.abs(n) )
n = n % Math.pow(2,32);
- if ( n < 0 ){
- n += Math.pow(2,32);
- }
+ if ( n < 0 ){
+ n += Math.pow(2,32);
+ }
- return ( n );
+ return ( n );
}
diff --git a/mozilla/js/tests/ecma_2/String/split-003.js b/mozilla/js/tests/ecma_2/String/split-003.js
index e2f2b924bc4..4f8bf34ef62 100644
--- a/mozilla/js/tests/ecma_2/String/split-003.js
+++ b/mozilla/js/tests/ecma_2/String/split-003.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/**
* File Name: String/split-003.js
* ECMA Section: 15.6.4.9
@@ -24,94 +25,94 @@
*
*/
- var SECTION = "ecma_2/String/split-003.js";
- var VERSION = "ECMA_2";
- var TITLE = "String.prototype.split( regexp, [,limit] )";
+var SECTION = "ecma_2/String/split-003.js";
+var VERSION = "ECMA_2";
+var TITLE = "String.prototype.split( regexp, [,limit] )";
- startTest();
+startTest();
- // separartor is a regexp
- // separator regexp value global setting is set
- // string is an empty string
- // if separator is an empty string, split each by character
+// separator is a regexp
+// separator regexp value global setting is set
+// string is an empty string
+// if separator is an empty string, split each by character
- AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
- AddSplitCases( "hello", /l/, "/l/", ["he","","o"] );
- AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] );
- AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] );
- AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] );
- AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] );
- AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] );
- AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] );
- AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] );
- AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] );
+AddSplitCases( "hello", /l/, "/l/", ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 0, [] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 1, ["he"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 2, ["he",""] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 3, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", 4, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", void 0, ["he","","o"] );
+AddLimitedSplitCases( "hello", /l/, "/l/", "hi", [] );
+AddLimitedSplitCases( "hello", /l/, "/l/", undefined, ["he","","o"] );
- AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] );
- AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] );
+AddSplitCases( "hello", new RegExp, "new RegExp", ["h","e","l","l","o"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 0, [] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 1, ["h"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 2, ["h","e"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 3, ["h","e","l"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", 4, ["h","e","l","l"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", void 0, ["h","e","l","l","o"] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", "hi", [] );
+AddLimitedSplitCases( "hello", new RegExp, "new RegExp", undefined, ["h","e","l","l","o"] );
- test();
+test();
function AddSplitCases( string, separator, str_sep, split_array ) {
- // verify that the result of split is an object of type Array
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").constructor == Array",
+ true,
+ string.split(separator).constructor == Array );
+
+ // check the number of items in the array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +").length",
+ split_array.length,
+ string.split(separator).length );
+
+ // check the value of each array item
+ var limit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator).length;
+
+ for ( var matches = 0; matches < split_array.length; matches++ ) {
AddTestCase(
- "( " + string + " ).split(" + str_sep +").constructor == Array",
- true,
- string.split(separator).constructor == Array );
-
- // check the number of items in the array
- AddTestCase(
- "( " + string + " ).split(" + str_sep +").length",
- split_array.length,
- string.split(separator).length );
-
- // check the value of each array item
- var limit = (split_array.length > string.split(separator).length )
- ? split_array.length : string.split(separator).length;
-
- for ( var matches = 0; matches < split_array.length; matches++ ) {
- AddTestCase(
- "( " + string + " ).split(" + str_sep +")[" + matches +"]",
- split_array[matches],
- string.split( separator )[matches] );
- }
+ "( " + string + " ).split(" + str_sep +")[" + matches +"]",
+ split_array[matches],
+ string.split( separator )[matches] );
+ }
}
function AddLimitedSplitCases(
- string, separator, str_sep, limit, split_array ) {
+ string, separator, str_sep, limit, split_array ) {
- // verify that the result of split is an object of type Array
+ // verify that the result of split is an object of type Array
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit +
+ " ).constructor == Array",
+ true,
+ string.split(separator, limit).constructor == Array );
+
+ // check the length of the array
+
+ AddTestCase(
+ "( " + string + " ).split(" + str_sep +", " + limit + " ).length",
+ split_array.length,
+ string.split(separator, limit).length );
+
+ // check the value of each array item
+
+ var slimit = (split_array.length > string.split(separator).length )
+ ? split_array.length : string.split(separator, limit).length;
+
+ for ( var matches = 0; matches < slimit; matches++ ) {
AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + limit +
- " ).constructor == Array",
- true,
- string.split(separator, limit).constructor == Array );
-
- // check the length of the array
-
- AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + limit + " ).length",
- split_array.length,
- string.split(separator, limit).length );
-
- // check the value of each array item
-
- var slimit = (split_array.length > string.split(separator).length )
- ? split_array.length : string.split(separator, limit).length;
-
- for ( var matches = 0; matches < slimit; matches++ ) {
- AddTestCase(
- "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]",
- split_array[matches],
- string.split( separator, limit )[matches] );
- }
+ "( " + string + " ).split(" + str_sep +", " + limit + " )[" + matches +"]",
+ split_array[matches],
+ string.split( separator, limit )[matches] );
+ }
}
diff --git a/mozilla/js/tests/ecma_2/browser.js b/mozilla/js/tests/ecma_2/browser.js
index 2083941f784..5b99a652955 100644
--- a/mozilla/js/tests/ecma_2/browser.js
+++ b/mozilla/js/tests/ecma_2/browser.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -49,50 +50,78 @@
*
*/
-onerror = err;
-
var GLOBAL = "[object Window]";
-function startTest() {
- writeHeaderToLog( SECTION + " "+ TITLE);
- if ( BUGNUMBER ) {
- writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
- }
-
- testcases = new Array();
- tc = 0;
-}
-
function writeLineToLog( string ) {
- document.write( string + "
\n");
+ document.write( string + "
\n");
}
function writeHeaderToLog( string ) {
- document.write( "" + string + "
" );
+ document.write( "" + string + "
" );
}
-function stopTest() {
- var gc;
- if ( gc != undefined ) {
- gc();
- }
- document.write( "
" );
-}
-function writeFormattedResult( expect, actual, string, passed ) {
- var s = ""+ string ;
- s += "" ;
- s += ( passed ) ? " " + PASSED
- : " " + FAILED + expect + "";
- writeLineToLog( s + "" );
- return passed;
-}
-function err( msg, page, line ) {
- writeLineToLog( "Test failed on line " + line + " with the message: " + msg );
- testcases[tc].actual = "error";
- testcases[tc].reason = msg;
- writeTestCaseResult( testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual +
- ": " + testcases[tc].reason );
- stopTest();
- return true;
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = ""+ string ;
+ s += "" ;
+ s += ( passed ) ? " " + PASSED
+ : " " + FAILED + expect + "";
+ writeLineToLog( s + "" );
+ return passed;
}
+
+
+/*
+ * The earlier versions of the test code used exceptions
+ * to terminate the test script in "negative" test cases
+ * before the failure reporting code could run. In order
+ * to be able to capture errors for the "negative" case
+ * where the exception is a sign the test actually passed,
+ * the err online handler will assume that any error is a
+ * failure unless gExceptionExpected is true.
+ */
+window.onerror = err;
+var gExceptionExpected = false;
+
+function err( msg, page, line ) {
+ var testcase;
+
+ if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
+ /*
+ * an unexpected exception occured
+ */
+ writeLineToLog( "Test failed with the message: " + msg );
+ testcase = new TestCase(SECTION, "unknown", "unknown", "unknown");
+ testcase.passed = false;
+ testcase.reason = "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ return;
+ }
+
+ if (typeof SECTION == 'undefined')
+ {
+ SECTION = 'Unknown';
+ }
+ if (typeof DESCRIPTION == 'undefined')
+ {
+ DESCRIPTION = 'Unknown';
+ }
+ if (typeof EXPECTED == 'undefined')
+ {
+ EXPECTED = 'Unknown';
+ }
+
+ testcase = new TestCase(SECTION, DESCRIPTION, EXPECTED, "error");
+ testcase.reason += "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ stopTest();
+}
+
+var gVersion = 0;
+
+function version(v)
+{
+ if (v) {
+ gVersion = v;
+ }
+ return gVersion;
+}
+
diff --git a/mozilla/js/tests/ecma_2/instanceof/browser.js b/mozilla/js/tests/ecma_2/instanceof/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/instanceof/instanceof-002.js b/mozilla/js/tests/ecma_2/instanceof/instanceof-002.js
index d07292dd4fc..d26759de7e3 100644
--- a/mozilla/js/tests/ecma_2/instanceof/instanceof-002.js
+++ b/mozilla/js/tests/ecma_2/instanceof/instanceof-002.js
@@ -15,47 +15,31 @@
startTest();
writeHeaderToLog( SECTION + " "+ TITLE);
- var tc = 0;
- var testcases = new Array();
-
var b = new Boolean();
- testcases[tc++] = new TestCase( SECTION,
- "var b = new Boolean(); b instanceof Boolean",
- true,
- b instanceof Boolean );
+ new TestCase( SECTION,
+ "var b = new Boolean(); b instanceof Boolean",
+ true,
+ b instanceof Boolean );
- testcases[tc++] = new TestCase( SECTION,
- "b instanceof Object",
- true,
- b instanceof Object );
+ new TestCase( SECTION,
+ "b instanceof Object",
+ true,
+ b instanceof Object );
- testcases[tc++] = new TestCase( SECTION,
- "b instanceof Array",
- false,
- b instanceof Array );
+ new TestCase( SECTION,
+ "b instanceof Array",
+ false,
+ b instanceof Array );
- testcases[tc++] = new TestCase( SECTION,
- "true instanceof Boolean",
- false,
- true instanceof Boolean );
+ new TestCase( SECTION,
+ "true instanceof Boolean",
+ false,
+ true instanceof Boolean );
- testcases[tc++] = new TestCase( SECTION,
- "Boolean instanceof Object",
- true,
- Boolean instanceof Object );
+ new TestCase( SECTION,
+ "Boolean instanceof Object",
+ true,
+ Boolean instanceof Object );
test();
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
-
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
-}
diff --git a/mozilla/js/tests/ecma_2/instanceof/shell.js b/mozilla/js/tests/ecma_2/instanceof/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_2/shell.js b/mozilla/js/tests/ecma_2/shell.js
index d72fd34ddc1..bdc9a186f08 100644
--- a/mozilla/js/tests/ecma_2/shell.js
+++ b/mozilla/js/tests/ecma_2/shell.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -34,7 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
-
/*
* JavaScript shared functions file for running the tests in either
* stand-alone JavaScript engine. To run a test, first load this file,
@@ -42,183 +42,222 @@
*/
var completed = false;
-var testcases;
-var tc = 0;
+var testcases = new Array();
+var tc = testcases.length;
-SECTION = "";
-VERSION = "";
-BUGNUMBER="";
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER="";
var TZ_DIFF = getTimeZoneDiff();
-var DEBUG = false;
-var GLOBAL = "[object global]";
+/*
+ * constant strings
+ */
+var GLOBAL = "[object global]";
var PASSED = " PASSED!"
var FAILED = " FAILED! expected: ";
-function test() {
- for ( tc=0; tc < testcases.length; tc++ ) {
- testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+
- testcases[tc].actual );
+var DEBUG = false;
- testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
- }
- stopTest();
- return ( testcases );
+
+/*
+ * wrapper for test case constructor that doesn't require the SECTION
+ * argument.
+ */
+
+function AddTestCase( description, expect, actual ) {
+ new TestCase( SECTION, description, expect, actual );
}
+
+/*
+ * TestCase constructor
+ *
+ */
function TestCase( n, d, e, a ) {
- this.name = n;
- this.description = d;
- this.expect = e;
- this.actual = a;
- this.passed = true;
- this.reason = "";
- this.bugnumber = BUGNUMBER;
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
- this.passed = getTestCaseResult( this.expect, this.actual );
- if ( DEBUG ) {
- writeLineToLog( "added " + this.description );
- }
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+ /*
+ * testcases are solely maintained in the TestCase
+ * constructor. tc will _always_ point to one past the
+ * last testcase. If an exception occurs during the call
+ * to the constructor, then we are assured that the tc
+ * index has not been incremented.
+ */
+
+ testcases[tc++] = this;
}
+
+/*
+ * Set up test environment.
+ *
+ */
function startTest() {
- if ( version ) {
- // JavaScript 1.3 is supposed to be compliant ecma version 1.0
- if ( VERSION == "ECMA_1" ) {
- version ( 130 );
- }
- if ( VERSION == "JS_13" ) {
- version ( 130 );
- }
- if ( VERSION == "JS_12" ) {
- version ( 120 );
- }
- if ( VERSION == "JS_11" ) {
- version ( 110 );
- }
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( 130 );
}
-
-
- // for ecma version 2.0, we will leave the javascript version to
- // the default ( for now ).
-
- writeHeaderToLog( SECTION + " "+ TITLE);
- if ( BUGNUMBER ) {
- writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ if ( VERSION == "JS_13" ) {
+ version ( 130 );
}
+ if ( VERSION == "JS_12" ) {
+ version ( 120 );
+ }
+ if ( VERSION == "JS_11" ) {
+ version ( 110 );
+ }
+ }
+
+
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
+
+ writeHeaderToLog( SECTION + " "+ TITLE);
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
- testcases = new Array();
- tc = 0;
}
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ try
+ {
+ testcases[tc].passed = writeTestCaseResult(
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+
+ testcases[tc].actual );
+
+ testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
+ }
+ catch(e)
+ {
+ writeLineToLog('test(): empty testcase for tc = ' + tc + ' ' + e);
+ }
+ }
+ stopTest();
+ return ( testcases );
+}
+
+
+/*
+ * Compare expected result to the actual result and figure out whether
+ * the test case passed.
+ */
function getTestCaseResult( expect, actual ) {
- // because ( NaN == NaN ) always returns false, need to do
- // a special compare to see if we got the right result.
- if ( actual != actual ) {
- if ( typeof actual == "object" ) {
- actual = "NaN object";
- } else {
- actual = "NaN number";
- }
- }
- if ( expect != expect ) {
- if ( typeof expect == "object" ) {
- expect = "NaN object";
- } else {
- expect = "NaN number";
- }
- }
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
+ }
- var passed = ( expect == actual ) ? true : false;
+ var passed = ( expect == actual ) ? true : false;
- // if both objects are numbers
- // need to replace w/ IEEE standard for rounding
- if ( !passed
- && typeof(actual) == "number"
- && typeof(expect) == "number"
- ) {
- if ( Math.abs(actual-expect) < 0.0000001 ) {
- passed = true;
- }
- }
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
+ }
- // verify type is the same
- if ( typeof(expect) != typeof(actual) ) {
- passed = false;
- }
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
+ }
- return passed;
+ return passed;
}
+
+/*
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
+ */
+
function writeTestCaseResult( expect, actual, string ) {
- var passed = getTestCaseResult( expect, actual );
- writeFormattedResult( expect, actual, string, passed );
- return passed;
+ var passed = getTestCaseResult( expect, actual );
+ writeFormattedResult( expect, actual, string, passed );
+ return passed;
}
function writeFormattedResult( expect, actual, string, passed ) {
- var s = string ;
- s += ( passed ) ? PASSED : FAILED + expect;
- writeLineToLog( s);
- return passed;
+ var s = string ;
+ s += ( passed ) ? PASSED : FAILED + expect;
+ writeLineToLog( s);
+ return passed;
}
function writeLineToLog( string ) {
- print( string );
+ print( string );
}
function writeHeaderToLog( string ) {
- print( string );
+ print( string );
}
+/* end of print functions */
+
+/*
+ * When running in the shell, run the garbage collector after the
+ * test has completed.
+ */
+
function stopTest() {
- var gc;
- if ( gc != undefined ) {
- gc();
- }
+ var gc;
+ if ( gc != undefined ) {
+ gc();
+ }
}
+
+/*
+ * Convenience function for displaying failed test cases. Useful
+ * when running tests manually.
+ *
+ */
function getFailedCases() {
for ( var i = 0; i < testcases.length; i++ ) {
- if ( ! testcases[i].passed ) {
- print( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
- }
- }
-}
-function err( msg, page, line ) {
- writeLineToLog( page + " failed with error: " + msg + " on line " + line );
- testcases[tc].actual = "error";
- testcases[tc].reason = msg;
- writeTestCaseResult( testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual +
- ": " + testcases[tc].reason );
- stopTest();
- return true;
-}
-
-function Enumerate ( o ) {
- var properties = new Array();
- for ( p in o ) {
- properties[ properties.length ] = new Array( p, o[p] );
+ if ( ! testcases[i].passed ) {
+ writeLineToLog( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
}
- return properties;
-}
-
-function getFailedCases() {
- for ( var i = 0; i < testcases.length; i++ ) {
- if ( ! testcases[i].passed ) {
- writeLineToLog( testcases[i].description +" = " +testcases[i].actual +
- " expected: "+ testcases[i].expect );
- }
}
}
-function AddTestCase( description, expect, actual ) {
- testcases[tc++] = new TestCase( SECTION, description, expect, actual );
+function Enumerate ( o ) {
+ var properties = new Array();
+ for ( p in o ) {
+ properties[ properties.length ] = new Array( p, o[p] );
+ }
+ return properties;
}
-
/*
* Originally, the test suite used a hard-coded value TZ_DIFF = -8.
* But that was only valid for testers in the Pacific Standard Time Zone!
@@ -229,3 +268,4 @@ function getTimeZoneDiff()
{
return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
}
+
diff --git a/mozilla/js/tests/ecma_2/template.js b/mozilla/js/tests/ecma_2/template.js
index f193cf02d2a..dd5b43e6104 100644
--- a/mozilla/js/tests/ecma_2/template.js
+++ b/mozilla/js/tests/ecma_2/template.js
@@ -41,14 +41,14 @@
* Author: ** replace with your e-mail address **
*/
- var SECTION = ""; // if ECMA test, provide section number
- var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
- var TITLE = ""; // Provide ECMA section title or description
- var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
+var SECTION = ""; // if ECMA test, provide section number
+var VERSION = "ECMA_2"; // Version of JavaScript or ECMA
+var TITLE = ""; // Provide ECMA section title or description
+var BUGNUMBER = ""; // Provide URL to bugsplat or bugzilla report
- startTest(); // leave this alone
+startTest(); // leave this alone
- /* Calls to AddTestCase here */
+/* Calls to AddTestCase here */
- test(); // leave this alone
+test(); // leave this alone
diff --git a/mozilla/js/tests/ecma_3/Array/browser.js b/mozilla/js/tests/ecma_3/Array/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Array/shell.js b/mozilla/js/tests/ecma_3/Array/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Date/15.9.5.3.js b/mozilla/js/tests/ecma_3/Date/15.9.5.3.js
index 22dc721121d..583e9ea817b 100644
--- a/mozilla/js/tests/ecma_3/Date/15.9.5.3.js
+++ b/mozilla/js/tests/ecma_3/Date/15.9.5.3.js
@@ -126,7 +126,7 @@
function addTestCase()
{
- testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+ new TestCase( SECTION, status, expect, actual);
}
@@ -161,4 +161,4 @@ function test()
}
stopTest();
return (testcases);
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma_3/Date/15.9.5.4.js b/mozilla/js/tests/ecma_3/Date/15.9.5.4.js
index b7a343757b0..0ae5e5dc466 100644
--- a/mozilla/js/tests/ecma_3/Date/15.9.5.4.js
+++ b/mozilla/js/tests/ecma_3/Date/15.9.5.4.js
@@ -133,7 +133,7 @@
function addTestCase()
{
- testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+ new TestCase( SECTION, status, expect, actual);
}
diff --git a/mozilla/js/tests/ecma_3/Date/15.9.5.5.js b/mozilla/js/tests/ecma_3/Date/15.9.5.5.js
index 02f24a81ec4..ae3a5d70cc0 100644
--- a/mozilla/js/tests/ecma_3/Date/15.9.5.5.js
+++ b/mozilla/js/tests/ecma_3/Date/15.9.5.5.js
@@ -127,7 +127,7 @@
function addTestCase()
{
- testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+ new TestCase( SECTION, status, expect, actual);
}
@@ -155,4 +155,4 @@ function test()
}
stopTest();
return (testcases);
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma_3/Date/15.9.5.6.js b/mozilla/js/tests/ecma_3/Date/15.9.5.6.js
index 74e496a6ac3..637a8c62898 100644
--- a/mozilla/js/tests/ecma_3/Date/15.9.5.6.js
+++ b/mozilla/js/tests/ecma_3/Date/15.9.5.6.js
@@ -128,7 +128,7 @@
function addTestCase()
{
- testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+ new TestCase( SECTION, status, expect, actual);
}
@@ -163,4 +163,4 @@ function test()
}
stopTest();
return (testcases);
-}
\ No newline at end of file
+}
diff --git a/mozilla/js/tests/ecma_3/Date/15.9.5.7.js b/mozilla/js/tests/ecma_3/Date/15.9.5.7.js
index 8d759eebb74..363cca054aa 100644
--- a/mozilla/js/tests/ecma_3/Date/15.9.5.7.js
+++ b/mozilla/js/tests/ecma_3/Date/15.9.5.7.js
@@ -136,7 +136,7 @@
function addTestCase()
{
- testcases[tc++] = new TestCase( SECTION, status, expect, actual);
+ new TestCase( SECTION, status, expect, actual);
}
diff --git a/mozilla/js/tests/ecma_3/Date/browser.js b/mozilla/js/tests/ecma_3/Date/browser.js
new file mode 100644
index 00000000000..5afc6ab43bb
--- /dev/null
+++ b/mozilla/js/tests/ecma_3/Date/browser.js
@@ -0,0 +1,98 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * 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):
+ */
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ *
+ *
+ *
+ */
+
+var GLOBAL = "[object Window]";
+
+function writeLineToLog( string ) {
+ document.write( string + "
\n");
+}
+
+function writeHeaderToLog( string ) {
+ document.write( "" + string + "
" );
+}
+
+function writeFormattedResult( expect, actual, string, passed ) {
+ var s = ""+ string ;
+ s += "" ;
+ s += ( passed ) ? " " + PASSED
+ : " " + FAILED + expect + "";
+ writeLineToLog( s + "" );
+ return passed;
+}
+
+/*
+ * The earlier versions of the test code used exceptions
+ * to terminate the test script in "negative" test cases
+ * before the failure reporting code could run. In order
+ * to be able to capture errors for the "negative" case
+ * where the exception is a sign the test actually passed,
+ * the err online handler will assume that any error is a
+ * failure unless gExceptionExpected is true.
+ */
+window.onerror = err;
+var gExceptionExpected = false;
+
+function err( msg, page, line ) {
+ var testcase;
+
+ if (typeof(EXPECTED) == "undefined" || EXPECTED != "error") {
+ /*
+ * an unexpected exception occured
+ */
+ writeLineToLog( "Test failed with the message: " + msg );
+ testcase = new TestCase(SECTION, "unknown", "unknown", "unknown");
+ testcase.passed = false;
+ testcase.reason = "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ return
+ }
+
+ testcase = new TestCase(SECTION, DESCRIPTION, EXPECTED, "error");
+ testcase.reason += "Error: " + msg +
+ " Source File: " + page + " Line: " + line + ".";
+ stopTest();
+}
+
+var gVersion = 0;
+
+function version(v)
+{
+ if (v) {
+ gVersion = v;
+ }
+ return gVersion;
+}
diff --git a/mozilla/js/tests/ecma_3/Date/shell.js b/mozilla/js/tests/ecma_3/Date/shell.js
index c5eda103638..91036141173 100644
--- a/mozilla/js/tests/ecma_3/Date/shell.js
+++ b/mozilla/js/tests/ecma_3/Date/shell.js
@@ -41,12 +41,12 @@
*/
var completed = false;
-var testcases;
-var tc = 0;
+var testcases = new Array();
+var tc = testcases.length;
-SECTION = "";
-VERSION = "";
-BUGNUMBER = "";
+var SECTION = "";
+var VERSION = "";
+var BUGNUMBER = "";
/*
* constant strings
@@ -54,609 +54,656 @@ BUGNUMBER = "";
var GLOBAL = "[object global]";
var PASSED = " PASSED!"
var FAILED = " FAILED! expected: ";
+
var DEBUG = false;
-
-/*
-* Wrapper for test case constructor that doesn't require the SECTION argument.
+/*
+ * wrapper for test case constructor that doesn't require the SECTION
+ * argument.
*/
-function AddTestCase( description, expect, actual )
-{
- testcases[tc++] = new TestCase( SECTION, description, expect, actual );
-}
+function AddTestCase( description, expect, actual ) {
+ new TestCase( SECTION, description, expect, actual );
+}
/*
* TestCase constructor
-*/
-function TestCase( n, d, e, a )
-{
- this.name = n;
- this.description = d;
- this.expect = e;
- this.actual = a;
- this.passed = true;
- this.reason = "";
- this.bugnumber = BUGNUMBER;
- this.passed = getTestCaseResult( this.expect, this.actual );
- if ( DEBUG ) {writeLineToLog("added " + this.description);}
-}
+ *
+ */
+function TestCase( n, d, e, a ) {
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = true;
+ this.reason = "";
+ this.bugnumber = BUGNUMBER;
+
+ this.passed = getTestCaseResult( this.expect, this.actual );
+ if ( DEBUG ) {
+ writeLineToLog( "added " + this.description );
+ }
+ /*
+ * testcases are solely maintained in the TestCase
+ * constructor. tc will _always_ point to one past the
+ * last testcase. If an exception occurs during the call
+ * to the constructor, then we are assured that the tc
+ * index has not been incremented.
+ */
+
+ testcases[tc++] = this;
+}
/*
* Set up test environment.
-*/
-function startTest()
-{
- if ( version )
- {
- // JavaScript 1.3 is supposed to be compliant ECMA version 1.0
- if (VERSION == "ECMA_1" ) {version ("130");}
- if (VERSION == "JS_1.3" ) {version ( "130");}
- if (VERSION == "JS_1.2" ) {version ( "120");}
- if (VERSION == "JS_1.1" ) {version( "110");}
-
- // for ECMA version 2.0, we will leave the JavaScript version
- // to the default ( for now ).
- }
-
- // print out bugnumber
- if ( BUGNUMBER )
- {
- writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ *
+ */
+function startTest() {
+ if ( version ) {
+ // JavaScript 1.3 is supposed to be compliant ecma version 1.0
+ if ( VERSION == "ECMA_1" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.3" ) {
+ version ( "130" );
+ }
+ if ( VERSION == "JS_1.2" ) {
+ version ( "120" );
+ }
+ if ( VERSION == "JS_1.1" ) {
+ version ( "110" );
+ }
+ // for ecma version 2.0, we will leave the javascript version to
+ // the default ( for now ).
}
- testcases = new Array();
- tc = 0;
+ // print out bugnumber
+
+ if ( BUGNUMBER ) {
+ writeLineToLog ("BUGNUMBER: " + BUGNUMBER );
+ }
}
-
-function test()
-{
- for ( tc=0; tc < testcases.length; tc++ )
- {
+function test() {
+ for ( tc=0; tc < testcases.length; tc++ ) {
+ try
+ {
testcases[tc].passed = writeTestCaseResult(
- testcases[tc].expect,
- testcases[tc].actual,
- testcases[tc].description +" = "+ testcases[tc].actual );
-
+ testcases[tc].expect,
+ testcases[tc].actual,
+ testcases[tc].description +" = "+ testcases[tc].actual );
testcases[tc].reason += ( testcases[tc].passed ) ? "" : "wrong value ";
}
-
+ catch(e)
+ {
+ writeLineToLog('test(): empty testcase for tc = ' + tc + ' ' + e);
+ }
+ }
stopTest();
return ( testcases );
}
-
/*
* Compare expected result to the actual result and figure out whether
* the test case passed.
*/
-function getTestCaseResult(expect, actual )
-{
- //because ( NaN == NaN ) always returns false, need to do
- //a special compare to see if we got the right result.
- if ( actual != actual )
- {
- if ( typeof actual == "object" ) {actual = "NaN object";}
- else {actual = "NaN number";}
+function getTestCaseResult( expect, actual ) {
+ // because ( NaN == NaN ) always returns false, need to do
+ // a special compare to see if we got the right result.
+ if ( actual != actual ) {
+ if ( typeof actual == "object" ) {
+ actual = "NaN object";
+ } else {
+ actual = "NaN number";
+ }
+ }
+ if ( expect != expect ) {
+ if ( typeof expect == "object" ) {
+ expect = "NaN object";
+ } else {
+ expect = "NaN number";
+ }
}
- if ( expect != expect )
- {
- if ( typeof expect == "object" ) {expect = "NaN object";}
- else {expect = "NaN number";}
+ var passed = ( expect == actual ) ? true : false;
+
+ // if both objects are numbers
+ // need to replace w/ IEEE standard for rounding
+ if ( !passed
+ && typeof(actual) == "number"
+ && typeof(expect) == "number"
+ ) {
+ if ( Math.abs(actual-expect) < 0.0000001 ) {
+ passed = true;
+ }
}
- var passed = ( expect == actual ) ? true : false;
-
- // if both objects are numbers, need to replace w/ IEEE standard for rounding
- if ( !passed && typeof(actual) == "number" && typeof(expect) == "number" )
- {
- if ( Math.abs(actual-expect) < 0.0000001 ) {passed = true;}
+ // verify type is the same
+ if ( typeof(expect) != typeof(actual) ) {
+ passed = false;
}
- //verify type is the same
- if ( typeof(expect) != typeof(actual) ) {passed = false;}
-
return passed;
}
-
/*
- * Begin printing functions. These functions use the shell's print function.
-* When running tests in the browser, override these functions with functions
-* that use document.write.
+ * Begin printing functions. These functions use the shell's
+ * print function. When running tests in the browser, these
+ * functions, override these functions with functions that use
+ * document.write.
*/
-function writeTestCaseResult( expect, actual, string )
-{
- var passed = getTestCaseResult(expect, actual );
+
+function writeTestCaseResult( expect, actual, string ) {
+ var passed = getTestCaseResult( expect, actual );
writeFormattedResult( expect, actual, string, passed );
return passed;
}
-
-
-function writeFormattedResult( expect, actual, string, passed )
-{
+function writeFormattedResult( expect, actual, string, passed ) {
var s = string ;
s += ( passed ) ? PASSED : FAILED + expect;
writeLineToLog( s);
return passed;
}
-
-
-function writeLineToLog( string )
-{
+function writeLineToLog( string ) {
print( string );
}
-
-
-function writeHeaderToLog( string )
-{
+function writeHeaderToLog( string ) {
print( string );
}
-/* End of printing functions */
+/* end of print functions */
/*
- * When running in the shell, run the garbage collector after the test has completed.
+ * When running in the shell, run the garbage collector after the
+ * test has completed.
*/
-function stopTest()
-{
+
+function stopTest() {
var gc;
- if ( gc != undefined )
- {
+ if ( gc != undefined ) {
gc();
}
}
-
/*
- * Convenience function for displaying failed test cases.
- * Useful when running tests manually.
-*/
-function getFailedCases()
-{
- for (var i = 0; i < testcases.length; i++ )
- {
- if ( !testcases[i].passed )
- {
- print( testcases[i].description + " = " + testcases[i].actual + " expected: " + testcases[i].expect );
+ * Convenience function for displaying failed test cases. Useful
+ * when running tests manually.
+ *
+ */
+function getFailedCases() {
+ for ( var i = 0; i < testcases.length; i++ ) {
+ if ( ! testcases[i].passed ) {
+ writeLineToLog( testcases[i].description +" = " +testcases[i].actual +" expected: "+ testcases[i].expect );
}
}
}
-
-
- /*
- * Date constants and functions used by tests in Date suite
-*/
-var msPerDay = 86400000;
-var HoursPerDay = 24;
+/*
+ * Date functions used by tests in Date suite
+ *
+ */
+var msPerDay = 86400000;
+var HoursPerDay = 24;
var MinutesPerHour = 60;
var SecondsPerMinute = 60;
-var msPerSecond = 1000;
-var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
-var msPerHour = 3600000; // msPerMinute * MinutesPerHour
-var TZ_DIFF = getTimeZoneDiff();
+var msPerSecond = 1000;
+var msPerMinute = 60000; // msPerSecond * SecondsPerMinute
+var msPerHour = 3600000; // msPerMinute * MinutesPerHour
+var TZ_DIFF = getTimeZoneDiff(); // offset of tester's timezone from UTC
var TZ_ADJUST = TZ_DIFF * msPerHour;
-var TIME_1970 = 0;
-var TIME_2000 = 946684800000;
-var TIME_1900 = -2208988800000;
+var TZ_PST = -8; // offset of Pacific Standard Time from UTC
+var PST_DIFF = TZ_DIFF - TZ_PST; // offset of tester's timezone from PST
+var TIME_1970 = 0;
+var TIME_2000 = 946684800000;
+var TIME_1900 = -2208988800000;
var UTC_29_FEB_2000 = TIME_2000 + 31*msPerDay + 28*msPerDay;
var UTC_1_JAN_2005 = TIME_2000 + TimeInYear(2000) + TimeInYear(2001) +
- TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
+ TimeInYear(2002) + TimeInYear(2003) + TimeInYear(2004);
var now = new Date();
var TIME_NOW = now.valueOf(); //valueOf() is to accurate to the millisecond
- //Date.parse() is accurate only to the second
-
-
+ //Date.parse() is accurate only to the second
/*
* Originally, the test suite used a hard-coded value TZ_DIFF = -8.
* But that was only valid for testers in the Pacific Standard Time Zone!
* We calculate the proper number dynamically for any tester. We just
- * have to be careful to use a date not subject to Daylight Savings Time...
-*/
+ * have to be careful not to use a date subject to Daylight Savings Time...
+ */
function getTimeZoneDiff()
{
return -((new Date(2000, 1, 1)).getTimezoneOffset())/60;
}
-function Day( t)
+/*
+ * Date test "ResultArrays" are hard-coded for Pacific Standard Time.
+ * We must adjust them for the tester's own timezone -
+ */
+function adjustResultArray(ResultArray, msMode)
{
- return ( Math.floor( t/msPerDay ) );
+ // If the tester's system clock is in PST, no need to continue -
+ if (!PST_DIFF) {return;}
+
+ /* The date testcases instantiate Date objects in two different ways:
+ *
+ * millisecond mode: e.g. dt = new Date(10000000);
+ * year-month-day mode: dt = new Date(2000, 5, 1, ...);
+ *
+ * In the first case, the date is measured from Time 0 in Greenwich (i.e. UTC).
+ * In the second case, it is measured with reference to the tester's local timezone.
+ *
+ * In the first case we must correct those values expected for local measurements,
+ * like dt.getHours() etc. No correction is necessary for dt.getUTCHours() etc.
+ *
+ * In the second case, it is exactly the other way around -
+ */
+ if (msMode)
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a UTC date.
+ // Shift to the right by the offset between UTC and the tester.
+ var t = ResultArray[TIME] + TZ_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the local hour, day, etc.
+ ResultArray[HOURS] = HourFromTime(t);
+ ResultArray[DAY] = WeekDay(t);
+ ResultArray[DATE] = DateFromTime(t);
+ ResultArray[MONTH] = MonthFromTime(t);
+ ResultArray[YEAR] = YearFromTime(t);
+ }
+ else
+ {
+ // The hard-coded UTC milliseconds from Time 0 derives from a PST date.
+ // Shift to the left by the offset between PST and the tester.
+ var t = ResultArray[TIME] - PST_DIFF*msPerHour;
+
+ // Use our date arithmetic functions to determine the UTC hour, day, etc.
+ ResultArray[TIME] = t;
+ ResultArray[UTC_HOURS] = HourFromTime(t);
+ ResultArray[UTC_DAY] = WeekDay(t);
+ ResultArray[UTC_DATE] = DateFromTime(t);
+ ResultArray[UTC_MONTH] = MonthFromTime(t);
+ ResultArray[UTC_YEAR] = YearFromTime(t);
+ }
}
-function DaysInYear( y )
-{
- if ( y % 4 != 0 ) {return 365;}
-
- if ( (y%4 == 0) && (y%100 != 0) ) {return 366;}
-
- if ( (y%100 == 0) && (y%400 != 0) ) {return 365;}
-
- if ( (y%400 == 0)){return 366;}
- else {return "ERROR: DaysInYear(" + y + ") case not covered";}
+function Day( t ) {
+ return ( Math.floor(t/msPerDay ) );
}
-
-
-function TimeInYear( y )
-{
+function DaysInYear( y ) {
+ if ( y % 4 != 0 ) {
+ return 365;
+ }
+ if ( (y % 4 == 0) && (y % 100 != 0) ) {
+ return 366;
+ }
+ if ( (y % 100 == 0) && (y % 400 != 0) ) {
+ return 365;
+ }
+ if ( (y % 400 == 0) ){
+ return 366;
+ } else {
+ return "ERROR: DaysInYear(" + y + ") case not covered";
+ }
+}
+function TimeInYear( y ) {
return ( DaysInYear(y) * msPerDay );
}
-
-
-function DayNumber( t )
-{
+function DayNumber( t ) {
return ( Math.floor( t / msPerDay ) );
}
-
-
-function TimeWithinDay( t )
-{
- if ( t < 0 ) {return ( (t%msPerDay) + msPerDay );}
- else {return ( t % msPerDay );}
+function TimeWithinDay( t ) {
+ if ( t < 0 ) {
+ return ( (t % msPerDay) + msPerDay );
+ } else {
+ return ( t % msPerDay );
+ }
}
-
-
-function YearNumber( t )
-{
+function YearNumber( t ) {
}
-
-
-function TimeFromYear( y )
-{
+function TimeFromYear( y ) {
return ( msPerDay * DayFromYear(y) );
}
-
-
-function DayFromYear( y )
-{
- return ( 365*(y-1970) + Math.floor((y-1969)/4) - Math.floor((y-1901)/100)
- + Math.floor((y-1601)/400) );
+function DayFromYear( y ) {
+ return ( 365*(y-1970) +
+ Math.floor((y-1969)/4) -
+ Math.floor((y-1901)/100) +
+ Math.floor((y-1601)/400) );
}
-
-
-function InLeapYear( t )
-{
- if ( DaysInYear(YearFromTime(t)) == 365 ) {return 0;}
-
- if ( DaysInYear(YearFromTime(t)) == 366 ) {return 1;}
- else {return "ERROR: InLeapYear(" + t + ") case not covered";}
+function InLeapYear( t ) {
+ if ( DaysInYear(YearFromTime(t)) == 365 ) {
+ return 0;
+ }
+ if ( DaysInYear(YearFromTime(t)) == 366 ) {
+ return 1;
+ } else {
+ return "ERROR: InLeapYear("+ t + ") case not covered";
+ }
}
-
-
-function YearFromTime( t )
-{
- t =Number( t );
+function YearFromTime( t ) {
+ t = Number( t );
var sign = ( t < 0 ) ? -1 : 1;
var year = ( sign < 0 ) ? 1969 : 1970;
-
- for (var timeToTimeZero = t; ; )
- {
+ for ( var timeToTimeZero = t; ; ) {
// subtract the current year's time from the time that's left.
timeToTimeZero -= sign * TimeInYear(year)
- // if there's less than the current year's worth of time left, then break.
- if ( sign < 0 )
- {
- if ( sign * timeToTimeZero <= 0 ) {break;}
- else {year += sign;}
- }
- else
- {
- if ( sign * timeToTimeZero < 0 ) {break;}
- else {year += sign;}
- }
+ // if there's less than the current year's worth of time left, then break.
+ if ( sign < 0 ) {
+ if ( sign * timeToTimeZero <= 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ } else {
+ if ( sign * timeToTimeZero < 0 ) {
+ break;
+ } else {
+ year += sign;
+ }
+ }
}
-
return ( year );
}
-
-
-function MonthFromTime( t )
-{
+function MonthFromTime( t ) {
+ // i know i could use switch but i'd rather not until it's part of ECMA
var day = DayWithinYear( t );
var leap = InLeapYear(t);
- // I know I could use switch but I'd rather not until it's part of ECMA
- if ( (0 <= day) && (day < 31) ) {return 0;}
- if ( (31 <= day) && (day < (59+leap) )) {return 1;}
- if ( ((59+leap) <= day) && (day < (90+leap) )) {return 2;}
- if ( ((90+leap) <= day) && (day < (120+leap) )) {return 3;}
- if ( ((120+leap) <= day) && (day < (151+leap) )) {return 4;}
- if ( ((151+leap) <= day) && (day < (181+leap) )) {return 5;}
- if ( ((181+leap) <= day) && (day < (212+leap) )) {return 6;}
- if ( ((212+leap) <= day) && (day < (243+leap)) ) {return 7;}
- if ( ((243+leap) <= day) && (day < (273+leap) )) {return 8;}
- if ( ((273+leap) <= day) && (day < (304+leap)) ) {return 9;}
- if ( ((304+leap) <= day) && (day < (334+leap)) ) {return 10;}
- if ( ((334+leap) <= day) && (day < (365+leap)) ) {return 11;}
- else {return "ERROR: MonthFromTime(" + t + ") not known";}
+ if ( (0 <= day) && (day < 31) ) {
+ return 0;
+ }
+ if ( (31 <= day) && (day < (59+leap)) ) {
+ return 1;
+ }
+ if ( ((59+leap) <= day) && (day < (90+leap)) ) {
+ return 2;
+ }
+ if ( ((90+leap) <= day) && (day < (120+leap)) ) {
+ return 3;
+ }
+ if ( ((120+leap) <= day) && (day < (151+leap)) ) {
+ return 4;
+ }
+ if ( ((151+leap) <= day) && (day < (181+leap)) ) {
+ return 5;
+ }
+ if ( ((181+leap) <= day) && (day < (212+leap)) ) {
+ return 6;
+ }
+ if ( ((212+leap) <= day) && (day < (243+leap)) ) {
+ return 7;
+ }
+ if ( ((243+leap) <= day) && (day < (273+leap)) ) {
+ return 8;
+ }
+ if ( ((273+leap) <= day) && (day < (304+leap)) ) {
+ return 9;
+ }
+ if ( ((304+leap) <= day) && (day < (334+leap)) ) {
+ return 10;
+ }
+ if ( ((334+leap) <= day) && (day < (365+leap)) ) {
+ return 11;
+ } else {
+ return "ERROR: MonthFromTime("+t+") not known";
+ }
}
-
-
-function DayWithinYear( t )
-{
- return(Day(t) - DayFromYear(YearFromTime(t)) );
+function DayWithinYear( t ) {
+ return( Day(t) - DayFromYear(YearFromTime(t)));
}
-
-
-function DateFromTime( t )
-{
+function DateFromTime( t ) {
var day = DayWithinYear(t);
var month = MonthFromTime(t);
- if ( month == 0) {return ( day + 1 );}
- if ( month == 1) {return ( day - 30 );}
- if ( month == 2) {return ( day - 58 - InLeapYear(t) );}
- if ( month == 3) {return ( day - 89 - InLeapYear(t));}
- if ( month == 4) {return ( day - 119 - InLeapYear(t));}
- if ( month == 5) {return ( day - 150 - InLeapYear(t));}
- if ( month == 6) {return ( day - 180 - InLeapYear(t));}
- if ( month == 7) {return ( day - 211 - InLeapYear(t));}
- if ( month == 8) {return ( day - 242 - InLeapYear(t));}
- if ( month == 9) {return ( day - 272 - InLeapYear(t));}
- if ( month == 10) {return ( day - 303 - InLeapYear(t));}
- if ( month == 11) {return ( day - 333 - InLeapYear(t));}
- return ("ERROR: DateFromTime("+t+") not known" );
+ if ( month == 0 ) {
+ return ( day + 1 );
+ }
+ if ( month == 1 ) {
+ return ( day - 30 );
+ }
+ if ( month == 2 ) {
+ return ( day - 58 - InLeapYear(t) );
+ }
+ if ( month == 3 ) {
+ return ( day - 89 - InLeapYear(t));
+ }
+ if ( month == 4 ) {
+ return ( day - 119 - InLeapYear(t));
+ }
+ if ( month == 5 ) {
+ return ( day - 150- InLeapYear(t));
+ }
+ if ( month == 6 ) {
+ return ( day - 180- InLeapYear(t));
+ }
+ if ( month == 7 ) {
+ return ( day - 211- InLeapYear(t));
+ }
+ if ( month == 8 ) {
+ return ( day - 242- InLeapYear(t));
+ }
+ if ( month == 9 ) {
+ return ( day - 272- InLeapYear(t));
+ }
+ if ( month == 10 ) {
+ return ( day - 303- InLeapYear(t));
+ }
+ if ( month == 11 ) {
+ return ( day - 333- InLeapYear(t));
+ }
+
+ return ("ERROR: DateFromTime("+t+") not known" );
}
-
-
-function WeekDay( t )
-{
- var weekday = (Day(t)+4)%7;
- return( weekday < 0 ? 7+weekday : weekday );
+function WeekDay( t ) {
+ var weekday = (Day(t)+4) % 7;
+ return( weekday < 0 ? 7 + weekday : weekday );
}
-
// missing daylight savings time adjustment
-
-function HourFromTime( t )
-{
- var h = Math.floor( t / msPerHour )%HoursPerDay;
+function HourFromTime( t ) {
+ var h = Math.floor( t / msPerHour ) % HoursPerDay;
return ( (h<0) ? HoursPerDay + h : h );
}
-
-
-function MinFromTime( t )
-{
- var min = Math.floor( t / msPerMinute )%MinutesPerHour;
- return( (min < 0 ) ? MinutesPerHour + min : min );
+function MinFromTime( t ) {
+ var min = Math.floor( t / msPerMinute ) % MinutesPerHour;
+ return( ( min < 0 ) ? MinutesPerHour + min : min );
}
-
-
-function SecFromTime( t )
-{
- var sec = Math.floor( t / msPerSecond )%SecondsPerMinute;
- return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
+function SecFromTime( t ) {
+ var sec = Math.floor( t / msPerSecond ) % SecondsPerMinute;
+ return ( (sec < 0 ) ? SecondsPerMinute + sec : sec );
}
-
-
-function msFromTime( t )
-{
- var ms = t%msPerSecond;
+function msFromTime( t ) {
+ var ms = t % msPerSecond;
return ( (ms < 0 ) ? msPerSecond + ms : ms );
}
-
-
-function LocalTZA()
-{
+function LocalTZA() {
return ( TZ_DIFF * msPerHour );
}
-
-
-function UTC( t )
-{
- return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
+function UTC( t ) {
+ return ( t - LocalTZA() - DaylightSavingTA(t - LocalTZA()) );
}
-
-function DaylightSavingTA( t )
-{
+function DaylightSavingTA( t ) {
t = t - LocalTZA();
- var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
- var dst_end = GetLastSundayInOctober(t) + 2*msPerHour;
+ var dst_start = GetFirstSundayInApril(t) + 2*msPerHour;
+ var dst_end = GetLastSundayInOctober(t)+ 2*msPerHour;
- if ( t >= dst_start && t < dst_end ) {return msPerHour;}
- else {return 0;}
+ if ( t >= dst_start && t < dst_end ) {
+ return msPerHour;
+ } else {
+ return 0;
+ }
- // Daylight Savings Time starts on the first Sunday in April at 2:00AM in PST.
- // Other time zones will need to override this function.
+ // Daylight Savings Time starts on the first Sunday in April at 2:00AM in
+ // PST. Other time zones will need to override this function.
-print( new Date( UTC(dst_start + LocalTZA())) );
-return UTC(dst_start + LocalTZA());
+ writeLineToLog( new Date( UTC(dst_start + LocalTZA())) );
+
+ return UTC(dst_start + LocalTZA());
}
-
-
-function GetFirstSundayInApril( t )
-{
+function GetFirstSundayInApril( t ) {
var year = YearFromTime(t);
var leap = InLeapYear(t);
- var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) + TimeInMonth(2,leap);
+ var april = TimeFromYear(year) + TimeInMonth(0, leap) + TimeInMonth(1,leap) +
+ TimeInMonth(2,leap);
- for ( var first_sunday = april; WeekDay(first_sunday) > 0; first_sunday += msPerDay )
- {
+ for ( var first_sunday = april; WeekDay(first_sunday) > 0;
+ first_sunday += msPerDay )
+ {
;
}
return first_sunday;
}
-
-
-function GetLastSundayInOctober( t )
-{
+function GetLastSundayInOctober( t ) {
var year = YearFromTime(t);
var leap = InLeapYear(t);
- for ( var oct = TimeFromYear(year), m =0; m < 9; m++ )
- {
+ for ( var oct = TimeFromYear(year), m = 0; m < 9; m++ ) {
oct += TimeInMonth(m, leap);
}
-
- for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0; last_sunday -= msPerDay )
+ for ( var last_sunday = oct + 30*msPerDay; WeekDay(last_sunday) > 0;
+ last_sunday -= msPerDay )
{
;
}
-
return last_sunday;
}
-
-
-function LocalTime( t )
-{
+function LocalTime( t ) {
return ( t + LocalTZA() + DaylightSavingTA(t) );
}
-
-
-function MakeTime( hour, min, sec, ms )
-{
- if ( isNaN(hour) || isNaN(min) || isNaN(sec) || isNaN(ms) ){return Number.NaN;}
+function MakeTime( hour, min, sec, ms ) {
+ if ( isNaN( hour ) || isNaN( min ) || isNaN( sec ) || isNaN( ms ) ) {
+ return Number.NaN;
+ }
hour = ToInteger(hour);
min = ToInteger( min);
sec = ToInteger( sec);
- ms = ToInteger( ms );
+ ms = ToInteger( ms );
- return( (hour*msPerHour) + (min*msPerMinute) + (sec*msPerSecond) + ms );
+ return( (hour*msPerHour) + (min*msPerMinute) +
+ (sec*msPerSecond) + ms );
}
-
-
-function MakeDay( year, month, date )
-{
- if ( isNaN(year) || isNaN(month) || isNaN(date)) {return Number.NaN;}
-
+function MakeDay( year, month, date ) {
+ if ( isNaN(year) || isNaN(month) || isNaN(date) ) {
+ return Number.NaN;
+ }
year = ToInteger(year);
month = ToInteger(month);
date = ToInteger(date );
- var sign = ( year < 1970 ) ? -1 : 1;
- var t = ( year < 1970 ) ? 1 : 0;
- var y = ( year < 1970 ) ? 1969 : 1970;
+ var sign = ( year < 1970 ) ? -1 : 1;
+ var t = ( year < 1970 ) ? 1 : 0;
+ var y = ( year < 1970 ) ? 1969 : 1970;
var result5 = year + Math.floor( month/12 );
- var result6= month%12;
+ var result6 = month % 12;
- if ( year < 1970 )
- {
- for ( y = 1969; y >= year; y += sign )
- {
+ if ( year < 1970 ) {
+ for ( y = 1969; y >= year; y += sign ) {
t += sign * TimeInYear(y);
}
- }
- else
- {
- for ( y = 1970 ; y < year; y += sign )
- {
+ } else {
+ for ( y = 1970 ; y < year; y += sign ) {
t += sign * TimeInYear(y);
}
}
var leap = InLeapYear( t );
- for ( var m = 0; m < month; m++)
- {
+ for ( var m = 0; m < month; m++ ) {
t += TimeInMonth( m, leap );
}
- if ( YearFromTime(t) != result5 ) {return Number.NaN;}
- if ( MonthFromTime(t) != result6 ) {return Number.NaN;}
- if ( DateFromTime(t) != 1 ){return Number.NaN;}
+ if ( YearFromTime(t) != result5 ) {
+ return Number.NaN;
+ }
+ if ( MonthFromTime(t) != result6 ) {
+ return Number.NaN;
+ }
+ if ( DateFromTime(t) != 1 ) {
+ return Number.NaN;
+ }
return ( (Day(t)) + date - 1 );
}
+function TimeInMonth( month, leap ) {
+ // september april june november
+ // jan 0 feb 1 mar 2 apr 3 may 4 june 5 jul 6
+ // aug 7 sep 8 oct 9 nov 10 dec 11
-
-function TimeInMonth( month, leap )
-{
- // Jan 0 Feb 1 Mar 2 Apr 3 May 4 June 5 Jul 6 Aug 7 Sep 8 Oct 9 Nov 10 Dec11
-
- // April June September November
- if ( month == 3 || month == 5 || month == 8 || month == 10 ) {return ( 30*msPerDay );}
+ if ( month == 3 || month == 5 || month == 8 || month == 10 ) {
+ return ( 30*msPerDay );
+ }
// all the rest
- if ( month == 0 || month == 2 || month == 4 || month == 6 ||
- month == 7 || month == 9 || month == 11 ) {return ( 31*msPerDay );}
+ if ( month == 0 || month == 2 || month == 4 || month == 6 ||
+ month == 7 || month == 9 || month == 11 ) {
+ return ( 31*msPerDay );
+ }
- // save February
- return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
+ // save february
+ return ( (leap == 0) ? 28*msPerDay : 29*msPerDay );
}
-
-
-function MakeDate( day, time )
-{
- if (day == Number.POSITIVE_INFINITY ||
+function MakeDate( day, time ) {
+ if ( day == Number.POSITIVE_INFINITY ||
day == Number.NEGATIVE_INFINITY ||
- day == Number.NaN )
- {
+ day == Number.NaN ) {
return Number.NaN;
}
-
if ( time == Number.POSITIVE_INFINITY ||
- time == Number.POSITIVE_INFINITY ||
- day == Number.NaN)
- {
+ time == Number.POSITIVE_INFINITY ||
+ day == Number.NaN) {
return Number.NaN;
}
-
return ( day * msPerDay ) + time;
}
-
-
-function TimeClip( t )
-{
- if ( isNaN( t )) {return ( Number.NaN);}
- if ( Math.abs( t ) > 8.64e15 ) {return ( Number.NaN);}
+function TimeClip( t ) {
+ if ( isNaN( t ) ) {
+ return ( Number.NaN );
+ }
+ if ( Math.abs( t ) > 8.64e15 ) {
+ return ( Number.NaN );
+ }
return ( ToInteger( t ) );
}
-
-
-function ToInteger( t )
-{
+function ToInteger( t ) {
t = Number( t );
- if ( isNaN( t )) {return ( Number.NaN);}
-
- if ( t == 0 || t == -0 ||
- t == Number.POSITIVE_INFINITY ||
- t == Number.NEGATIVE_INFINITY)
- {
+ if ( isNaN( t ) ){
+ return ( Number.NaN );
+ }
+ if ( t == 0 || t == -0 ||
+ t == Number.POSITIVE_INFINITY || t == Number.NEGATIVE_INFINITY ) {
return 0;
}
- var sign = ( t < 0 ) ? -1 : 1;
+ var sign = ( t < 0 ) ? -1 : 1;
return ( sign * Math.floor( Math.abs( t ) ) );
}
-
-
-function Enumerate( o )
-{
+function Enumerate ( o ) {
var p;
- for ( p in o ) {print( p + ": " + o[p] );}
+ for ( p in o ) {
+ writeLineToLog( p +": " + o[p] );
+ }
}
-
/* these functions are useful for running tests manually in Rhino */
-function GetContext()
-{
+function GetContext() {
return Packages.com.netscape.javascript.Context.getCurrentContext();
}
-
-
-function OptLevel( i )
-{
+function OptLevel( i ) {
i = Number(i);
var cx = GetContext();
cx.setOptimizationLevel(i);
}
-
/* end of Rhino functions */
diff --git a/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-002.js b/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-002.js
index ee2f577ae46..46f5449788f 100644
--- a/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-002.js
+++ b/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-002.js
@@ -58,8 +58,15 @@ var expectedvalues = [];
*/
function testDontDelete(F)
{
+ var e;
var orig = F.prototype;
- delete F.prototype;
+ try
+ {
+ delete F.prototype;
+ }
+ catch (e)
+ {
+ }
return F.prototype === orig;
}
diff --git a/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-003.js b/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-003.js
index 0eefe7e2fa0..40faa584e4c 100644
--- a/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-003.js
+++ b/mozilla/js/tests/ecma_3/Exceptions/15.11.7.6-003.js
@@ -58,8 +58,15 @@ var expectedvalues = [];
*/
function testReadOnly(F)
{
+ var e;
var orig = F.prototype;
- F.prototype = new Object();
+ try
+ {
+ F.prototype = new Object();
+ }
+ catch (e)
+ {
+ }
return F.prototype === orig;
}
diff --git a/mozilla/js/tests/ecma_3/Exceptions/binding-001.js b/mozilla/js/tests/ecma_3/Exceptions/binding-001.js
index 29ecde65c32..142a4ef0f7f 100644
--- a/mozilla/js/tests/ecma_3/Exceptions/binding-001.js
+++ b/mozilla/js/tests/ecma_3/Exceptions/binding-001.js
@@ -48,6 +48,7 @@
* print(sum); // should fail with 'sum is not defined' "
*
*/
+
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
@@ -65,7 +66,7 @@ var expect= ERR_REF_YES;
try
{
var f = function sum(){};
- print(sum);
+ writeLineToLog(sum);
}
catch (e)
{
diff --git a/mozilla/js/tests/ecma_3/Exceptions/browser.js b/mozilla/js/tests/ecma_3/Exceptions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Exceptions/shell.js b/mozilla/js/tests/ecma_3/Exceptions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/ExecutionContexts/10.1.3-1.js b/mozilla/js/tests/ecma_3/ExecutionContexts/10.1.3-1.js
index f905b67fabb..07afbb54aba 100644
--- a/mozilla/js/tests/ecma_3/ExecutionContexts/10.1.3-1.js
+++ b/mozilla/js/tests/ecma_3/ExecutionContexts/10.1.3-1.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
diff --git a/mozilla/js/tests/ecma_3/ExecutionContexts/browser.js b/mozilla/js/tests/ecma_3/ExecutionContexts/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/ExecutionContexts/shell.js b/mozilla/js/tests/ecma_3/ExecutionContexts/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Expressions/browser.js b/mozilla/js/tests/ecma_3/Expressions/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Expressions/shell.js b/mozilla/js/tests/ecma_3/Expressions/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/FunExpr/browser.js b/mozilla/js/tests/ecma_3/FunExpr/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/FunExpr/fe-001-n.js b/mozilla/js/tests/ecma_3/FunExpr/fe-001-n.js
index 830688f0b51..dde7b7a9239 100644
--- a/mozilla/js/tests/ecma_3/FunExpr/fe-001-n.js
+++ b/mozilla/js/tests/ecma_3/FunExpr/fe-001-n.js
@@ -38,6 +38,9 @@
*
* ***** END LICENSE BLOCK ***** */
+DESCRIPTION = "Previous statement should have thrown a ReferenceError";
+EXPECTED = "error";
+
test();
function test()
@@ -48,6 +51,6 @@ function test()
var x = function f(){return "inner";}();
var y = f();
reportFailure ("Previous statement should have thrown a ReferenceError");
-
+
exitFunc ("test");
}
diff --git a/mozilla/js/tests/ecma_3/FunExpr/shell.js b/mozilla/js/tests/ecma_3/FunExpr/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Function/browser.js b/mozilla/js/tests/ecma_3/Function/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Function/call-001.js b/mozilla/js/tests/ecma_3/Function/call-001.js
index c2c472cfdc7..477171e15a1 100644
--- a/mozilla/js/tests/ecma_3/Function/call-001.js
+++ b/mozilla/js/tests/ecma_3/Function/call-001.js
@@ -57,6 +57,7 @@
* global object.
*
*/
+
//-----------------------------------------------------------------------------
var UBound = 0;
var bug = '(none)';
diff --git a/mozilla/js/tests/ecma_3/Function/regress-104584.js b/mozilla/js/tests/ecma_3/Function/regress-104584.js
index 9c7d183fb28..55024ef8be5 100644
--- a/mozilla/js/tests/ecma_3/Function/regress-104584.js
+++ b/mozilla/js/tests/ecma_3/Function/regress-104584.js
@@ -44,6 +44,7 @@
* call F,G WITHOUT providing an argument. This caused a crash
* on the second call to obj.toString() or print(obj) below -
*/
+
//-----------------------------------------------------------------------------
var bug = 104584;
var summary = "Testing that we don't crash on this code -";
@@ -68,7 +69,7 @@ function G(obj)
{
if(!obj)
obj = {};
- print(obj);
+ writeLineToLog(obj);
gc();
- print(obj);
+ writeLineToLog(obj);
}
diff --git a/mozilla/js/tests/ecma_3/Function/shell.js b/mozilla/js/tests/ecma_3/Function/shell.js
new file mode 100644
index 00000000000..a76d3066f46
--- /dev/null
+++ b/mozilla/js/tests/ecma_3/Function/shell.js
@@ -0,0 +1,7 @@
+// needed for browser and rhino
+if (typeof gc == 'undefined')
+{
+ gc = function () {};
+}
+
+
\ No newline at end of file
diff --git a/mozilla/js/tests/ecma_3/Number/browser.js b/mozilla/js/tests/ecma_3/Number/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Number/shell.js b/mozilla/js/tests/ecma_3/Number/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/NumberFormatting/browser.js b/mozilla/js/tests/ecma_3/NumberFormatting/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/NumberFormatting/shell.js b/mozilla/js/tests/ecma_3/NumberFormatting/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Object/browser.js b/mozilla/js/tests/ecma_3/Object/browser.js
new file mode 100644
index 00000000000..0e57d1fcd06
--- /dev/null
+++ b/mozilla/js/tests/ecma_3/Object/browser.js
@@ -0,0 +1,7 @@
+var GLOBAL = 'Window';
+
+function isObject(obj)
+{
+ return obj instanceof Object || obj == window;
+}
+
diff --git a/mozilla/js/tests/ecma_3/Object/class-001.js b/mozilla/js/tests/ecma_3/Object/class-001.js
index a4be51dccaf..786e453ef68 100644
--- a/mozilla/js/tests/ecma_3/Object/class-001.js
+++ b/mozilla/js/tests/ecma_3/Object/class-001.js
@@ -55,7 +55,7 @@ var expect= ''; var expectedvalue = [ ];
status = 'the global object';
actual = getJSClass(this);
-expect = 'global';
+expect = GLOBAL;
addThis();
status = 'new Object()';
diff --git a/mozilla/js/tests/ecma_3/Object/shell.js b/mozilla/js/tests/ecma_3/Object/shell.js
index ed33b241713..a858b5763fa 100644
--- a/mozilla/js/tests/ecma_3/Object/shell.js
+++ b/mozilla/js/tests/ecma_3/Object/shell.js
@@ -55,7 +55,7 @@
var cnNoObject = 'Unexpected Error!!! Parameter to this function must be an object';
var cnNoClass = 'Unexpected Error!!! Cannot find Class property';
var cnObjectToString = Object.prototype.toString;
-
+var GLOBAL = 'global';
// checks that it's safe to call findType()
function getJSType(obj)
@@ -97,3 +97,4 @@ function isObject(obj)
{
return obj instanceof Object;
}
+
diff --git a/mozilla/js/tests/ecma_3/Operators/browser.js b/mozilla/js/tests/ecma_3/Operators/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Operators/shell.js b/mozilla/js/tests/ecma_3/Operators/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/README b/mozilla/js/tests/ecma_3/README
new file mode 100755
index 00000000000..eebd421c2ed
--- /dev/null
+++ b/mozilla/js/tests/ecma_3/README
@@ -0,0 +1 @@
+ECMA 262 Edition 3
diff --git a/mozilla/js/tests/ecma_3/RegExp/15.10.4.1-5-n.js b/mozilla/js/tests/ecma_3/RegExp/15.10.4.1-5-n.js
index abcf6d02ca0..637341f9c7e 100644
--- a/mozilla/js/tests/ecma_3/RegExp/15.10.4.1-5-n.js
+++ b/mozilla/js/tests/ecma_3/RegExp/15.10.4.1-5-n.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -33,7 +34,8 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
- * ***** END LICENSE BLOCK *****
+ * ***** END LICENSE BLOCK ***** */
+/*
*
* Date: 26 November 2000
*
@@ -60,6 +62,7 @@
* This should throw an exception ... we test for this.
*
*/
+
//-------------------------------------------------------------------------------------------------
var bug = '61266';
var summary = 'Negative test: Passing (RegExp object, flag) to RegExp() constructor';
@@ -87,6 +90,9 @@ flags[1] = 'g';
flags[2] = 'm';
+DESCRIPTION = "Negative test: Passing (RegExp object, flag) to RegExp() constructor"
+EXPECTED = "error";
+
//-------------------------------------------------------------------------------------------------
test();
@@ -95,37 +101,37 @@ test();
function test()
{
- enterFunc ('test');
- printBugNumber (bug);
- printStatus (summary);
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
- for (i in patterns)
- {
- s = patterns[i];
-
- for (j in flags)
+ for (i in patterns)
{
- f = flags[j];
- printStatus(getStatus(s, f));
- obj1 = new RegExp(s, f);
- obj2 = new RegExp(obj1, f); // this should cause an exception
+ s = patterns[i];
- // WE SHOULD NEVER REACH THIS POINT -
- reportFailure(cnFAILURE);
+ for (j in flags)
+ {
+ f = flags[j];
+ printStatus(getStatus(s, f));
+ obj1 = new RegExp(s, f);
+ obj2 = new RegExp(obj1, f); // this should cause an exception
+
+ // WE SHOULD NEVER REACH THIS POINT -
+ reportFailure(cnFAILURE);
+ }
}
- }
-
- exitFunc ('test');
+
+ exitFunc ('test');
}
function getStatus(regexp, flag)
{
- return (statprefix + quote(regexp) + statsuffix + flag);
+ return (statprefix + quote(regexp) + statsuffix + flag);
}
function quote(text)
{
- return (singlequote + text + singlequote);
-}
\ No newline at end of file
+ return (singlequote + text + singlequote);
+}
diff --git a/mozilla/js/tests/ecma_3/RegExp/browser.js b/mozilla/js/tests/ecma_3/RegExp/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/RegExp/regress-228087.js b/mozilla/js/tests/ecma_3/RegExp/regress-228087.js
index fafe591c7bf..16a6d600017 100644
--- a/mozilla/js/tests/ecma_3/RegExp/regress-228087.js
+++ b/mozilla/js/tests/ecma_3/RegExp/regress-228087.js
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -60,124 +61,264 @@ var actualmatch = '';
var actualmatches = new Array();
var expectedmatch = '';
var expectedmatches = new Array();
+var e;
string = 'foo {1} foo {2} foo';
- // try an example with the braces escaped
- status = inSection(1);
- pattern = /\{1.*\}/g;
- actualmatch = string.match(pattern);
- expectedmatch = Array('{1} foo {2}');
- addThis();
+// try an example with the braces escaped
+status = inSection(1);
+try
+{
+ pattern = new RegExp('\{1.*\}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1} foo {2}');
+addThis();
- // just like Section 1, without the braces being escaped
- status = inSection(2);
- pattern = /{1.*}/g;
- actualmatch = string.match(pattern);
- expectedmatch = Array('{1} foo {2}');
- addThis();
+// just like Section 1, without the braces being escaped
+status = inSection(2);
+try
+{
+ pattern = new RegExp('{1.*}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1} foo {2}');
+addThis();
- // try an example with the braces escaped
- status = inSection(3);
- pattern = /\{1[.!\}]*\}/g;
- actualmatch = string.match(pattern);
- expectedmatch = Array('{1}');
- addThis();
+// try an example with the braces escaped
+status = inSection(3);
+try
+{
+ pattern = new RegExp('\{1[.!\}]*\}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1}');
+addThis();
- // just like Section 3, without the braces being escaped
- status = inSection(4);
- pattern = /{1[.!}]*}/g;
- actualmatch = string.match(pattern);
- expectedmatch = Array('{1}');
- addThis();
+// just like Section 3, without the braces being escaped
+status = inSection(4);
+try
+{
+ pattern = new RegExp('{1[.!}]*}', 'g');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('{1}');
+addThis();
string = 'abccccc{3 }c{ 3}c{3, }c{3 ,}c{3 ,4}c{3, 4}c{3,4 }de';
- // use braces in a normal quantifier construct
- status = inSection(5);
- pattern = /c{3}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('ccc');
- addThis();
+// use braces in a normal quantifier construct
+status = inSection(5);
+try
+{
+ pattern = new RegExp('c{3}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('ccc');
+addThis();
- // now disrupt the quantifer - the braces should now be interpreted literally
- status = inSection(6);
- pattern = /c{3 }/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 }');
- addThis();
+// now disrupt the quantifer - the braces should now be interpreted literally
+status = inSection(6);
+try
+{
+ pattern = new RegExp('c{3 }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
- status = inSection(7);
- pattern = /c{3.}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 }');
- addThis();
+status = inSection(7);
+try
+{
+ pattern = new RegExp('c{3.}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
- status = inSection(8);
- pattern = /c{3\s}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 }');
- addThis();
+status = inSection(8);
+try
+{
+ // need to escape the \ in \s since
+ // this has been converted to a constructor call
+ // instead of a literal regexp
+ pattern = new RegExp('c{3\\s}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
- status = inSection(9);
- pattern = /c{3[ ]}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 }');
- addThis();
+status = inSection(9);
+try
+{
+ pattern = new RegExp('c{3[ ]}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 }');
+addThis();
- status = inSection(10);
- pattern = /c{ 3}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{ 3}');
- addThis();
+status = inSection(10);
+try
+{
+ pattern = new RegExp('c{ 3}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{ 3}');
+addThis();
- // using braces in a normal quantifier construct again
- status = inSection(11);
- pattern = /c{3,}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('ccccc');
- addThis();
+// using braces in a normal quantifier construct again
+status = inSection(11);
+try
+{
+ pattern = new RegExp('c{3,}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('ccccc');
+addThis();
- // now disrupt it - the braces should now be interpreted literally
- status = inSection(12);
- pattern = /c{3, }/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3, }');
- addThis();
+// now disrupt it - the braces should now be interpreted literally
+status = inSection(12);
+try
+{
+ pattern = new RegExp('c{3, }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3, }');
+addThis();
- status = inSection(13);
- pattern = /c{3 ,}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 ,}');
- addThis();
+status = inSection(13);
+try
+{
+ pattern = new RegExp('c{3 ,}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 ,}');
+addThis();
- // using braces in a normal quantifier construct again
- status = inSection(14);
- pattern = /c{3,4}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('cccc');
- addThis();
+// using braces in a normal quantifier construct again
+status = inSection(14);
+try
+{
+ pattern = new RegExp('c{3,4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('cccc');
+addThis();
- // now disrupt it - the braces should now be interpreted literally
- status = inSection(15);
- pattern = /c{3 ,4}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3 ,4}');
- addThis();
+// now disrupt it - the braces should now be interpreted literally
+status = inSection(15);
+try
+{
+ pattern = new RegExp('c{3 ,4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3 ,4}');
+addThis();
- status = inSection(16);
- pattern = /c{3, 4}/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3, 4}');
- addThis();
+status = inSection(16);
+try
+{
+ pattern = new RegExp('c{3, 4}');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3, 4}');
+addThis();
- status = inSection(17);
- pattern = /c{3,4 }/;
- actualmatch = string.match(pattern);
- expectedmatch = Array('c{3,4 }');
- addThis();
+status = inSection(17);
+try
+{
+ pattern = new RegExp('c{3,4 }');
+ actualmatch = string.match(pattern);
+}
+catch (e)
+{
+ pattern = 'error';
+ actualmatch = '';
+}
+expectedmatch = Array('c{3,4 }');
+addThis();
@@ -190,20 +331,20 @@ test();
function addThis()
{
- statusmessages[i] = status;
- patterns[i] = pattern;
- strings[i] = string;
- actualmatches[i] = actualmatch;
- expectedmatches[i] = expectedmatch;
- i++;
+ statusmessages[i] = status;
+ patterns[i] = pattern;
+ strings[i] = string;
+ actualmatches[i] = actualmatch;
+ expectedmatches[i] = expectedmatch;
+ i++;
}
function test()
{
- enterFunc ('test');
- printBugNumber (bug);
- printStatus (summary);
- testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
- exitFunc ('test');
+ enterFunc ('test');
+ printBugNumber (bug);
+ printStatus (summary);
+ testRegExp(statusmessages, patterns, strings, actualmatches, expectedmatches);
+ exitFunc ('test');
}
diff --git a/mozilla/js/tests/ecma_3/RegExp/shell.js b/mozilla/js/tests/ecma_3/RegExp/shell.js
index 3d47bf89bbd..efdc59a14de 100644
--- a/mozilla/js/tests/ecma_3/RegExp/shell.js
+++ b/mozilla/js/tests/ecma_3/RegExp/shell.js
@@ -80,44 +80,53 @@ function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
expectedmatch=expectedmatches[i];
state = getState(status, pattern, string);
+ description = status;
if(actualmatch)
{
+ actual = formatArray(actualmatch);
if(expectedmatch)
{
// expectedmatch and actualmatch are arrays -
lExpect = expectedmatch.length;
lActual = actualmatch.length;
+ expected = formatArray(expectedmatch);
+
if (lActual != lExpect)
{
reportFailure(
state + ERR_LENGTH +
- MSG_EXPECT + formatArray(expectedmatch) +
- MSG_ACTUAL + formatArray(actualmatch) +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
CHAR_NL
);
continue;
}
// OK, the arrays have same length -
- if (formatArray(expectedmatch) != formatArray(actualmatch))
+ if (expected != actual)
{
reportFailure(
state + ERR_MATCH +
- MSG_EXPECT + formatArray(expectedmatch) +
- MSG_ACTUAL + formatArray(actualmatch) +
+ MSG_EXPECT + expected +
+ MSG_ACTUAL + actual +
CHAR_NL
);
}
+ else
+ {
+ reportCompare(expected, actual, state)
+ }
}
else //expectedmatch is null - that is, we did not expect a match -
{
+ expected = expectedmatch;
reportFailure(
state + ERR_UNEXP_MATCH +
MSG_EXPECT + expectedmatch +
- MSG_ACTUAL + formatArray(actualmatch) +
+ MSG_ACTUAL + actual +
CHAR_NL
);
}
@@ -127,9 +136,10 @@ function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
{
if (expectedmatch)
{
+ actual = actualmatch;
reportFailure(
state + ERR_NO_MATCH +
- MSG_EXPECT + formatArray(expectedmatch) +
+ MSG_EXPECT + expectedmatch +
MSG_ACTUAL + actualmatch +
CHAR_NL
);
@@ -137,6 +147,8 @@ function testRegExp(statuses, patterns, strings, actualmatches, expectedmatches)
else // we did not expect a match
{
// Being ultra-cautious. Presumably expectedmatch===actualmatch===null
+ expected = expectedmatch;
+ actual = actualmatch;
reportCompare (expectedmatch, actualmatch, state);
}
}
@@ -246,3 +258,4 @@ function singleQuote(text)
{
return CHAR_QT + text + CHAR_QT;
}
+
diff --git a/mozilla/js/tests/ecma_3/Statements/browser.js b/mozilla/js/tests/ecma_3/Statements/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Statements/regress-121744.js b/mozilla/js/tests/ecma_3/Statements/regress-121744.js
index cb1f166a602..ec1287aec87 100644
--- a/mozilla/js/tests/ecma_3/Statements/regress-121744.js
+++ b/mozilla/js/tests/ecma_3/Statements/regress-121744.js
@@ -94,7 +94,7 @@ try
{
for (var i in undefined)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -118,7 +118,7 @@ try
{
for (var i in null)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -145,7 +145,7 @@ try
{
for (var i in this.ZZZ)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -170,7 +170,7 @@ try
{
for (var i in 'bbb'.match(/aaa/))
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
diff --git a/mozilla/js/tests/ecma_3/Statements/regress-131348.js b/mozilla/js/tests/ecma_3/Statements/regress-131348.js
index 24c39fa20ee..4e6ee8fc7da 100644
--- a/mozilla/js/tests/ecma_3/Statements/regress-131348.js
+++ b/mozilla/js/tests/ecma_3/Statements/regress-131348.js
@@ -75,7 +75,7 @@ try
{
for (var i in undefined)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -93,7 +93,7 @@ try
{
for (var i in null)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -117,7 +117,7 @@ try
{
for (var i in this.ZZZ)
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
@@ -139,7 +139,7 @@ try
{
for (var i in 'bbb'.match(/aaa/))
{
- print(i);
+ writeLineToLog(i);
}
}
catch(e)
diff --git a/mozilla/js/tests/ecma_3/Statements/shell.js b/mozilla/js/tests/ecma_3/Statements/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/String/browser.js b/mozilla/js/tests/ecma_3/String/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/String/shell.js b/mozilla/js/tests/ecma_3/String/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Unicode/browser.js b/mozilla/js/tests/ecma_3/Unicode/browser.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Unicode/shell.js b/mozilla/js/tests/ecma_3/Unicode/shell.js
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/mozilla/js/tests/ecma_3/Unicode/uc-002-n.js b/mozilla/js/tests/ecma_3/Unicode/uc-002-n.js
index 695a3185f2d..6b3b19afd4f 100644
--- a/mozilla/js/tests/ecma_3/Unicode/uc-002-n.js
+++ b/mozilla/js/tests/ecma_3/Unicode/uc-002-n.js
@@ -38,17 +38,16 @@
*
* ***** END LICENSE BLOCK ***** */
-test();
+DESCRIPTION = "Non-character escapes in identifiers negative test.";
+EXPECTED = "error";
-function test()
-{
- enterFunc ("test");
+enterFunc ("test");
- printStatus ("Non-character escapes in identifiers negative test.");
- printBugNumber (23607);
+printStatus ("Non-character escapes in identifiers negative test.");
+printBugNumber (23607);
- reportCompare ("error", eval("\u0020 = 5"),
- "Non-character escapes in identifiers negative test.");
+eval("\u0020 = 5");
+reportFailure("Previous statement should have thrown an error.");
+
+exitFunc ("test");
- exitFunc ("test");
-}
diff --git a/mozilla/js/tests/ecma_3/browser.js b/mozilla/js/tests/ecma_3/browser.js
new file mode 100755
index 00000000000..cc01d79d880
--- /dev/null
+++ b/mozilla/js/tests/ecma_3/browser.js
@@ -0,0 +1,118 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/*
+ * 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):
+ */
+
+/*
+ * JavaScript test library shared functions file for running the tests
+ * in the browser. Overrides the shell's print function with document.write
+ * and make everything HTML pretty.
+ *
+ * To run the tests in the browser, use the mkhtml.pl script to generate
+ * html pages that include the shell.js, browser.js (this file), and the
+ * test js file in script tags.
+ *
+ * The source of the page that is generated should look something like this:
+ *
+ *
+ *
+ */
+
+function writeLineToLog( string ) {
+ document.write( string + "
\n");
+}
+
+var testcases = new Array();
+var tc = testcases.length;
+var bug = '';
+var summary = '';
+var description = '';
+var expected = '';
+var actual = '';
+var msg = '';
+
+function TestCase(n, d, e, a)
+{
+ this.name = n;
+ this.description = d;
+ this.expect = e;
+ this.actual = a;
+ this.passed = ( e == a );
+ this.reason = '';
+ this.bugnumber = typeof(bug) != 'undefined' ? bug : '';
+ testcases[tc++] = this;
+}
+
+var gInReportCompare = false;
+
+var _reportCompare = reportCompare;
+
+reportCompare = function(expected, actual, description)
+{
+ gInReportCompare = true;
+
+ var testcase = new TestCase(gTestName, description, expected, actual);
+ testcase.passed = _reportCompare(expected, actual, description);
+
+ gInReportCompare = false;
+};
+
+var _reportFailure = reportFailure;
+reportFailure = function (msg, page, line)
+{
+ var testcase;
+
+ if (gInReportCompare)
+ {
+ testcase = testcases[tc - 1];
+ testcase.passed = false;
+ }
+ else
+ {
+ if (typeof(summary) == "undefined")
+ {
+ summary = "unknown";
+ }
+ if (typeof(expect) == "undefined")
+ {
+ expect = "unknown";
+ }
+ testcase = new TestCase(gTestName, summary, expect, "error");
+ }
+
+ testcase.reason += msg;
+
+ if (typeof(page) != 'undefined')
+ {
+ testcase.reason += ' Page: ' + page;
+ }
+ if (typeof(line) != 'undefined')
+ {
+ testcase.reason += ' Line: ' + line;
+ }
+ _reportFailure(msg);
+
+};
+
+function quit()
+{
+}
+
+window.onerror = reportFailure;
diff --git a/mozilla/js/tests/ecma_3/shell.js b/mozilla/js/tests/ecma_3/shell.js
index 45835da6ab6..38fd5372272 100644
--- a/mozilla/js/tests/ecma_3/shell.js
+++ b/mozilla/js/tests/ecma_3/shell.js
@@ -46,6 +46,9 @@ var SECT_SUFFIX = ' of test -';
var VERBOSE = false;
var callStack = new Array();
+function writeLineToLog( string ) {
+ print( string );
+}
/*
* The test driver searches for such a phrase in the test output.
* If such phrase exists, it will set n as the expected exit code.
@@ -53,7 +56,7 @@ var callStack = new Array();
function expectExitCode(n)
{
- print('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
+ writeLineToLog('--- NOTE: IN THIS TESTCASE, WE EXPECT EXIT CODE ' + n + ' ---');
}
@@ -72,7 +75,7 @@ function inSection(x)
*/
function inRhino()
{
- return (typeof defineClass == "function");
+ return (typeof defineClass == "function");
}
/*
@@ -86,7 +89,7 @@ function reportFailure (msg)
var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
for (var i=0; i
Import Test List
-
+
diff --git a/mozilla/js/tests/importList.js b/mozilla/js/tests/importList.js
new file mode 100644
index 00000000000..c8395a0ecb8
--- /dev/null
+++ b/mozilla/js/tests/importList.js
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+function doImport()
+{
+ var lines =
+ document.forms["foo"].elements["testList"].value.split(/\r?\n/);
+ var suites = window.opener.suites;
+ var elems = window.opener.document.forms["testCases"].elements;
+
+ if (document.forms["foo"].elements["clear_all"].checked)
+ window.opener._selectNone();
+
+ for (var l in lines)
+ {
+ if (!lines[l])
+ {
+ continue;
+ }
+
+ if (lines[l].search(/^\s$|\s*\#/) == -1)
+ {
+ var ary = lines[l].match (/(.*)\/(.*)\/(.*)/);
+
+ if (!ary)
+ {
+ if (!confirm ("Line " + l + " '" +
+ lines[l] + "' is confusing, " +
+ "continue with import?"))
+ {
+ return;
+ }
+ }
+
+ if (suites[ary[1]] &&
+ suites[ary[1]].testDirs[ary[2]] &&
+ suites[ary[1]].testDirs[ary[2]].tests[ary[3]])
+ {
+ var radioname = suites[ary[1]].testDirs[ary[2]].tests[ary[3]].id;
+ var radio = elems[radioname];
+ if (!radio.checked)
+ {
+ radio.checked = true;
+ window.opener.onRadioClick(radio);
+ }
+ }
+ }
+ }
+
+ setTimeout('window.close();', 200);
+
+}
diff --git a/mozilla/js/tests/js-test-driver-begin.js b/mozilla/js/tests/js-test-driver-begin.js
new file mode 100644
index 00000000000..5adc7c481bb
--- /dev/null
+++ b/mozilla/js/tests/js-test-driver-begin.js
@@ -0,0 +1,99 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+var gVersion = 150;
+var gTestName = '';
+
+function init()
+{
+ if (document.location.search.indexOf('?') != 0)
+ {
+ // not called with a query string
+ return;
+ }
+
+ var re = /test=([^;]+);language=(language|type);([a-zA-Z0-9.=;\/]+)/;
+ var matches = re.exec(document.location.search);
+
+ // testpath http://machine/path-to-suite/sub-suite/test.js
+ var testpath = matches[1];
+ var attribute = matches[2];
+ var value = matches[3];
+
+ var ise4x = /e4x\//.test(testpath);
+
+ if (value.indexOf('1.1') != -1)
+ {
+ gVersion = 110;
+ }
+ else if (value.indexOf('1.2') != -1)
+ {
+ gVersion = 120;
+ }
+ else if (value.indexOf('1.3') != -1)
+ {
+ gVersion = 130;
+ }
+ else if (value.indexOf('1.4') != -1)
+ {
+ gVersion = 140;
+ }
+ else if(value.indexOf('1.5') != -1)
+ {
+ gVersion = 150;
+ }
+
+ var testpathparts = testpath.split(/\//);
+
+ if (testpathparts.length < 3)
+ {
+ // must have at least suitepath/subsuite/testcase.js
+ return;
+ }
+ var suitepath = testpathparts.slice(0,testpathparts.length-2).join('/');
+ var subsuite = testpathparts[testpathparts.length - 2];
+ var test = testpathparts[testpathparts.length - 1];
+
+ gTestName = test;
+
+ outputscripttag(suitepath + '/shell.js', attribute, value, ise4x);
+ outputscripttag(suitepath + '/browser.js', attribute, value, ise4x);
+ outputscripttag(suitepath + '/' + subsuite + '/shell.js', attribute, value, ise4x);
+ outputscripttag(suitepath + '/' + subsuite + '/browser.js', attribute, value, ise4x);
+ outputscripttag(suitepath + '/' + subsuite + '/' + test, attribute, value, ise4x);
+
+ document.write('' + suitepath + '/' + subsuite + '/' + test + '<\/title>');
+ return;
+}
+
+function outputscripttag(src, attribute, value, ise4x)
+{
+ if (!src)
+ {
+ return;
+ }
+
+ var s = '
+
+
+
+
+