diff options
Diffstat (limited to 'js/src/tests/test262/ch14/14.0')
-rw-r--r-- | js/src/tests/test262/ch14/14.0/S14_A1.js | 35 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/S14_A2.js | 31 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/S14_A3.js | 30 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/S14_A5_T1.js | 22 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/S14_A5_T2.js | 21 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/browser.js | 0 | ||||
-rw-r--r-- | js/src/tests/test262/ch14/14.0/shell.js | 0 |
7 files changed, 139 insertions, 0 deletions
diff --git a/js/src/tests/test262/ch14/14.0/S14_A1.js b/js/src/tests/test262/ch14/14.0/S14_A1.js new file mode 100644 index 000000000..302db12dd --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/S14_A1.js @@ -0,0 +1,35 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionExpression must be localed in a reacheable fragment of the program + * + * @path ch14/14.0/S14_A1.js + * @description Declaring a function within an "if" Expression + */ + +var THERE = "I'm there"; +var HERE = "I'm here"; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( __func !== undefined) { + $ERROR('#1: __func === undefined. Actual: __func ==='+ __func ); +} +// +////////////////////////////////////////////////////////////////////////////// + +if (true){ + var __func = function(){return HERE;}; +} else { + var __func = function (){return THERE;}; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func() !== HERE) { + $ERROR('#2: __func() === HERE. Actual: __func() ==='+ __func() ); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch14/14.0/S14_A2.js b/js/src/tests/test262/ch14/14.0/S14_A2.js new file mode 100644 index 000000000..758e6daf5 --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/S14_A2.js @@ -0,0 +1,31 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration cannot be localed inside an Expression + * + * @path ch14/14.0/S14_A2.js + * @description Declaring a function within an "if" Expression + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof f !== 'undefined') { + $ERROR('#1: typeof f === \'undefined\'. Actual: typeof f ==='+ typeof f ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (function f(arg){ + if (arg===0) + return 1; + else + return f(arg-1)*arg; +}(3)!==6) { + $ERROR('#2: FunctionDeclaration cannot be localed inside an Expression'); +}; +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/js/src/tests/test262/ch14/14.0/S14_A3.js b/js/src/tests/test262/ch14/14.0/S14_A3.js new file mode 100644 index 000000000..d7dff69a6 --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/S14_A3.js @@ -0,0 +1,30 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Global FunctionDeclaration cannot be defined within the body of another FunctionDeclaration + * + * @path ch14/14.0/S14_A3.js + * @description Declaring a function within the body of another function + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+ typeof __func ); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __gunc !== "undefined") { + $ERROR('#2: typeof __gunc === "undefined". Actual: typeof __gunc ==='+ typeof __gunc ); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){ + function __gunc(){return true}; +} + diff --git a/js/src/tests/test262/ch14/14.0/S14_A5_T1.js b/js/src/tests/test262/ch14/14.0/S14_A5_T1.js new file mode 100644 index 000000000..499147150 --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/S14_A5_T1.js @@ -0,0 +1,22 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifer within a FunctionDeclaration can be written in both letters and unicode + * + * @path ch14/14.0/S14_A5_T1.js + * @description Declaring a function with "function __\u0066\u0075\u006e\u0063(){return "both"}" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func() !== "both") { + $ERROR('#1: __func() === "both". Actual: __func() ==='+ __func() ); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "ascii"}; +function \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"};//__func in unicode +function __\u0066\u0075\u006e\u0063(){return "both"};//__func in unicode + diff --git a/js/src/tests/test262/ch14/14.0/S14_A5_T2.js b/js/src/tests/test262/ch14/14.0/S14_A5_T2.js new file mode 100644 index 000000000..ee3c9d2a3 --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/S14_A5_T2.js @@ -0,0 +1,21 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifer within a FunctionDeclaration can be written in both letters and unicode + * + * @path ch14/14.0/S14_A5_T2.js + * @description Declaring a function with "function \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"}" + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func() !== "unicode") { + $ERROR('#1: __func() === "unicode". Actual: __func() ==='+ __func() ); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "ascii"}; +function \u005f\u005f\u0066\u0075\u006e\u0063(){return "unicode"};//__func in unicode + diff --git a/js/src/tests/test262/ch14/14.0/browser.js b/js/src/tests/test262/ch14/14.0/browser.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/browser.js diff --git a/js/src/tests/test262/ch14/14.0/shell.js b/js/src/tests/test262/ch14/14.0/shell.js new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/js/src/tests/test262/ch14/14.0/shell.js |