diff options
Diffstat (limited to 'js/src/tests/ecma/LexicalConventions')
77 files changed, 3756 insertions, 0 deletions
diff --git a/js/src/tests/ecma/LexicalConventions/7.1-1.js b/js/src/tests/ecma/LexicalConventions/7.1-1.js new file mode 100644 index 000000000..202ffec02 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.1-1.js @@ -0,0 +1,48 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <TAB> \t + \u000B veritical tab <VT> \v + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + +var SECTION = "7.1-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "White Space"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +// 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') ); + +// use whitespace between tokens object name, dot operator, and object property + +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") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.1-2.js b/js/src/tests/ecma/LexicalConventions/7.1-2.js new file mode 100644 index 000000000..2e22212fb --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.1-2.js @@ -0,0 +1,39 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <TAB> \t + \u000B veritical tab <VT> ?? + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + +var SECTION = "7.1-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "White Space"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +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') ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.1-3.js b/js/src/tests/ecma/LexicalConventions/7.1-3.js new file mode 100644 index 000000000..1f4d253ba --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.1-3.js @@ -0,0 +1,55 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <TAB> \t + \u000B veritical tab <VT> ?? + \U000C form feed <FF> \f + \u0020 space <SP> " " + + Author: christine@netscape.com + Date: 11 september 1997 +*/ + +var SECTION = "7.1-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "White Space"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +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') ); + +// +<white space>+ should be interpreted as the unary + operator twice, not as a post or prefix increment operator + +new TestCase( SECTION, + "var VAR = 12345; + + VAR", + 12345, + eval("var VAR = 12345; + + VAR") ); + +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") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.2-1.js b/js/src/tests/ecma/LexicalConventions/7.2-1.js new file mode 100644 index 000000000..f17143af5 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-1.js @@ -0,0 +1,39 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + Author: christine@netscape.com + Date: 11 september 1997 +*/ +var SECTION = "7.2-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + + +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") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.2-2-n.js b/js/src/tests/ecma/LexicalConventions/7.2-2-n.js new file mode 100644 index 000000000..7f3bb8676 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-2-n.js @@ -0,0 +1,40 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + 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 +*/ +var SECTION = "7.2-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "\r\r\r\nb"; +EXPECTED = "error" + + new TestCase( SECTION, DESCRIPTION, "error", eval("\r\r\r\nb")); + +test(); + diff --git a/js/src/tests/ecma/LexicalConventions/7.2-3-n.js b/js/src/tests/ecma/LexicalConventions/7.2-3-n.js new file mode 100644 index 000000000..0d78e549c --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-3-n.js @@ -0,0 +1,40 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + 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 +*/ +var SECTION = "7.2-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + + +DESCRIPTION = "\r\nb"; +EXPECTED = "error" + + new TestCase( SECTION, "<cr>a", "error", eval("\r\nb")); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.2-4-n.js b/js/src/tests/ecma/LexicalConventions/7.2-4-n.js new file mode 100644 index 000000000..36a55d288 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-4-n.js @@ -0,0 +1,39 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + 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 +*/ +var SECTION = "7.2-6"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "\nb"; +EXPECTED = "error"; + +new TestCase( SECTION, "\nb", "error", eval("\nb")); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.2-5-n.js b/js/src/tests/ecma/LexicalConventions/7.2-5-n.js new file mode 100644 index 000000000..44fd905b1 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-5-n.js @@ -0,0 +1,38 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + 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 +*/ +var SECTION = "7.2-5"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = + EXPECTED = "error"; + +new TestCase( SECTION, "\rb", "error", eval("\rb")); +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.2-6.js b/js/src/tests/ecma/LexicalConventions/7.2-6.js new file mode 100644 index 000000000..030a6a6ba --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.2-6.js @@ -0,0 +1,34 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 <LF> \n + \u000D carriage return <CR> \r + + Author: christine@netscape.com + Date: 11 september 1997 +*/ +var SECTION = "7.2-6"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Line Terminators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +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") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-1.js b/js/src/tests/ecma/LexicalConventions/7.3-1.js new file mode 100644 index 000000000..0b080f664 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-1.js @@ -0,0 +1,57 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-1.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase; + +testcase = new TestCase( SECTION, + "a comment with a line terminator string, and text following", + "pass", + "pass"); + +// "\u000A" testcase.actual = "fail"; + + +testcase = new TestCase( SECTION, + "// test \\n testcase.actual = \"pass\"", + "pass", + "" ); + +var x = "// test \n testcase.actual = 'pass'"; + +testcase.actual = eval(x); + +test(); + +// XXX bc replace test() +function test() { + for ( gTc=0; gTc < gTestcases.length; gTc++ ) { + gTestcases[gTc].passed = writeTestCaseResult( + gTestcases[gTc].expect, + gTestcases[gTc].actual, + gTestcases[gTc].description +": "+ + gTestcases[gTc].actual ); + + gTestcases[gTc].reason += ( gTestcases[gTc].passed ) ? "" : " ignored chars after line terminator of single-line comment"; + } + return ( gTestcases ); +} diff --git a/js/src/tests/ecma/LexicalConventions/7.3-10.js b/js/src/tests/ecma/LexicalConventions/7.3-10.js new file mode 100644 index 000000000..494f8da06 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-10.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-10.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-10"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + +/*//*/testcase.actual="pass"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-11.js b/js/src/tests/ecma/LexicalConventions/7.3-11.js new file mode 100644 index 000000000..7ac777fba --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-11.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-11.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-11"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + + +var testcase = new TestCase( SECTION, + "code following multiline comment", + "pass", + "pass"); + +////testcase.actual="fail"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-12.js b/js/src/tests/ecma/LexicalConventions/7.3-12.js new file mode 100644 index 000000000..8700d26a2 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-12.js @@ -0,0 +1,30 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-12.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-12"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "code following multiline comment", + "pass", + "pass"); +/*testcase.actual="fail";**/ + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-13-n.js b/js/src/tests/ecma/LexicalConventions/7.3-13-n.js new file mode 100644 index 000000000..ce26b91ee --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-13-n.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-13-n.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-13-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "nested comment"; +EXPECTED = "error"; + +var testcase = new TestCase( SECTION, + "nested comment", + "error", + eval("/*/*\"fail\";*/*/")); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-2.js b/js/src/tests/ecma/LexicalConventions/7.3-2.js new file mode 100644 index 000000000..0b42cb849 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-2.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-2.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "a comment with a carriage return, and text following", + "pass", + "pass"); + +// "\u000D" testcase.actual = "fail"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-3.js b/js/src/tests/ecma/LexicalConventions/7.3-3.js new file mode 100644 index 000000000..c4e629aae --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-3.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-3.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "source text directly following a single-line comment", + "pass", + "fail"); +// a comment string +testcase.actual = "pass"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-4.js b/js/src/tests/ecma/LexicalConventions/7.3-4.js new file mode 100644 index 000000000..11a7bac8f --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-4.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-4.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "multiline comment ", + "pass", + "pass"); + +/*testcase.actual = "fail";*/ + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-5.js b/js/src/tests/ecma/LexicalConventions/7.3-5.js new file mode 100644 index 000000000..bb3b7876b --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-5.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-5.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-5"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "a comment with a carriage return, and text following", + "pass", + "pass"); + +// "\u000A" testcase.actual = "fail"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-6.js b/js/src/tests/ecma/LexicalConventions/7.3-6.js new file mode 100644 index 000000000..59e4e7cc4 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-6.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-6.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-6"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); +var testcase = new TestCase( SECTION, + "comment with multiple asterisks", + "pass", + "fail"); + +/* +***/testcase.actual="pass"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-7.js b/js/src/tests/ecma/LexicalConventions/7.3-7.js new file mode 100644 index 000000000..f82ac011b --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-7.js @@ -0,0 +1,32 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-7.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-7"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "single line comment following multiline comment", + "pass", + "pass"); + +/* +***///testcase.actual="fail"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-8.js b/js/src/tests/ecma/LexicalConventions/7.3-8.js new file mode 100644 index 000000000..757968646 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-8.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-7.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-8"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + +/**/testcase.actual="pass"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.3-9.js b/js/src/tests/ecma/LexicalConventions/7.3-9.js new file mode 100644 index 000000000..e91047d7e --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.3-9.js @@ -0,0 +1,31 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.3-9.js + ECMA Section: 7.3 Comments + Description: + + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.3-9"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Comments"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var testcase = new TestCase( SECTION, + "code following multiline comment", + "pass", + "fail"); + +/*/*/testcase.actual="pass"; + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.1-1-n.js b/js/src/tests/ecma/LexicalConventions/7.4.1-1-n.js new file mode 100644 index 000000000..f5044b854 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.1-1-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.4.1-1-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-1-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var null = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var null = true", "error", eval("var null = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.1-2-n.js b/js/src/tests/ecma/LexicalConventions/7.4.1-2-n.js new file mode 100644 index 000000000..8012fbfe2 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.1-2-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.4.1-2.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-2-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var true = false"; +EXPECTED = "error"; + +new TestCase( SECTION, "var true = false", "error", eval("var true = false") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.1-3-n.js b/js/src/tests/ecma/LexicalConventions/7.4.1-3-n.js new file mode 100644 index 000000000..2060370f1 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.1-3-n.js @@ -0,0 +1,35 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.4.1-3-n.js + ECMA Section: 7.4.1 + + Description: + + Reserved words cannot be used as identifiers. + + ReservedWord :: + Keyword + FutureReservedWord + NullLiteral + BooleanLiteral + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-3-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +DESCRIPTION = "var false = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var false = true", "error", eval("var false = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-1-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-1-n.js new file mode 100644 index 000000000..cf9ae9c6c --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-1-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-1-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var break = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var break = true", "error", eval("var break = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-10-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-10-n.js new file mode 100644 index 000000000..83a2fb124 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-10-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-10-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var if = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var if = true", "error", eval("var if = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-11-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-11-n.js new file mode 100644 index 000000000..21f45e135 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-11-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-11-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var this = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var this = true", "error", eval("var this = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-12-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-12-n.js new file mode 100644 index 000000000..fb4033659 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-12-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-12-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var while = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var while = true", "error", eval("var while = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-13-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-13-n.js new file mode 100644 index 000000000..7deec9473 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-13-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-13-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var else = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var else = true", "error", eval("var else = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-14-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-14-n.js new file mode 100644 index 000000000..00eafceef --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-14-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-14-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var in = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var in = true", "error", eval("var in = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-15-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-15-n.js new file mode 100644 index 000000000..4b224fc2d --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-15-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-15-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var typeof = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var typeof = true", "error", eval("var typeof = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-16-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-16-n.js new file mode 100644 index 000000000..08418bbc9 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-16-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-16-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var with = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var with = true", "error", eval("var with = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-2-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-2-n.js new file mode 100644 index 000000000..54085e214 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-2-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-2-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var for = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var for = true", "error", eval("var for = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-3-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-3-n.js new file mode 100644 index 000000000..194ec14bd --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-3-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-3-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var new = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var new = true", "error", eval("var new = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-4-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-4-n.js new file mode 100644 index 000000000..1784ceefa --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-4-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-4-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var var = true"; +EXPECTED = "error"; + +TestCase( SECTION, "var var = true", "error", eval("var var = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-5-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-5-n.js new file mode 100644 index 000000000..df54b433a --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-5-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-5-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var continue = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var continue = true", "error", eval("var continue = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-6-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-6-n.js new file mode 100644 index 000000000..4c43976ca --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-6-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-6-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var function = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var function = true", "error", eval("var function = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-7-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-7-n.js new file mode 100644 index 000000000..d038de1c1 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-7-n.js @@ -0,0 +1,41 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-7"; +var VERSION = "ECMA_1"; +startTest(); +writeHeaderToLog( SECTION + " Keywords"); + +DESCRIPTION = "var return = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var return = true", "error", eval("var return = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-8-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-8-n.js new file mode 100644 index 000000000..a1d06f3b1 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-8-n.js @@ -0,0 +1,42 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.2-8"; +var VERSION = "ECMA_1"; +startTest(); + +writeHeaderToLog( SECTION + " Keywords"); + +DESCRIPTION = "var void = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var void = true", "error", eval("var void = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.2-9-n.js b/js/src/tests/ecma/LexicalConventions/7.4.2-9-n.js new file mode 100644 index 000000000..2c3dfb8bd --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.2-9-n.js @@ -0,0 +1,43 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Syntax + + 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. + + Author: christine@netscape.com + Date: 12 november 1997 + +*/ +var SECTION = "7.4.1-9-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Keywords"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var delete = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var delete = true", "error", eval("var delete = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-1-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-1-n.js new file mode 100644 index 000000000..b984db0c6 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-1-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-1-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var case = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var case = true", "error", eval("var case = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-10-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-10-n.js new file mode 100644 index 000000000..370d50f06 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-10-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-10-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var do = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var do = true", "error", eval("var do = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-11-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-11-n.js new file mode 100644 index 000000000..625154cdd --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-11-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-11-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var finally = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var finally = true", "error", eval("var finally = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-12-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-12-n.js new file mode 100644 index 000000000..ef1c29e0a --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-12-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-12-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var throw = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var throw = true", "error", eval("var throw = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-13-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-13-n.js new file mode 100644 index 000000000..a4ec57f87 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-13-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-13-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var const = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var const = true", "error", eval("var const = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-14-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-14-n.js new file mode 100644 index 000000000..748cb7183 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-14-n.js @@ -0,0 +1,69 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-14-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var actual = 'no error'; +var prefValue; + +print("This test requires option javascript.options.strict enabled"); + +if (!options().match(/strict/)) +{ + options('strict'); +} +if (!options().match(/werror/)) +{ + options('werror'); +} + +try +{ + eval("var enum = true"); +} +catch(e) +{ + actual = 'error'; +} + +DESCRIPTION = "var enum = true"; +EXPECTED = "error"; + +// force exception since this is a negative test +if (actual == 'error') +{ + throw actual; +} + +new TestCase( SECTION, + "var enum = true", + "error", + actual ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-15-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-15-n.js new file mode 100644 index 000000000..5a3d62c8c --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-15-n.js @@ -0,0 +1,63 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-15-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var actual = 'no error'; +var prefValue; + +print("This test requires option javascript.options.strict enabled"); + +options('strict'); +options('werror'); + +try +{ + eval("var import = true"); +} +catch(e) +{ + actual = 'error'; +} + +DESCRIPTION = "var import = true"; +EXPECTED = "error"; + +// force exception since this is a negative test +if (actual == 'error') +{ + throw actual; +} + +new TestCase( SECTION, + "var import = true", + "error", + actual ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-16-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-16-n.js new file mode 100644 index 000000000..5a42152e6 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-16-n.js @@ -0,0 +1,54 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 + + Author: christine@netscape.com + Date: 12 november 1997 +*/ +var SECTION = "lexical-023.js"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var result = "Failed"; +var exception = "No exception thrown"; +var expect = "Passed"; +/* + try { + try = true; + } catch ( e ) { + result = expect; + exception = e.toString(); + } +*/ + +DESCRIPTION = "try = true"; +EXPECTED = "error"; + +new TestCase( + SECTION, + "try = true" + + " (threw " + exception +")", + "error", + eval("try = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-2-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-2-n.js new file mode 100644 index 000000000..6e3e557ee --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-2-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-2-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var debugger = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var debugger = true", "error", eval("var debugger = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-3-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-3-n.js new file mode 100644 index 000000000..f3b0b38db --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-3-n.js @@ -0,0 +1,38 @@ +// |reftest| skip -- obsolete test +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-3-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var export = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var export = true", "error", eval("var export = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-4-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-4-n.js new file mode 100644 index 000000000..5cea867e0 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-4-n.js @@ -0,0 +1,68 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-4-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var actual = 'no error'; +var prefValue; + +print("This test requires option javascript.options.strict enabled"); + +if (!options().match(/strict/)) +{ + options('strict'); +} +if (!options().match(/werror/)) +{ + options('werror'); +} + +try +{ + eval("var super = true"); +} +catch(e) +{ + actual = 'error'; +} + +DESCRIPTION = "var super = true" + EXPECTED = "error"; + +// force exception since this is a negative test +if (actual == 'error') +{ + throw actual; +} + +new TestCase( SECTION, + "var super = true", + "error", + actual ); +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-5-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-5-n.js new file mode 100644 index 000000000..7c27b51dc --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-5-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-5-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var catch = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var catch = true", "error", eval("var catch = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-6-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-6-n.js new file mode 100644 index 000000000..00770ff42 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-6-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-6-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var default = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var default = true", "error", eval("var default = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-7-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-7-n.js new file mode 100644 index 000000000..b6f1bc073 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-7-n.js @@ -0,0 +1,69 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-7-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var actual = 'no error'; +var prefValue; + +print("This test requires option javascript.options.strict enabled"); + +if (!options().match(/strict/)) +{ + options('strict'); +} +if (!options().match(/werror/)) +{ + options('werror'); +} + +try +{ + eval("var extends = true"); +} +catch(e) +{ + actual = 'error'; +} + +DESCRIPTION = "var extends = true"; +EXPECTED = "error"; + +// force exception since this is a negative test +if (actual == 'error') +{ + throw actual; +} + +new TestCase( SECTION, + "var extends = true", + "error", + actual); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-8-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-8-n.js new file mode 100644 index 000000000..f6d5f86b6 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-8-n.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-9-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var switch = true"; +EXPECTED = "error"; + +new TestCase( SECTION, "var switch = true", "error", eval("var switch = true") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.4.3-9-n.js b/js/src/tests/ecma/LexicalConventions/7.4.3-9-n.js new file mode 100644 index 000000000..94bcdca68 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.4.3-9-n.js @@ -0,0 +1,70 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + 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 +*/ +var SECTION = "7.4.3-9-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Future Reserved Words"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +var actual = 'no error'; +var prefValue; + +DESCRIPTION = "var class = true"; +EXPECTED = "error"; + + +print("This test requires option javascript.options.strict enabled"); + +if (!options().match(/strict/)) +{ + options('strict'); +} +if (!options().match(/werror/)) +{ + options('werror'); +} + +try +{ + eval("var class = true"); +} +catch(e) +{ + actual = 'error'; +} + +// force exception since this is a negative test +if (actual == 'error') +{ + throw actual; +} + +new TestCase( SECTION, + "var class = true", + "error", + actual ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-1.js b/js/src/tests/ecma/LexicalConventions/7.5-1.js new file mode 100644 index 000000000..9888f17cd --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-1.js @@ -0,0 +1,28 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, "var $123 = 5", 5, eval("var $123 = 5;$123") ); +new TestCase( SECTION, "var _123 = 5", 5, eval("var _123 = 5;_123") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-10-n.js b/js/src/tests/ecma/LexicalConventions/7.5-10-n.js new file mode 100644 index 000000000..dca2cbfce --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-10-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-9-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 123=\"hi\""; +EXPECTED = "error"; + +new TestCase( SECTION, "var 123=\"hi\"", "error", eval("123 = \"hi\"; array[item] = 123;") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-2-n.js b/js/src/tests/ecma/LexicalConventions/7.5-2-n.js new file mode 100644 index 000000000..3f9097511 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-2-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-2-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 0abc"; +EXPECTED = "error"; + +new TestCase( SECTION, "var 0abc", "error", eval("var 0abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-3-n.js b/js/src/tests/ecma/LexicalConventions/7.5-3-n.js new file mode 100644 index 000000000..f88cc7710 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-3-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-3-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 1abc"; +EXPECTED = "error"; + +new TestCase( SECTION, "var 1abc", "error", eval("var 1abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-4-n.js b/js/src/tests/ecma/LexicalConventions/7.5-4-n.js new file mode 100644 index 000000000..393a57afa --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-4-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-4-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 2abc"; +EXPECTED = "error"; + +new TestCase( SECTION, "var 2abc", "error", eval("var 2abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-5-n.js b/js/src/tests/ecma/LexicalConventions/7.5-5-n.js new file mode 100644 index 000000000..c04138b6e --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-5-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-5-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 3abc"; +EXPECTED = "error"; + +new TestCase( SECTION, "var 3abc", "error", eval("var 3abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-6.js b/js/src/tests/ecma/LexicalConventions/7.5-6.js new file mode 100644 index 000000000..cca79cc20 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-6.js @@ -0,0 +1,27 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-6"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, "var _0abc = 5", 5, eval("var _0abc = 5; _0abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-7.js b/js/src/tests/ecma/LexicalConventions/7.5-7.js new file mode 100644 index 000000000..3c6bf48ca --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-7.js @@ -0,0 +1,27 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-7"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, "var $0abc = 5", 5, eval("var $0abc = 5; $0abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-8-n.js b/js/src/tests/ecma/LexicalConventions/7.5-8-n.js new file mode 100644 index 000000000..efb30e9d9 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-8-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-8-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var @0abc = 5; @0abc"; +EXPECTED = "error"; + +new TestCase( SECTION, "var @0abc = 5; @0abc", "error", eval("var @0abc = 5; @0abc") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.5-9-n.js b/js/src/tests/ecma/LexicalConventions/7.5-9-n.js new file mode 100644 index 000000000..9d6c01273 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.5-9-n.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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 +*/ +var SECTION = "7.5-9-n"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Identifiers"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +DESCRIPTION = "var 123=\"hi\""; +EXPECTED = "error"; + +new TestCase( SECTION, "var 123=\"hi\"", "error", eval("var 123 = \"hi\";array[item] = 123;") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.6.js b/js/src/tests/ecma/LexicalConventions/7.6.js new file mode 100644 index 000000000..b86ee9624 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.6.js @@ -0,0 +1,279 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Author: christine@netscape.com + Date: 12 november 1997 +*/ + +var SECTION = "7.6"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Punctuators"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +// == +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") ); + +// > +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<b", + false, + eval("var a=true,b=false;a<b") ); + +// <= +new TestCase( SECTION, + "var a=0xFFFF,b=0X0FFF;a<=b", + false, + eval("var a=0xFFFF,b=0X0FFF;a<=b") ); + +// >= +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") ); + +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") ); + +// ~ +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' : '')") ); + +// : + +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") ); + +// && +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") ); +// + + +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") ); + +// | +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") ); + +// << +new TestCase( SECTION, + "var a=4,b=3;a<<b", + 32, + eval("var a=4,b=3;a<<b") ); + +// >> +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") ); + +// -= +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") ); + +// &= +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") ); + +// >> +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") ); + +// () +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}") ); + +// [] +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(); + diff --git a/js/src/tests/ecma/LexicalConventions/7.7.1.js b/js/src/tests/ecma/LexicalConventions/7.7.1.js new file mode 100644 index 000000000..c50a37873 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.1.js @@ -0,0 +1,30 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.7.1.js + ECMA Section: 7.7.1 Null Literals + + Description: NullLiteral:: + 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 +*/ +var SECTION = "7.7.1"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Null Literals"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, "null", null, null); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.7.2.js b/js/src/tests/ecma/LexicalConventions/7.7.2.js new file mode 100644 index 000000000..77ebdea60 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.2.js @@ -0,0 +1,37 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.7.2.js + ECMA Section: 7.7.2 Boolean Literals + + 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 false is a value of the + Boolean type, namely false. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "7.7.2"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Boolean Literals"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +// StringLiteral:: "" and '' + +new TestCase( SECTION, "true", Boolean(true), true ); +new TestCase( SECTION, "false", Boolean(false), false ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.7.3-1.js b/js/src/tests/ecma/LexicalConventions/7.7.3-1.js new file mode 100644 index 000000000..e5bc48e10 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.3-1.js @@ -0,0 +1,164 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + These test cases came from Waldemar. + + Author: christine@netscape.com + Date: 12 June 1998 +*/ + +var SECTION = "7.7.3-1"; +var VERSION = "ECMA_1"; +var TITLE = "Numeric Literals"; +var BUGNUMBER="122877"; + +startTest(); + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "0x12345678", + 305419896, + 0x12345678 ); + +new TestCase( SECTION, + "0x80000000", + 2147483648, + 0x80000000 ); + +new TestCase( SECTION, + "0xffffffff", + 4294967295, + 0xffffffff ); + +new TestCase( SECTION, + "0x100000000", + 4294967296, + 0x100000000 ); + +new TestCase( SECTION, + "077777777777777777", + 2251799813685247, + 077777777777777777 ); + +new TestCase( SECTION, + "077777777777777776", + 2251799813685246, + 077777777777777776 ); + +new TestCase( SECTION, + "0x1fffffffffffff", + 9007199254740991, + 0x1fffffffffffff ); + +new TestCase( SECTION, + "0x20000000000000", + 9007199254740992, + 0x20000000000000 ); + +new TestCase( SECTION, + "0x20123456789abc", + 9027215253084860, + 0x20123456789abc ); + +new TestCase( SECTION, + "0x20123456789abd", + 9027215253084860, + 0x20123456789abd ); + +new TestCase( SECTION, + "0x20123456789abe", + 9027215253084862, + 0x20123456789abe ); + +new TestCase( SECTION, + "0x20123456789abf", + 9027215253084864, + 0x20123456789abf ); + +new TestCase( SECTION, + "0x1000000000000080", + 1152921504606847000, + 0x1000000000000080 ); + +new TestCase( SECTION, + "0x1000000000000081", + 1152921504606847200, + 0x1000000000000081 ); + +new TestCase( SECTION, + "0x1000000000000100", + 1152921504606847200, + 0x1000000000000100 ); + +new TestCase( SECTION, + "0x100000000000017f", + 1152921504606847200, + 0x100000000000017f ); + +new TestCase( SECTION, + "0x1000000000000180", + 1152921504606847500, + 0x1000000000000180 ); + +new TestCase( SECTION, + "0x1000000000000181", + 1152921504606847500, + 0x1000000000000181 ); + +new TestCase( SECTION, + "0x10000000000001f0", + 1152921504606847500, + 0x10000000000001f0 ); + +new TestCase( SECTION, + "0x1000000000000200", + 1152921504606847500, + 0x1000000000000200 ); + +new TestCase( SECTION, + "0x100000000000027f", + 1152921504606847500, + 0x100000000000027f ); + +new TestCase( SECTION, + "0x1000000000000280", + 1152921504606847500, + 0x1000000000000280 ); + +new TestCase( SECTION, + "0x1000000000000281", + 1152921504606847700, + 0x1000000000000281 ); + +new TestCase( SECTION, + "0x10000000000002ff", + 1152921504606847700, + 0x10000000000002ff ); + +new TestCase( SECTION, + "0x1000000000000300", + 1152921504606847700, + 0x1000000000000300 ); + +new TestCase( SECTION, + "0x10000000000000000", + 18446744073709552000, + 0x10000000000000000 ); + +test(); + diff --git a/js/src/tests/ecma/LexicalConventions/7.7.3-2.js b/js/src/tests/ecma/LexicalConventions/7.7.3-2.js new file mode 100644 index 000000000..41aee54e4 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.3-2.js @@ -0,0 +1,59 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + File Name: 7.7.3-2.js + ECMA Section: 7.7.3 Numeric Literals + + Description: + + This is a regression test for + http://scopus.mcom.com/bugsplat/show_bug.cgi?id=122884 + + 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.) + + Author: christine@netscape.com + Date: 15 june 1998 + +*/ +var SECTION = "7.7.3-2"; +var VERSION = "ECMA_1"; +var TITLE = "Numeric Literals"; +var BUGNUMBER="122884"; + +startTest(); + +writeHeaderToLog( SECTION + " "+ TITLE); + +new TestCase( SECTION, + "9", + 9, + 9 ); + +new TestCase( SECTION, + "09", + 9, + 09 ); + +new TestCase( SECTION, + "099", + 99, + 099 ); + + +new TestCase( SECTION, + "077", + 63, + 077 ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.7.3.js b/js/src/tests/ecma/LexicalConventions/7.7.3.js new file mode 100644 index 000000000..15dfaa8b2 --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.3.js @@ -0,0 +1,297 @@ +/* -*- tab-width: 2; indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + Author: christine@netscape.com + Date: 16 september 1997 +*/ +var SECTION = "7.7.3"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "Numeric Literals"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +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 ); + + +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 ); + +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 ); + +new TestCase( SECTION, "0.00000000001", 0.00000000001, 0.00000000001 ); +new TestCase( SECTION, "0.00000000001e-2", 0.0000000000001, 0.00000000001e-2 ); + + +new TestCase( SECTION, + "123456789012345671.9999", + "123456789012345660", + 123456789012345671.9999 +""); +new TestCase( SECTION, + "123456789012345672", + "123456789012345660", + 123456789012345672 +""); + +new TestCase( SECTION, + "123456789012345672.000000000000000000000000000", + "123456789012345660", + 123456789012345672.000000000000000000000000000 +""); + +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) ); + +new TestCase( SECTION, + "123456789012345673", + "123456789012345680", + 123456789012345673 +"" ); + +new TestCase( SECTION, + "-123456789012345671.9999", + "-123456789012345660", + -123456789012345671.9999 +"" ); + +new TestCase( SECTION, + "-123456789012345672", + "-123456789012345660", + -123456789012345672+""); + +new TestCase( SECTION, + "-123456789012345672.000000000000000000000000000", + "-123456789012345660", + -123456789012345672.000000000000000000000000000 +""); + +new TestCase( SECTION, + "-123456789012345672.01", + "-123456789012345680", + -123456789012345672.01 +"" ); + +new TestCase( SECTION, + "-123456789012345672.000000000000000000000000001 == -123456789012345680 or -123456789012345660", + true, + (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345680) + || + (-123456789012345672.000000000000000000000000001 +"" == -1234567890 * 100000000 -12345660)); + +new TestCase( SECTION, + -123456789012345673, + "-123456789012345680", + -123456789012345673 +""); + +new TestCase( SECTION, + "12345678901234567890", + "12345678901234567000", + 12345678901234567890 +"" ); + + +/* + 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+"" ); +*/ +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 ); +/* + new TestCase( SECTION, "0x100000000", 4294967296, 0x100000000 ); + new TestCase( SECTION, "0x1000000000", 68719476736, 0x1000000000 ); + new TestCase( SECTION, "0x10000000000", 1099511627776, 0x10000000000 ); +*/ + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.7.4.js b/js/src/tests/ecma/LexicalConventions/7.7.4.js new file mode 100644 index 000000000..afbe4c12e --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.7.4.js @@ -0,0 +1,208 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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. + + + Author: christine@netscape.com + Date: 16 september 1997 +*/ + +var SECTION = "7.7.4"; +var VERSION = "ECMA_1"; +startTest(); +var TITLE = "String Literals"; + +writeHeaderToLog( SECTION + " "+ TITLE); + +// StringLiteral:: "" and '' + +new TestCase( SECTION, "\"\"", "", "" ); +new TestCase( SECTION, "\'\'", "", '' ); + +// 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" ); + +// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::OctalEscapeSequence + +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" ); + +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" ); + +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" ); + +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" ); + +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 +// new TestCase( SECTION, "\\444", "444", "\444" ); + +// DoubleStringCharacters:DoubleStringCharacter::EscapeSequence::HexEscapeSequence +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 + +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" ); + +// 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, "\\w", "w", "\w" ); +new TestCase( SECTION, "\\y", "y", "\y" ); +new TestCase( SECTION, "\\z", "z", "\z" ); +new TestCase( SECTION, "\\9", "9", "\9" ); + +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 + +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" ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/7.8.2-n.js b/js/src/tests/ecma/LexicalConventions/7.8.2-n.js new file mode 100644 index 000000000..0675322eb --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/7.8.2-n.js @@ -0,0 +1,29 @@ +/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + + +/** + 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"); + + +// new TestCase( "7.8.2", "{ 1 \n 2 } 3", 3, eval("{ 1 \n 2 } 3") ); + +DESCRIPTION = "{ 1 2 } 3"; +EXPECTED = "error"; + +new TestCase( "7.8.2", "{ 1 2 } 3", "error", eval("{1 2 } 3") ); + +test(); diff --git a/js/src/tests/ecma/LexicalConventions/browser.js b/js/src/tests/ecma/LexicalConventions/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/browser.js diff --git a/js/src/tests/ecma/LexicalConventions/shell.js b/js/src/tests/ecma/LexicalConventions/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/ecma/LexicalConventions/shell.js |