From 2f093b79888214dc2a73301a022dede17241562d Mon Sep 17 00:00:00 2001 From: David Fugate Date: Fri, 3 Feb 2012 13:36:07 -0800 Subject: No test262 test cases can be found under test/suite/chN/*.js for all 'N'. If such files existed, they've been moved to test/suite/chN/N.0/ now. --- test/suite/ch13/13.0/S13_A1.js | 31 ++++++++++++++++ test/suite/ch13/13.0/S13_A10.js | 32 +++++++++++++++++ test/suite/ch13/13.0/S13_A11_T1.js | 20 +++++++++++ test/suite/ch13/13.0/S13_A11_T2.js | 23 ++++++++++++ test/suite/ch13/13.0/S13_A11_T3.js | 25 +++++++++++++ test/suite/ch13/13.0/S13_A11_T4.js | 28 +++++++++++++++ test/suite/ch13/13.0/S13_A12_T1.js | 32 +++++++++++++++++ test/suite/ch13/13.0/S13_A12_T2.js | 37 +++++++++++++++++++ test/suite/ch13/13.0/S13_A13_T1.js | 26 ++++++++++++++ test/suite/ch13/13.0/S13_A13_T2.js | 27 ++++++++++++++ test/suite/ch13/13.0/S13_A13_T3.js | 31 ++++++++++++++++ test/suite/ch13/13.0/S13_A14.js | 20 +++++++++++ test/suite/ch13/13.0/S13_A15_T1.js | 22 ++++++++++++ test/suite/ch13/13.0/S13_A15_T2.js | 25 +++++++++++++ test/suite/ch13/13.0/S13_A15_T3.js | 35 ++++++++++++++++++ test/suite/ch13/13.0/S13_A15_T4.js | 25 +++++++++++++ test/suite/ch13/13.0/S13_A15_T5.js | 34 ++++++++++++++++++ test/suite/ch13/13.0/S13_A16.js | 44 +++++++++++++++++++++++ test/suite/ch13/13.0/S13_A17_T1.js | 45 +++++++++++++++++++++++ test/suite/ch13/13.0/S13_A17_T2.js | 46 ++++++++++++++++++++++++ test/suite/ch13/13.0/S13_A18.js | 32 +++++++++++++++++ test/suite/ch13/13.0/S13_A19_T1.js | 32 +++++++++++++++++ test/suite/ch13/13.0/S13_A19_T2.js | 35 ++++++++++++++++++ test/suite/ch13/13.0/S13_A2_T1.js | 29 +++++++++++++++ test/suite/ch13/13.0/S13_A2_T2.js | 29 +++++++++++++++ test/suite/ch13/13.0/S13_A2_T3.js | 29 +++++++++++++++ test/suite/ch13/13.0/S13_A3_T1.js | 29 +++++++++++++++ test/suite/ch13/13.0/S13_A3_T2.js | 29 +++++++++++++++ test/suite/ch13/13.0/S13_A3_T3.js | 28 +++++++++++++++ test/suite/ch13/13.0/S13_A4_T1.js | 28 +++++++++++++++ test/suite/ch13/13.0/S13_A4_T2.js | 28 +++++++++++++++ test/suite/ch13/13.0/S13_A4_T3.js | 28 +++++++++++++++ test/suite/ch13/13.0/S13_A4_T4.js | 46 ++++++++++++++++++++++++ test/suite/ch13/13.0/S13_A6_T1.js | 36 +++++++++++++++++++ test/suite/ch13/13.0/S13_A6_T2.js | 36 +++++++++++++++++++ test/suite/ch13/13.0/S13_A7_T1.js | 73 ++++++++++++++++++++++++++++++++++++++ test/suite/ch13/13.0/S13_A7_T2.js | 49 +++++++++++++++++++++++++ test/suite/ch13/13.0/S13_A7_T3.js | 13 +++++++ test/suite/ch13/13.0/S13_A8_T1.js | 33 +++++++++++++++++ test/suite/ch13/13.0/S13_A8_T2.js | 38 ++++++++++++++++++++ test/suite/ch13/13.0/S13_A9.js | 22 ++++++++++++ test/suite/ch13/S13_A1.js | 31 ---------------- test/suite/ch13/S13_A10.js | 32 ----------------- test/suite/ch13/S13_A11_T1.js | 20 ----------- test/suite/ch13/S13_A11_T2.js | 23 ------------ test/suite/ch13/S13_A11_T3.js | 25 ------------- test/suite/ch13/S13_A11_T4.js | 28 --------------- test/suite/ch13/S13_A12_T1.js | 32 ----------------- test/suite/ch13/S13_A12_T2.js | 37 ------------------- test/suite/ch13/S13_A13_T1.js | 26 -------------- test/suite/ch13/S13_A13_T2.js | 27 -------------- test/suite/ch13/S13_A13_T3.js | 31 ---------------- test/suite/ch13/S13_A14.js | 20 ----------- test/suite/ch13/S13_A15_T1.js | 22 ------------ test/suite/ch13/S13_A15_T2.js | 25 ------------- test/suite/ch13/S13_A15_T3.js | 35 ------------------ test/suite/ch13/S13_A15_T4.js | 25 ------------- test/suite/ch13/S13_A15_T5.js | 34 ------------------ test/suite/ch13/S13_A16.js | 44 ----------------------- test/suite/ch13/S13_A17_T1.js | 45 ----------------------- test/suite/ch13/S13_A17_T2.js | 46 ------------------------ test/suite/ch13/S13_A18.js | 32 ----------------- test/suite/ch13/S13_A19_T1.js | 32 ----------------- test/suite/ch13/S13_A19_T2.js | 35 ------------------ test/suite/ch13/S13_A2_T1.js | 29 --------------- test/suite/ch13/S13_A2_T2.js | 29 --------------- test/suite/ch13/S13_A2_T3.js | 29 --------------- test/suite/ch13/S13_A3_T1.js | 29 --------------- test/suite/ch13/S13_A3_T2.js | 29 --------------- test/suite/ch13/S13_A3_T3.js | 28 --------------- test/suite/ch13/S13_A4_T1.js | 28 --------------- test/suite/ch13/S13_A4_T2.js | 28 --------------- test/suite/ch13/S13_A4_T3.js | 28 --------------- test/suite/ch13/S13_A4_T4.js | 46 ------------------------ test/suite/ch13/S13_A6_T1.js | 36 ------------------- test/suite/ch13/S13_A6_T2.js | 36 ------------------- test/suite/ch13/S13_A7_T1.js | 73 -------------------------------------- test/suite/ch13/S13_A7_T2.js | 49 ------------------------- test/suite/ch13/S13_A7_T3.js | 13 ------- test/suite/ch13/S13_A8_T1.js | 33 ----------------- test/suite/ch13/S13_A8_T2.js | 38 -------------------- test/suite/ch13/S13_A9.js | 22 ------------ test/suite/ch14/14.0/S14_A1.js | 35 ++++++++++++++++++ test/suite/ch14/14.0/S14_A2.js | 31 ++++++++++++++++ test/suite/ch14/14.0/S14_A3.js | 30 ++++++++++++++++ test/suite/ch14/14.0/S14_A5_T1.js | 22 ++++++++++++ test/suite/ch14/14.0/S14_A5_T2.js | 21 +++++++++++ test/suite/ch14/S14_A1.js | 35 ------------------ test/suite/ch14/S14_A2.js | 31 ---------------- test/suite/ch14/S14_A3.js | 30 ---------------- test/suite/ch14/S14_A5_T1.js | 22 ------------ test/suite/ch14/S14_A5_T2.js | 21 ----------- 92 files changed, 1449 insertions(+), 1449 deletions(-) create mode 100644 test/suite/ch13/13.0/S13_A1.js create mode 100644 test/suite/ch13/13.0/S13_A10.js create mode 100644 test/suite/ch13/13.0/S13_A11_T1.js create mode 100644 test/suite/ch13/13.0/S13_A11_T2.js create mode 100644 test/suite/ch13/13.0/S13_A11_T3.js create mode 100644 test/suite/ch13/13.0/S13_A11_T4.js create mode 100644 test/suite/ch13/13.0/S13_A12_T1.js create mode 100644 test/suite/ch13/13.0/S13_A12_T2.js create mode 100644 test/suite/ch13/13.0/S13_A13_T1.js create mode 100644 test/suite/ch13/13.0/S13_A13_T2.js create mode 100644 test/suite/ch13/13.0/S13_A13_T3.js create mode 100644 test/suite/ch13/13.0/S13_A14.js create mode 100644 test/suite/ch13/13.0/S13_A15_T1.js create mode 100644 test/suite/ch13/13.0/S13_A15_T2.js create mode 100644 test/suite/ch13/13.0/S13_A15_T3.js create mode 100644 test/suite/ch13/13.0/S13_A15_T4.js create mode 100644 test/suite/ch13/13.0/S13_A15_T5.js create mode 100644 test/suite/ch13/13.0/S13_A16.js create mode 100644 test/suite/ch13/13.0/S13_A17_T1.js create mode 100644 test/suite/ch13/13.0/S13_A17_T2.js create mode 100644 test/suite/ch13/13.0/S13_A18.js create mode 100644 test/suite/ch13/13.0/S13_A19_T1.js create mode 100644 test/suite/ch13/13.0/S13_A19_T2.js create mode 100644 test/suite/ch13/13.0/S13_A2_T1.js create mode 100644 test/suite/ch13/13.0/S13_A2_T2.js create mode 100644 test/suite/ch13/13.0/S13_A2_T3.js create mode 100644 test/suite/ch13/13.0/S13_A3_T1.js create mode 100644 test/suite/ch13/13.0/S13_A3_T2.js create mode 100644 test/suite/ch13/13.0/S13_A3_T3.js create mode 100644 test/suite/ch13/13.0/S13_A4_T1.js create mode 100644 test/suite/ch13/13.0/S13_A4_T2.js create mode 100644 test/suite/ch13/13.0/S13_A4_T3.js create mode 100644 test/suite/ch13/13.0/S13_A4_T4.js create mode 100644 test/suite/ch13/13.0/S13_A6_T1.js create mode 100644 test/suite/ch13/13.0/S13_A6_T2.js create mode 100644 test/suite/ch13/13.0/S13_A7_T1.js create mode 100644 test/suite/ch13/13.0/S13_A7_T2.js create mode 100644 test/suite/ch13/13.0/S13_A7_T3.js create mode 100644 test/suite/ch13/13.0/S13_A8_T1.js create mode 100644 test/suite/ch13/13.0/S13_A8_T2.js create mode 100644 test/suite/ch13/13.0/S13_A9.js delete mode 100644 test/suite/ch13/S13_A1.js delete mode 100644 test/suite/ch13/S13_A10.js delete mode 100644 test/suite/ch13/S13_A11_T1.js delete mode 100644 test/suite/ch13/S13_A11_T2.js delete mode 100644 test/suite/ch13/S13_A11_T3.js delete mode 100644 test/suite/ch13/S13_A11_T4.js delete mode 100644 test/suite/ch13/S13_A12_T1.js delete mode 100644 test/suite/ch13/S13_A12_T2.js delete mode 100644 test/suite/ch13/S13_A13_T1.js delete mode 100644 test/suite/ch13/S13_A13_T2.js delete mode 100644 test/suite/ch13/S13_A13_T3.js delete mode 100644 test/suite/ch13/S13_A14.js delete mode 100644 test/suite/ch13/S13_A15_T1.js delete mode 100644 test/suite/ch13/S13_A15_T2.js delete mode 100644 test/suite/ch13/S13_A15_T3.js delete mode 100644 test/suite/ch13/S13_A15_T4.js delete mode 100644 test/suite/ch13/S13_A15_T5.js delete mode 100644 test/suite/ch13/S13_A16.js delete mode 100644 test/suite/ch13/S13_A17_T1.js delete mode 100644 test/suite/ch13/S13_A17_T2.js delete mode 100644 test/suite/ch13/S13_A18.js delete mode 100644 test/suite/ch13/S13_A19_T1.js delete mode 100644 test/suite/ch13/S13_A19_T2.js delete mode 100644 test/suite/ch13/S13_A2_T1.js delete mode 100644 test/suite/ch13/S13_A2_T2.js delete mode 100644 test/suite/ch13/S13_A2_T3.js delete mode 100644 test/suite/ch13/S13_A3_T1.js delete mode 100644 test/suite/ch13/S13_A3_T2.js delete mode 100644 test/suite/ch13/S13_A3_T3.js delete mode 100644 test/suite/ch13/S13_A4_T1.js delete mode 100644 test/suite/ch13/S13_A4_T2.js delete mode 100644 test/suite/ch13/S13_A4_T3.js delete mode 100644 test/suite/ch13/S13_A4_T4.js delete mode 100644 test/suite/ch13/S13_A6_T1.js delete mode 100644 test/suite/ch13/S13_A6_T2.js delete mode 100644 test/suite/ch13/S13_A7_T1.js delete mode 100644 test/suite/ch13/S13_A7_T2.js delete mode 100644 test/suite/ch13/S13_A7_T3.js delete mode 100644 test/suite/ch13/S13_A8_T1.js delete mode 100644 test/suite/ch13/S13_A8_T2.js delete mode 100644 test/suite/ch13/S13_A9.js create mode 100644 test/suite/ch14/14.0/S14_A1.js create mode 100644 test/suite/ch14/14.0/S14_A2.js create mode 100644 test/suite/ch14/14.0/S14_A3.js create mode 100644 test/suite/ch14/14.0/S14_A5_T1.js create mode 100644 test/suite/ch14/14.0/S14_A5_T2.js delete mode 100644 test/suite/ch14/S14_A1.js delete mode 100644 test/suite/ch14/S14_A2.js delete mode 100644 test/suite/ch14/S14_A3.js delete mode 100644 test/suite/ch14/S14_A5_T1.js delete mode 100644 test/suite/ch14/S14_A5_T2.js (limited to 'test') diff --git a/test/suite/ch13/13.0/S13_A1.js b/test/suite/ch13/13.0/S13_A1.js new file mode 100644 index 000000000..fdd4e020f --- /dev/null +++ b/test/suite/ch13/13.0/S13_A1.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. + +/** + * "x=function y(){}" statement does not store a reference to the new function in the varaible y(Identifier) + * + * @path ch13/S13_A1.js + * @description Checking the type of y + */ + +var __func = function __exp__func(){return 0;}; + +//////////////////////////////////////////////// +// ////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + + + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __exp__func !== "undefined"){ + $ERROR('#2: typeof __exp__func === "undefined". Actual: typeof __exp__func ==='+typeof __exp__func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A10.js b/test/suite/ch13/13.0/S13_A10.js new file mode 100644 index 000000000..99525bf52 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A10.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function is a data + * + * @path ch13/S13_A10.js + * @description Using function as a property of an object + */ + +function __ziggy__func(){return "ziggy stardust"} + +var __music_box={}; + +__music_box.ziggy = __ziggy__func; + +////////////////////////////////////////////////////////////////////////////// +//CHECK# +if (typeof __music_box.ziggy !== "function") { + $ERROR('#1: typeof __music_box.ziggy === "function". Actual: typeof __music_box.ziggy ==='+typeof __music_box.ziggy); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__music_box.ziggy() !== "ziggy stardust") { + $ERROR('#2: __music_box.ziggy() === "ziggy stardust". Actual: __music_box.ziggy() ==='+__music_box.ziggy()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A11_T1.js b/test/suite/ch13/13.0/S13_A11_T1.js new file mode 100644 index 000000000..4c082a712 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A11_T1.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/S13_A11_T1.js + * @description Returning result of "delete arguments" + */ + +function __func(){ return delete arguments;} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func("A","B",1,2)) { + $ERROR('#1: arguments property has attribute { DontDelete }'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A11_T2.js b/test/suite/ch13/13.0/S13_A11_T2.js new file mode 100644 index 000000000..d97dfe039 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A11_T2.js @@ -0,0 +1,23 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/S13_A11_T2.js + * @description Checking if deleting the arguments property fails and then returning it + */ + +function __func(){ + delete arguments; + return arguments; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func("A","B",1,2) !== "object") { + $ERROR('#1: arguments property has attribute { DontDelete }'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A11_T3.js b/test/suite/ch13/13.0/S13_A11_T3.js new file mode 100644 index 000000000..a6be104c7 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A11_T3.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/S13_A11_T3.js + * @description Deleting arguments[i] and returning result of the operation + */ + +function __func(){ + was_del=false; + for (i=0; i < arguments.length; i++) + was_del= was_del || delete arguments[i]; + return was_del; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!__func("A","B",1,2)) { + $ERROR('#1: Since arguments property has attribute { DontDelete } elements of arguments can be deleted'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A11_T4.js b/test/suite/ch13/13.0/S13_A11_T4.js new file mode 100644 index 000000000..009bf846f --- /dev/null +++ b/test/suite/ch13/13.0/S13_A11_T4.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Since arguments property has attribute { DontDelete }, only its elements can be deleted + * + * @path ch13/S13_A11_T4.js + * @description Deleting arguments[i] and checking the type of arguments[i] + */ + +function __func(){ + is_undef=true; + for (i=0; i < arguments.length; i++) + { + delete arguments[i]; + is_undef= is_undef && (typeof arguments[i] === "undefined"); + }; + return is_undef; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (!__func("A","B",1,2)) { + $ERROR('#1: Since arguments property has attribute { DontDelete }, but elements of arguments can be deleted'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A12_T1.js b/test/suite/ch13/13.0/S13_A12_T1.js new file mode 100644 index 000000000..caafdfc87 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A12_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declarations in global or function scope are {DontDelete} + * + * @path ch13/S13_A12_T1.js + * @description Checking if deleting a function that is declared in global scope fails + */ + +ALIVE="Letov is alive" + +function __func(){ + return ALIVE; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (delete __func) { + $ERROR('#1: delete __func returning false'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func() !== ALIVE) { + $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A12_T2.js b/test/suite/ch13/13.0/S13_A12_T2.js new file mode 100644 index 000000000..47f7d2152 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A12_T2.js @@ -0,0 +1,37 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function declarations in global or function scope are {DontDelete} + * + * @path ch13/S13_A12_T2.js + * @description Checking if deleting a function that is declared in function scope fails + */ + +ALIVE="Letov is alive" + +function __cont(){ + + function __func(){ + return ALIVE; + }; + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (delete __func) { + $ERROR('#1: delete __func returning false'); + } + // + ////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////////////////////////////////////////////////// + //CHECK#2 + if (__func() !== ALIVE) { + $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); + } + // + ////////////////////////////////////////////////////////////////////////////// +}; + +__cont(); + diff --git a/test/suite/ch13/13.0/S13_A13_T1.js b/test/suite/ch13/13.0/S13_A13_T1.js new file mode 100644 index 000000000..dc4c3ba64 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A13_T1.js @@ -0,0 +1,26 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/S13_A13_T1.js + * @description Deleting arguments[i] + */ + +function __func(__arg){ + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 1) { + $ERROR('#1.2: __func(1) === 1. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A13_T2.js b/test/suite/ch13/13.0/S13_A13_T2.js new file mode 100644 index 000000000..359eaf9f4 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A13_T2.js @@ -0,0 +1,27 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/S13_A13_T2.js + * @description Changing arguments value and then deleting the argument + */ + +function __func(__arg){ + __arg = 2; + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 2) { + $ERROR('#1.2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A13_T3.js b/test/suite/ch13/13.0/S13_A13_T3.js new file mode 100644 index 000000000..84dd5ea1e --- /dev/null +++ b/test/suite/ch13/13.0/S13_A13_T3.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. + +/** + * Deleting arguments[i] leads to breaking the connection to local reference + * + * @path ch13/S13_A13_T3.js + * @description Changing argument value, deleting the argument and then defining a new value for arguments[i] + */ + +function __func(__arg){ + __arg = 2; + delete arguments[0]; + if (arguments[0] !== undefined) { + $ERROR('#1.1: arguments[0] === undefined'); + } + arguments[0] = "A"; + if (arguments[0] !== "A") { + $ERROR('#1.2: arguments[0] === "A"'); + } + return __arg; +} + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(1) !== 2) { + $ERROR('#1.3: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A14.js b/test/suite/ch13/13.0/S13_A14.js new file mode 100644 index 000000000..31a63313b --- /dev/null +++ b/test/suite/ch13/13.0/S13_A14.js @@ -0,0 +1,20 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Unicode symbols in function name are allowed + * + * @path ch13/S13_A14.js + * @description Defining function name with unicode symbols + */ + +eval("function __func\u0041(__arg){return __arg;};"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __funcA !== "function") { + $ERROR('#1: unicode symbols in function name are allowed'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A15_T1.js b/test/suite/ch13/13.0/S13_A15_T1.js new file mode 100644 index 000000000..c4862b38e --- /dev/null +++ b/test/suite/ch13/13.0/S13_A15_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. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/S13_A15_T1.js + * @description Declaring a function with "__func(arguments)" + */ + +function __func(arguments){ + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42) !== 42) { + $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A15_T2.js b/test/suite/ch13/13.0/S13_A15_T2.js new file mode 100644 index 000000000..ec82748be --- /dev/null +++ b/test/suite/ch13/13.0/S13_A15_T2.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/S13_A15_T2.js + * @description Overriding arguments within functions body + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +function __func(){ + var arguments = THE_ANSWER; + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42,42,42) !== THE_ANSWER) { + $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A15_T3.js b/test/suite/ch13/13.0/S13_A15_T3.js new file mode 100644 index 000000000..ef625d881 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A15_T3.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. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/S13_A15_T3.js + * @description Declaring a variable named with "arguments" without a function + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +var arguments = THE_ANSWER; + +function __func(arguments){ + return arguments; + +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func() !== "undefined") { + $ERROR('#1: typeof __func() === "undefined". Actual: typeof __func() ==='+typeof __func()); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func("The Ultimate Question") !== "The Ultimate Question") { + $ERROR('#2: __func("The Ultimate Question") === "The Ultimate Question". Actual: __func("The Ultimate Question")==='+__func("The Ultimate Question")); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A15_T4.js b/test/suite/ch13/13.0/S13_A15_T4.js new file mode 100644 index 000000000..e33c5ca14 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A15_T4.js @@ -0,0 +1,25 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/S13_A15_T4.js + * @description Declaring a variable named with "arguments" and following a "return" statement within a function body + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +function __func(){ + return typeof arguments; + var arguments = THE_ANSWER; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func(42,42,42) !== "object") { + $ERROR('#1: __func(42,42,42) === "object". Actual: __func(42,42,42)==='+__func(42,42,42)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A15_T5.js b/test/suite/ch13/13.0/S13_A15_T5.js new file mode 100644 index 000000000..3ea179277 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A15_T5.js @@ -0,0 +1,34 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * ''arguments'' variable overrides ActivationObject.arguments + * + * @path ch13/S13_A15_T5.js + * @description Creating a variable named with "arguments" without a function + */ + +THE_ANSWER="Answer to Life, the Universe, and Everything"; + +var arguments = THE_ANSWER; + +function __func(){ + return arguments; +}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if ( __func() === THE_ANSWER) { + $ERROR('#1: __func() !== THE_ANSWER'); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func("The Ultimate Question") === "The Ultimate Question") { + $ERROR('#2: __func("The Ultimate Question") !== "The Ultimate Question"'); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A16.js b/test/suite/ch13/13.0/S13_A16.js new file mode 100644 index 000000000..6d2e9cec5 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A16.js @@ -0,0 +1,44 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Any separators are admitted between declaration chunks + * + * @path ch13/S13_A16.js + * @description Inserting separators between declaration chunks + */ + +function +x +( +) +{ +} +; + +x(); + +function y ( ) {}; + +y(); + +function + +z + +( + +) + +{ + +} + +; + +z(); + +eval("function\u0009\u2029w(\u000C)\u00A0{\u000D};"); + +w(); + diff --git a/test/suite/ch13/13.0/S13_A17_T1.js b/test/suite/ch13/13.0/S13_A17_T1.js new file mode 100644 index 000000000..935c419c9 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A17_T1.js @@ -0,0 +1,45 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function call cannot appear in the program before the FunctionExpression appears + * + * @path ch13/S13_A17_T1.js + * @description Trying to call a function before the FunctionExpression appears + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); + $FAIL("#1.1: var __result = __func() lead to throwing exception"); +} catch(e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +var __func = function (){return "ONE";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var __result = __func(); +if (__result !== "ONE") { + $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +__func = function (){return "TWO";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var __result = __func(); +if (__result !== "TWO") { + $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A17_T2.js b/test/suite/ch13/13.0/S13_A17_T2.js new file mode 100644 index 000000000..b3224d851 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A17_T2.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Function call cannot appear in the program before the FunctionExpression appears + * + * @path ch13/S13_A17_T2.js + * @description Trying to call a function before the FunctionExpression appears and then using the FunctionExpression one more time + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); + $ERROR("#1: var __result = __func() lead to throwing exception"); +} catch(e) { + if ((e instanceof TypeError) !== true) { + $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +// now we reach the __func overwriting by new expression +var __func = function __func(){return "ONE";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +var __result = __func(); +if (__result !== "ONE") { + $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +__func = function __func(){return "TWO";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +var __result = __func(); +if (__result !== "TWO") { + $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A18.js b/test/suite/ch13/13.0/S13_A18.js new file mode 100644 index 000000000..1b4057d7b --- /dev/null +++ b/test/suite/ch13/13.0/S13_A18.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Closures are admitted + * + * @path ch13/S13_A18.js + * @description Using a function declaration as a function parameter + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof sinx !== 'undefined') { + $ERROR('#1: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __val = function derivative(f, dx) { + return function(x) { + return (f(x + dx) - f(x)) / dx; + }; +}(function sinx(x){return Math.sin(x);},.0001)(0.5); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof sinx !== 'undefined') { + $ERROR('#2: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A19_T1.js b/test/suite/ch13/13.0/S13_A19_T1.js new file mode 100644 index 000000000..06c68ba7d --- /dev/null +++ b/test/suite/ch13/13.0/S13_A19_T1.js @@ -0,0 +1,32 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * "var" does not override function declaration + * + * @path ch13/S13_A19_T1.js + * @description Creating a function and a variable with identical Identifiers in global scope + */ + +// since "var" does not override function declaration __decl is set to function +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __decl !== "function") { + $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); +} +// +////////////////////////////////////////////////////////////////////////////// + +var __decl = 1; + +//since statement was evaluted __decl turns to 1 from function +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__decl !== 1) { + $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __decl(){return 1;} + diff --git a/test/suite/ch13/13.0/S13_A19_T2.js b/test/suite/ch13/13.0/S13_A19_T2.js new file mode 100644 index 000000000..fdc1b7619 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A19_T2.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. + +/** + * "var" does not override function declaration + * + * @path ch13/S13_A19_T2.js + * @description Creating a function and a variable with identical Identifiers within function scope + */ + +(function (){ + + // since "var" does not override function declaration __decl is set to function + ////////////////////////////////////////////////////////////////////////////// + //CHECK#1 + if (typeof __decl !== "function") { + $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); + } + // + ////////////////////////////////////////////////////////////////////////////// + + var __decl = 1; + + //since statement was evaluted __decl turns to 1 from function + ////////////////////////////////////////////////////////////////////////////// + //CHECK#2 + if (__decl !== 1) { + $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); + } + // + ////////////////////////////////////////////////////////////////////////////// + + function __decl(){return 1;} +})(); + diff --git a/test/suite/ch13/13.0/S13_A2_T1.js b/test/suite/ch13/13.0/S13_A2_T1.js new file mode 100644 index 000000000..4a08e96c5 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A2_T1.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * function must be evaluated inside the expression + * + * @path ch13/S13_A2_T1.js + * @description Defining function body with "return arg" + */ + +var x = (function __func(arg){return arg})(1); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== 1) { + $ERROR('#1: x === 1. Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A2_T2.js b/test/suite/ch13/13.0/S13_A2_T2.js new file mode 100644 index 000000000..3d84a168e --- /dev/null +++ b/test/suite/ch13/13.0/S13_A2_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * function must be evaluated inside the expression + * + * @path ch13/S13_A2_T2.js + * @description Defining function body with "return arg + arguments[1]" + */ + +var x = (function __func(arg){return arg + arguments[1]})(1,"1"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== "11") { + $ERROR('#1: x === "11". Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A2_T3.js b/test/suite/ch13/13.0/S13_A2_T3.js new file mode 100644 index 000000000..7255ab039 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A2_T3.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * function must be evaluated inside the expression + * + * @path ch13/S13_A2_T3.js + * @description Defining function body with "return arguments[0] +"-"+ arguments[1]" + */ + +var x = (function __func(){return arguments[0] +"-"+ arguments[1]})("Obi","Wan"); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (x !== "Obi-Wan") { + $ERROR('#1: x === "Obi-Wan". Actual: x ==='+x); +} + +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func !== 'undefined') { + $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A3_T1.js b/test/suite/ch13/13.0/S13_A3_T1.js new file mode 100644 index 000000000..7b4d3df15 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A3_T1.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/S13_A3_T1.js + * @description Creating a recursive function that calculates factorial, as a variable. + * Function call itself by it`s name + */ + +var __func = function __exp__func(arg){ + if (arg === 1) { + return arg; + } else { + return __exp__func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A3_T2.js b/test/suite/ch13/13.0/S13_A3_T2.js new file mode 100644 index 000000000..51f35cc67 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A3_T2.js @@ -0,0 +1,29 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/S13_A3_T2.js + * @description Creating a recursive function that calculates factorial, as a variable. + * Function calls itself by the name of the variable + */ + +var __func = function (arg){ + if (arg === 1) { + return arg; + } else { + return __func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A3_T3.js b/test/suite/ch13/13.0/S13_A3_T3.js new file mode 100644 index 000000000..4c5b4b60d --- /dev/null +++ b/test/suite/ch13/13.0/S13_A3_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively + * + * @path ch13/S13_A3_T3.js + * @description Creating simple recursive function that calculates factorial + */ + +function __func(arg){ + if (arg === 1) { + return arg; + } else { + return __func(arg-1)*arg; + } +}; + +var fact_of_3 = __func(3); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (fact_of_3 !== 6) { + $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A4_T1.js b/test/suite/ch13/13.0/S13_A4_T1.js new file mode 100644 index 000000000..119499e03 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A4_T1.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/S13_A4_T1.js + * @description Declaring a function that returns string + */ + +function __func(){return "zig-zig-sputnik";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func() !== "zig-zig-sputnik") { + $ERROR('#2: __func() === "zig-zig-sputnik". Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A4_T2.js b/test/suite/ch13/13.0/S13_A4_T2.js new file mode 100644 index 000000000..3a0f9616e --- /dev/null +++ b/test/suite/ch13/13.0/S13_A4_T2.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/S13_A4_T2.js + * @description Declaring a function that uses prefix increment operator within its "return" Expression + */ + +function __func(arg){return ++arg;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func(1) !== 2) { + $ERROR('#2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A4_T3.js b/test/suite/ch13/13.0/S13_A4_T3.js new file mode 100644 index 000000000..9ef426163 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A4_T3.js @@ -0,0 +1,28 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/S13_A4_T3.js + * @description Declaring a function that uses arithmetical operators within its "return" Expression + */ + +function __func(arg1, arg2, arg3){return arg1+=(arg2+=arg3);}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func(10, 20, 30) !== 60) { + $ERROR('#2: __func(10, 20, 30) === 60. Actual: __func(10,20,30) ==='+__func(10,20,30)); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A4_T4.js b/test/suite/ch13/13.0/S13_A4_T4.js new file mode 100644 index 000000000..e16e97b71 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A4_T4.js @@ -0,0 +1,46 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations + * + * @path ch13/S13_A4_T4.js + * @description Declaring a function that uses strings concatenaion opeator within its "return" Expression + */ + +function __func(){return arguments[0].name + " " + arguments[0].surname;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func({name:'fox', surname:'malder'}) !== "fox malder") { + $ERROR('#2: __func({name:\'fox\', surname:\'malder\'}) === "fox malder". Actual: __func({name:\'fox\', surname:\'malder\'}) ==='+__func({name:'fox', surname:'malder'})); +} +// +////////////////////////////////////////////////////////////////////////////// + +function func__(arg){return arg.name + " " + arg.surname;}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof func__ !== "function") { + $ERROR('#3: typeof func__ === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (func__({name:'john', surname:'lennon'}) !== "john lennon") { + $ERROR('#4: func__({name:\'john\', surname:\'lennon\'}) === "john lennon". Actual: __func({name:\'john\', surname:\'lennon\'}) ==='+__func({name:'john', surname:'lennon'})); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A6_T1.js b/test/suite/ch13/13.0/S13_A6_T1.js new file mode 100644 index 000000000..90c400d70 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A6_T1.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier + * + * @path ch13/S13_A6_T1.js + * @description Duplicating function declaration + */ + +function __func(){return 1}; + +var __store__func = __func; + +var __1 = __func(); + + function __func(){return 'A'}; + +var __A = __func(); + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__store__func !== __func) { + $ERROR('#1: __store__func === __func. Actual: __store__func ==='+__store__func); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__1 !== __A) { + $ERROR('#2: __1 === __A. Actual: __1 ==='+__1); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A6_T2.js b/test/suite/ch13/13.0/S13_A6_T2.js new file mode 100644 index 000000000..e20659136 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A6_T2.js @@ -0,0 +1,36 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier + * + * @path ch13/S13_A6_T2.js + * @description Calling a function before it is declared one more time + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + var __result = __func(); +} catch(e) { + $FAIL("#1: Function call can appears in the program before the FunctionDeclaration appears"); +} +if (__result !== "SECOND") { + $ERROR('#1.1: __result === "SECOND". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "FIRST";}; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +__result = __func(); +if (__result !== "SECOND") { + $ERROR('#2: __result === "SECOND". Actual: __result ==='+__result); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func(){return "SECOND";}; + diff --git a/test/suite/ch13/13.0/S13_A7_T1.js b/test/suite/ch13/13.0/S13_A7_T1.js new file mode 100644 index 000000000..774746512 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A7_T1.js @@ -0,0 +1,73 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/S13_A7_T1.js + * @description Using only SourceElements within the FunctionBody + */ + +function __func(){'ground control to major tom'}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (typeof __func !== "function") { + $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__2(){b}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (typeof __func__2 !== "function") { + $ERROR('#2: typeof __func__2 === "function". Actual: typeof __func__2 ==='+typeof __func__2); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__3(){1}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (typeof __func__3 !== "function") { + $ERROR('#3: typeof __func__3 === "function". Actual: typeof __func__3 ==='+typeof __func__3); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__4(){1+c}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +if (typeof __func__4 !== "function") { + $ERROR('#4: typeof __func__4 === "function". Actual: typeof __func__4 ==='+typeof __func__4); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__5(){inc(d)}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#5 +if (typeof __func__5 !== "function") { + $ERROR('#5: typeof __func__5 === "function". Actual: typeof __func__5 ==='+typeof __func__5); +} +// +////////////////////////////////////////////////////////////////////////////// + +function __func__6(){var \u0042 = 1;}; +////////////////////////////////////////////////////////////////////////////// +//CHECK#6 +if (typeof __func__6 !== "function") { + $ERROR('#6: typeof __func__6 === "function". Actual: typeof __func__6 ==='+typeof __func__6); +} +// +////////////////////////////////////////////////////////////////////////////// + +//function __func__7(){var \u003d = 1;}; +//////////////////////////////////////////////////////////////////////////////// +////CHECK#7 +//if (typeof __func__7 !== "function") { +// $ERROR('#7: The FunctionBody must be SourceElements'); +//} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A7_T2.js b/test/suite/ch13/13.0/S13_A7_T2.js new file mode 100644 index 000000000..c9be672b8 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A7_T2.js @@ -0,0 +1,49 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/S13_A7_T2.js + * @description Inserting elements that is different from SourceElements into the FunctionBody + */ + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +try{ + eval("function __func(){/ ABC}"); + $ERROR('#1: eval("function __func(){/ ABC}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#1.1: eval("function __func(){/ ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +try{ + eval("function __func(){&1}"); + $ERROR('#3: eval("function __func(){&1}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#3.1: eval("function __func(){&1}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#4 +try{ + eval("function __func(){# ABC}"); + $ERROR('#4: eval("function __func(){# ABC}") lead to throwing exception'); +} catch(e){ + if(!(e instanceof SyntaxError)){ + $ERROR('#4.1: eval("function __func(){# ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); + } +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A7_T3.js b/test/suite/ch13/13.0/S13_A7_T3.js new file mode 100644 index 000000000..ae10085e0 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A7_T3.js @@ -0,0 +1,13 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * The FunctionBody must be SourceElements + * + * @path ch13/S13_A7_T3.js + * @description Checking if execution of "function __func(){\A\B\C}" fails + * @negative + */ + +function __func(){\A\B\C}; + diff --git a/test/suite/ch13/13.0/S13_A8_T1.js b/test/suite/ch13/13.0/S13_A8_T1.js new file mode 100644 index 000000000..e5758cf60 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A8_T1.js @@ -0,0 +1,33 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments property of activation object contains real params to be passed + * + * @path ch13/S13_A8_T1.js + * @description Creating a function declared with "function __func(param1, param2, param3)" and using arguments.length property in order to perform the test + */ + + function __func(param1, param2, param3) { + return arguments.length; + } + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func('A') !== 1) { + $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func('A', 'B', 1, 2,__func) !== 5) { + $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); +} +// +////////////////////////////////////////////////////////////////////////////// + + + + diff --git a/test/suite/ch13/13.0/S13_A8_T2.js b/test/suite/ch13/13.0/S13_A8_T2.js new file mode 100644 index 000000000..b947c8054 --- /dev/null +++ b/test/suite/ch13/13.0/S13_A8_T2.js @@ -0,0 +1,38 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * Arguments property of activation object contains real params to be passed + * + * @path ch13/S13_A8_T2.js + * @description Creating a function with no parameters and using arguments.length property in order to perform the test + */ + + function __func() { + return arguments.length; + } + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func('A') !== 1) { + $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#2 +if (__func('A', 'B', 1, 2,__func) !== 5) { + $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); +} +// +////////////////////////////////////////////////////////////////////////////// + +////////////////////////////////////////////////////////////////////////////// +//CHECK#3 +if (__func() !== 0) { + $ERROR('#3: __func() === 0. Actual: __func() ==='+__func()); +} +// +////////////////////////////////////////////////////////////////////////////// + diff --git a/test/suite/ch13/13.0/S13_A9.js b/test/suite/ch13/13.0/S13_A9.js new file mode 100644 index 000000000..95848bc9d --- /dev/null +++ b/test/suite/ch13/13.0/S13_A9.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. + +/** + * Function can be passed as argument + * + * @path ch13/S13_A9.js + * @description Using function as argument of another function + */ + +function __func__INC(arg){return arg + 1;}; +function __func__MULT(incrementator, arg, mult){ return incrementator(arg)*mult; }; + +////////////////////////////////////////////////////////////////////////////// +//CHECK#1 +if (__func__MULT(__func__INC, 2, 2) !== 6) { + $ERROR('#1: function can be passed as argument'); +} +// +////////////////////////////////////////////////////////////////////////////// + + diff --git a/test/suite/ch13/S13_A1.js b/test/suite/ch13/S13_A1.js deleted file mode 100644 index fdd4e020f..000000000 --- a/test/suite/ch13/S13_A1.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * "x=function y(){}" statement does not store a reference to the new function in the varaible y(Identifier) - * - * @path ch13/S13_A1.js - * @description Checking the type of y - */ - -var __func = function __exp__func(){return 0;}; - -//////////////////////////////////////////////// -// ////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - - - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof __exp__func !== "undefined"){ - $ERROR('#2: typeof __exp__func === "undefined". Actual: typeof __exp__func ==='+typeof __exp__func); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A10.js b/test/suite/ch13/S13_A10.js deleted file mode 100644 index 99525bf52..000000000 --- a/test/suite/ch13/S13_A10.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function is a data - * - * @path ch13/S13_A10.js - * @description Using function as a property of an object - */ - -function __ziggy__func(){return "ziggy stardust"} - -var __music_box={}; - -__music_box.ziggy = __ziggy__func; - -////////////////////////////////////////////////////////////////////////////// -//CHECK# -if (typeof __music_box.ziggy !== "function") { - $ERROR('#1: typeof __music_box.ziggy === "function". Actual: typeof __music_box.ziggy ==='+typeof __music_box.ziggy); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__music_box.ziggy() !== "ziggy stardust") { - $ERROR('#2: __music_box.ziggy() === "ziggy stardust". Actual: __music_box.ziggy() ==='+__music_box.ziggy()); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A11_T1.js b/test/suite/ch13/S13_A11_T1.js deleted file mode 100644 index 4c082a712..000000000 --- a/test/suite/ch13/S13_A11_T1.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Since arguments property has attribute { DontDelete }, only its elements can be deleted - * - * @path ch13/S13_A11_T1.js - * @description Returning result of "delete arguments" - */ - -function __func(){ return delete arguments;} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func("A","B",1,2)) { - $ERROR('#1: arguments property has attribute { DontDelete }'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A11_T2.js b/test/suite/ch13/S13_A11_T2.js deleted file mode 100644 index d97dfe039..000000000 --- a/test/suite/ch13/S13_A11_T2.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Since arguments property has attribute { DontDelete }, only its elements can be deleted - * - * @path ch13/S13_A11_T2.js - * @description Checking if deleting the arguments property fails and then returning it - */ - -function __func(){ - delete arguments; - return arguments; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func("A","B",1,2) !== "object") { - $ERROR('#1: arguments property has attribute { DontDelete }'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A11_T3.js b/test/suite/ch13/S13_A11_T3.js deleted file mode 100644 index a6be104c7..000000000 --- a/test/suite/ch13/S13_A11_T3.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Since arguments property has attribute { DontDelete }, only its elements can be deleted - * - * @path ch13/S13_A11_T3.js - * @description Deleting arguments[i] and returning result of the operation - */ - -function __func(){ - was_del=false; - for (i=0; i < arguments.length; i++) - was_del= was_del || delete arguments[i]; - return was_del; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (!__func("A","B",1,2)) { - $ERROR('#1: Since arguments property has attribute { DontDelete } elements of arguments can be deleted'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A11_T4.js b/test/suite/ch13/S13_A11_T4.js deleted file mode 100644 index 009bf846f..000000000 --- a/test/suite/ch13/S13_A11_T4.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Since arguments property has attribute { DontDelete }, only its elements can be deleted - * - * @path ch13/S13_A11_T4.js - * @description Deleting arguments[i] and checking the type of arguments[i] - */ - -function __func(){ - is_undef=true; - for (i=0; i < arguments.length; i++) - { - delete arguments[i]; - is_undef= is_undef && (typeof arguments[i] === "undefined"); - }; - return is_undef; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (!__func("A","B",1,2)) { - $ERROR('#1: Since arguments property has attribute { DontDelete }, but elements of arguments can be deleted'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A12_T1.js b/test/suite/ch13/S13_A12_T1.js deleted file mode 100644 index caafdfc87..000000000 --- a/test/suite/ch13/S13_A12_T1.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function declarations in global or function scope are {DontDelete} - * - * @path ch13/S13_A12_T1.js - * @description Checking if deleting a function that is declared in global scope fails - */ - -ALIVE="Letov is alive" - -function __func(){ - return ALIVE; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (delete __func) { - $ERROR('#1: delete __func returning false'); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func() !== ALIVE) { - $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A12_T2.js b/test/suite/ch13/S13_A12_T2.js deleted file mode 100644 index 47f7d2152..000000000 --- a/test/suite/ch13/S13_A12_T2.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function declarations in global or function scope are {DontDelete} - * - * @path ch13/S13_A12_T2.js - * @description Checking if deleting a function that is declared in function scope fails - */ - -ALIVE="Letov is alive" - -function __cont(){ - - function __func(){ - return ALIVE; - }; - - ////////////////////////////////////////////////////////////////////////////// - //CHECK#1 - if (delete __func) { - $ERROR('#1: delete __func returning false'); - } - // - ////////////////////////////////////////////////////////////////////////////// - - ////////////////////////////////////////////////////////////////////////////// - //CHECK#2 - if (__func() !== ALIVE) { - $ERROR('#2: __func() === ALIVE. Actual: __func() ==='+__func()); - } - // - ////////////////////////////////////////////////////////////////////////////// -}; - -__cont(); - diff --git a/test/suite/ch13/S13_A13_T1.js b/test/suite/ch13/S13_A13_T1.js deleted file mode 100644 index dc4c3ba64..000000000 --- a/test/suite/ch13/S13_A13_T1.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Deleting arguments[i] leads to breaking the connection to local reference - * - * @path ch13/S13_A13_T1.js - * @description Deleting arguments[i] - */ - -function __func(__arg){ - delete arguments[0]; - if (arguments[0] !== undefined) { - $ERROR('#1.1: arguments[0] === undefined'); - } - return __arg; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(1) !== 1) { - $ERROR('#1.2: __func(1) === 1. Actual: __func(1) ==='+__func(1)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A13_T2.js b/test/suite/ch13/S13_A13_T2.js deleted file mode 100644 index 359eaf9f4..000000000 --- a/test/suite/ch13/S13_A13_T2.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Deleting arguments[i] leads to breaking the connection to local reference - * - * @path ch13/S13_A13_T2.js - * @description Changing arguments value and then deleting the argument - */ - -function __func(__arg){ - __arg = 2; - delete arguments[0]; - if (arguments[0] !== undefined) { - $ERROR('#1.1: arguments[0] === undefined'); - } - return __arg; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(1) !== 2) { - $ERROR('#1.2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A13_T3.js b/test/suite/ch13/S13_A13_T3.js deleted file mode 100644 index 84dd5ea1e..000000000 --- a/test/suite/ch13/S13_A13_T3.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Deleting arguments[i] leads to breaking the connection to local reference - * - * @path ch13/S13_A13_T3.js - * @description Changing argument value, deleting the argument and then defining a new value for arguments[i] - */ - -function __func(__arg){ - __arg = 2; - delete arguments[0]; - if (arguments[0] !== undefined) { - $ERROR('#1.1: arguments[0] === undefined'); - } - arguments[0] = "A"; - if (arguments[0] !== "A") { - $ERROR('#1.2: arguments[0] === "A"'); - } - return __arg; -} - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(1) !== 2) { - $ERROR('#1.3: __func(1) === 2. Actual: __func(1) ==='+__func(1)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A14.js b/test/suite/ch13/S13_A14.js deleted file mode 100644 index 31a63313b..000000000 --- a/test/suite/ch13/S13_A14.js +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Unicode symbols in function name are allowed - * - * @path ch13/S13_A14.js - * @description Defining function name with unicode symbols - */ - -eval("function __func\u0041(__arg){return __arg;};"); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __funcA !== "function") { - $ERROR('#1: unicode symbols in function name are allowed'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A15_T1.js b/test/suite/ch13/S13_A15_T1.js deleted file mode 100644 index c4862b38e..000000000 --- a/test/suite/ch13/S13_A15_T1.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * ''arguments'' variable overrides ActivationObject.arguments - * - * @path ch13/S13_A15_T1.js - * @description Declaring a function with "__func(arguments)" - */ - -function __func(arguments){ - return arguments; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(42) !== 42) { - $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A15_T2.js b/test/suite/ch13/S13_A15_T2.js deleted file mode 100644 index ec82748be..000000000 --- a/test/suite/ch13/S13_A15_T2.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * ''arguments'' variable overrides ActivationObject.arguments - * - * @path ch13/S13_A15_T2.js - * @description Overriding arguments within functions body - */ - -THE_ANSWER="Answer to Life, the Universe, and Everything"; - -function __func(){ - var arguments = THE_ANSWER; - return arguments; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(42,42,42) !== THE_ANSWER) { - $ERROR('#1: "arguments" variable overrides ActivationObject.arguments'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A15_T3.js b/test/suite/ch13/S13_A15_T3.js deleted file mode 100644 index ef625d881..000000000 --- a/test/suite/ch13/S13_A15_T3.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * ''arguments'' variable overrides ActivationObject.arguments - * - * @path ch13/S13_A15_T3.js - * @description Declaring a variable named with "arguments" without a function - */ - -THE_ANSWER="Answer to Life, the Universe, and Everything"; - -var arguments = THE_ANSWER; - -function __func(arguments){ - return arguments; - -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func() !== "undefined") { - $ERROR('#1: typeof __func() === "undefined". Actual: typeof __func() ==='+typeof __func()); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func("The Ultimate Question") !== "The Ultimate Question") { - $ERROR('#2: __func("The Ultimate Question") === "The Ultimate Question". Actual: __func("The Ultimate Question")==='+__func("The Ultimate Question")); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A15_T4.js b/test/suite/ch13/S13_A15_T4.js deleted file mode 100644 index e33c5ca14..000000000 --- a/test/suite/ch13/S13_A15_T4.js +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * ''arguments'' variable overrides ActivationObject.arguments - * - * @path ch13/S13_A15_T4.js - * @description Declaring a variable named with "arguments" and following a "return" statement within a function body - */ - -THE_ANSWER="Answer to Life, the Universe, and Everything"; - -function __func(){ - return typeof arguments; - var arguments = THE_ANSWER; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func(42,42,42) !== "object") { - $ERROR('#1: __func(42,42,42) === "object". Actual: __func(42,42,42)==='+__func(42,42,42)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A15_T5.js b/test/suite/ch13/S13_A15_T5.js deleted file mode 100644 index 3ea179277..000000000 --- a/test/suite/ch13/S13_A15_T5.js +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * ''arguments'' variable overrides ActivationObject.arguments - * - * @path ch13/S13_A15_T5.js - * @description Creating a variable named with "arguments" without a function - */ - -THE_ANSWER="Answer to Life, the Universe, and Everything"; - -var arguments = THE_ANSWER; - -function __func(){ - return arguments; -}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if ( __func() === THE_ANSWER) { - $ERROR('#1: __func() !== THE_ANSWER'); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func("The Ultimate Question") === "The Ultimate Question") { - $ERROR('#2: __func("The Ultimate Question") !== "The Ultimate Question"'); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A16.js b/test/suite/ch13/S13_A16.js deleted file mode 100644 index 6d2e9cec5..000000000 --- a/test/suite/ch13/S13_A16.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Any separators are admitted between declaration chunks - * - * @path ch13/S13_A16.js - * @description Inserting separators between declaration chunks - */ - -function -x -( -) -{ -} -; - -x(); - -function y ( ) {}; - -y(); - -function - -z - -( - -) - -{ - -} - -; - -z(); - -eval("function\u0009\u2029w(\u000C)\u00A0{\u000D};"); - -w(); - diff --git a/test/suite/ch13/S13_A17_T1.js b/test/suite/ch13/S13_A17_T1.js deleted file mode 100644 index 935c419c9..000000000 --- a/test/suite/ch13/S13_A17_T1.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function call cannot appear in the program before the FunctionExpression appears - * - * @path ch13/S13_A17_T1.js - * @description Trying to call a function before the FunctionExpression appears - */ - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -try{ - var __result = __func(); - $FAIL("#1.1: var __result = __func() lead to throwing exception"); -} catch(e) { - if ((e instanceof TypeError) !== true) { - $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); - } -} -// -////////////////////////////////////////////////////////////////////////////// - -var __func = function (){return "ONE";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -var __result = __func(); -if (__result !== "ONE") { - $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - -__func = function (){return "TWO";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -var __result = __func(); -if (__result !== "TWO") { - $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A17_T2.js b/test/suite/ch13/S13_A17_T2.js deleted file mode 100644 index b3224d851..000000000 --- a/test/suite/ch13/S13_A17_T2.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function call cannot appear in the program before the FunctionExpression appears - * - * @path ch13/S13_A17_T2.js - * @description Trying to call a function before the FunctionExpression appears and then using the FunctionExpression one more time - */ - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -try{ - var __result = __func(); - $ERROR("#1: var __result = __func() lead to throwing exception"); -} catch(e) { - if ((e instanceof TypeError) !== true) { - $ERROR('#1.2: func should throw a TypeError Actual: ' + (e)); - } -} -// -////////////////////////////////////////////////////////////////////////////// - -// now we reach the __func overwriting by new expression -var __func = function __func(){return "ONE";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -var __result = __func(); -if (__result !== "ONE") { - $ERROR('#2: __result === "ONE". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - -__func = function __func(){return "TWO";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -var __result = __func(); -if (__result !== "TWO") { - $ERROR('#3: __result === "TWO". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A18.js b/test/suite/ch13/S13_A18.js deleted file mode 100644 index 1b4057d7b..000000000 --- a/test/suite/ch13/S13_A18.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Closures are admitted - * - * @path ch13/S13_A18.js - * @description Using a function declaration as a function parameter - */ - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof sinx !== 'undefined') { - $ERROR('#1: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); -} -// -////////////////////////////////////////////////////////////////////////////// - -var __val = function derivative(f, dx) { - return function(x) { - return (f(x + dx) - f(x)) / dx; - }; -}(function sinx(x){return Math.sin(x);},.0001)(0.5); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof sinx !== 'undefined') { - $ERROR('#2: typeof sinx === \'undefined\'. Actual: typeof sinx ==='+typeof sinx); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A19_T1.js b/test/suite/ch13/S13_A19_T1.js deleted file mode 100644 index 06c68ba7d..000000000 --- a/test/suite/ch13/S13_A19_T1.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * "var" does not override function declaration - * - * @path ch13/S13_A19_T1.js - * @description Creating a function and a variable with identical Identifiers in global scope - */ - -// since "var" does not override function declaration __decl is set to function -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __decl !== "function") { - $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); -} -// -////////////////////////////////////////////////////////////////////////////// - -var __decl = 1; - -//since statement was evaluted __decl turns to 1 from function -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__decl !== 1) { - $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __decl(){return 1;} - diff --git a/test/suite/ch13/S13_A19_T2.js b/test/suite/ch13/S13_A19_T2.js deleted file mode 100644 index fdc1b7619..000000000 --- a/test/suite/ch13/S13_A19_T2.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * "var" does not override function declaration - * - * @path ch13/S13_A19_T2.js - * @description Creating a function and a variable with identical Identifiers within function scope - */ - -(function (){ - - // since "var" does not override function declaration __decl is set to function - ////////////////////////////////////////////////////////////////////////////// - //CHECK#1 - if (typeof __decl !== "function") { - $ERROR('#1: typeof __decl === "function". Actual: typeof __decl ==='+typeof __decl); - } - // - ////////////////////////////////////////////////////////////////////////////// - - var __decl = 1; - - //since statement was evaluted __decl turns to 1 from function - ////////////////////////////////////////////////////////////////////////////// - //CHECK#2 - if (__decl !== 1) { - $ERROR('#2: __decl === 1. Actual: __decl ==='+__decl); - } - // - ////////////////////////////////////////////////////////////////////////////// - - function __decl(){return 1;} -})(); - diff --git a/test/suite/ch13/S13_A2_T1.js b/test/suite/ch13/S13_A2_T1.js deleted file mode 100644 index 4a08e96c5..000000000 --- a/test/suite/ch13/S13_A2_T1.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * function must be evaluated inside the expression - * - * @path ch13/S13_A2_T1.js - * @description Defining function body with "return arg" - */ - -var x = (function __func(arg){return arg})(1); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (x !== 1) { - $ERROR('#1: x === 1. Actual: x ==='+x); -} - -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof __func !== 'undefined') { - $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A2_T2.js b/test/suite/ch13/S13_A2_T2.js deleted file mode 100644 index 3d84a168e..000000000 --- a/test/suite/ch13/S13_A2_T2.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * function must be evaluated inside the expression - * - * @path ch13/S13_A2_T2.js - * @description Defining function body with "return arg + arguments[1]" - */ - -var x = (function __func(arg){return arg + arguments[1]})(1,"1"); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (x !== "11") { - $ERROR('#1: x === "11". Actual: x ==='+x); -} - -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof __func !== 'undefined') { - $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A2_T3.js b/test/suite/ch13/S13_A2_T3.js deleted file mode 100644 index 7255ab039..000000000 --- a/test/suite/ch13/S13_A2_T3.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * function must be evaluated inside the expression - * - * @path ch13/S13_A2_T3.js - * @description Defining function body with "return arguments[0] +"-"+ arguments[1]" - */ - -var x = (function __func(){return arguments[0] +"-"+ arguments[1]})("Obi","Wan"); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (x !== "Obi-Wan") { - $ERROR('#1: x === "Obi-Wan". Actual: x ==='+x); -} - -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof __func !== 'undefined') { - $ERROR('#2: typeof __func === \'undefined\'. Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A3_T1.js b/test/suite/ch13/S13_A3_T1.js deleted file mode 100644 index 7b4d3df15..000000000 --- a/test/suite/ch13/S13_A3_T1.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively - * - * @path ch13/S13_A3_T1.js - * @description Creating a recursive function that calculates factorial, as a variable. - * Function call itself by it`s name - */ - -var __func = function __exp__func(arg){ - if (arg === 1) { - return arg; - } else { - return __exp__func(arg-1)*arg; - } -}; - -var fact_of_3 = __func(3); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (fact_of_3 !== 6) { - $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A3_T2.js b/test/suite/ch13/S13_A3_T2.js deleted file mode 100644 index 51f35cc67..000000000 --- a/test/suite/ch13/S13_A3_T2.js +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively - * - * @path ch13/S13_A3_T2.js - * @description Creating a recursive function that calculates factorial, as a variable. - * Function calls itself by the name of the variable - */ - -var __func = function (arg){ - if (arg === 1) { - return arg; - } else { - return __func(arg-1)*arg; - } -}; - -var fact_of_3 = __func(3); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (fact_of_3 !== 6) { - $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A3_T3.js b/test/suite/ch13/S13_A3_T3.js deleted file mode 100644 index 4c5b4b60d..000000000 --- a/test/suite/ch13/S13_A3_T3.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The Identifier in a FunctionExpression can be referenced from inside the FunctionExpression's FunctionBody to allow the function calling itself recursively - * - * @path ch13/S13_A3_T3.js - * @description Creating simple recursive function that calculates factorial - */ - -function __func(arg){ - if (arg === 1) { - return arg; - } else { - return __func(arg-1)*arg; - } -}; - -var fact_of_3 = __func(3); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (fact_of_3 !== 6) { - $ERROR("#1: fact_of_3 === 6. Actual: fact_of_3 ==="+fact_of_3); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A4_T1.js b/test/suite/ch13/S13_A4_T1.js deleted file mode 100644 index 119499e03..000000000 --- a/test/suite/ch13/S13_A4_T1.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations - * - * @path ch13/S13_A4_T1.js - * @description Declaring a function that returns string - */ - -function __func(){return "zig-zig-sputnik";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func() !== "zig-zig-sputnik") { - $ERROR('#2: __func() === "zig-zig-sputnik". Actual: __func() ==='+__func()); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A4_T2.js b/test/suite/ch13/S13_A4_T2.js deleted file mode 100644 index 3a0f9616e..000000000 --- a/test/suite/ch13/S13_A4_T2.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations - * - * @path ch13/S13_A4_T2.js - * @description Declaring a function that uses prefix increment operator within its "return" Expression - */ - -function __func(arg){return ++arg;}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func(1) !== 2) { - $ERROR('#2: __func(1) === 2. Actual: __func(1) ==='+__func(1)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A4_T3.js b/test/suite/ch13/S13_A4_T3.js deleted file mode 100644 index 9ef426163..000000000 --- a/test/suite/ch13/S13_A4_T3.js +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations - * - * @path ch13/S13_A4_T3.js - * @description Declaring a function that uses arithmetical operators within its "return" Expression - */ - -function __func(arg1, arg2, arg3){return arg1+=(arg2+=arg3);}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func(10, 20, 30) !== 60) { - $ERROR('#2: __func(10, 20, 30) === 60. Actual: __func(10,20,30) ==='+__func(10,20,30)); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A4_T4.js b/test/suite/ch13/S13_A4_T4.js deleted file mode 100644 index e16e97b71..000000000 --- a/test/suite/ch13/S13_A4_T4.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The production FunctionDeclaration: "function Identifier ( FormalParameterList_opt ) { FunctionBody }" is processed by function declarations - * - * @path ch13/S13_A4_T4.js - * @description Declaring a function that uses strings concatenaion opeator within its "return" Expression - */ - -function __func(){return arguments[0].name + " " + arguments[0].surname;}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func({name:'fox', surname:'malder'}) !== "fox malder") { - $ERROR('#2: __func({name:\'fox\', surname:\'malder\'}) === "fox malder". Actual: __func({name:\'fox\', surname:\'malder\'}) ==='+__func({name:'fox', surname:'malder'})); -} -// -////////////////////////////////////////////////////////////////////////////// - -function func__(arg){return arg.name + " " + arg.surname;}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (typeof func__ !== "function") { - $ERROR('#3: typeof func__ === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#4 -if (func__({name:'john', surname:'lennon'}) !== "john lennon") { - $ERROR('#4: func__({name:\'john\', surname:\'lennon\'}) === "john lennon". Actual: __func({name:\'john\', surname:\'lennon\'}) ==='+__func({name:'john', surname:'lennon'})); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A6_T1.js b/test/suite/ch13/S13_A6_T1.js deleted file mode 100644 index 90c400d70..000000000 --- a/test/suite/ch13/S13_A6_T1.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier - * - * @path ch13/S13_A6_T1.js - * @description Duplicating function declaration - */ - -function __func(){return 1}; - -var __store__func = __func; - -var __1 = __func(); - - function __func(){return 'A'}; - -var __A = __func(); - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__store__func !== __func) { - $ERROR('#1: __store__func === __func. Actual: __store__func ==='+__store__func); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__1 !== __A) { - $ERROR('#2: __1 === __A. Actual: __1 ==='+__1); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A6_T2.js b/test/suite/ch13/S13_A6_T2.js deleted file mode 100644 index e20659136..000000000 --- a/test/suite/ch13/S13_A6_T2.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * FunctionDeclaration can be overrided by other FunctionDeclaration with the same Identifier - * - * @path ch13/S13_A6_T2.js - * @description Calling a function before it is declared one more time - */ - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -try{ - var __result = __func(); -} catch(e) { - $FAIL("#1: Function call can appears in the program before the FunctionDeclaration appears"); -} -if (__result !== "SECOND") { - $ERROR('#1.1: __result === "SECOND". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func(){return "FIRST";}; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -__result = __func(); -if (__result !== "SECOND") { - $ERROR('#2: __result === "SECOND". Actual: __result ==='+__result); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func(){return "SECOND";}; - diff --git a/test/suite/ch13/S13_A7_T1.js b/test/suite/ch13/S13_A7_T1.js deleted file mode 100644 index 774746512..000000000 --- a/test/suite/ch13/S13_A7_T1.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The FunctionBody must be SourceElements - * - * @path ch13/S13_A7_T1.js - * @description Using only SourceElements within the FunctionBody - */ - -function __func(){'ground control to major tom'}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (typeof __func !== "function") { - $ERROR('#1: typeof __func === "function". Actual: typeof __func ==='+typeof __func); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func__2(){b}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (typeof __func__2 !== "function") { - $ERROR('#2: typeof __func__2 === "function". Actual: typeof __func__2 ==='+typeof __func__2); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func__3(){1}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (typeof __func__3 !== "function") { - $ERROR('#3: typeof __func__3 === "function". Actual: typeof __func__3 ==='+typeof __func__3); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func__4(){1+c}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#4 -if (typeof __func__4 !== "function") { - $ERROR('#4: typeof __func__4 === "function". Actual: typeof __func__4 ==='+typeof __func__4); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func__5(){inc(d)}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#5 -if (typeof __func__5 !== "function") { - $ERROR('#5: typeof __func__5 === "function". Actual: typeof __func__5 ==='+typeof __func__5); -} -// -////////////////////////////////////////////////////////////////////////////// - -function __func__6(){var \u0042 = 1;}; -////////////////////////////////////////////////////////////////////////////// -//CHECK#6 -if (typeof __func__6 !== "function") { - $ERROR('#6: typeof __func__6 === "function". Actual: typeof __func__6 ==='+typeof __func__6); -} -// -////////////////////////////////////////////////////////////////////////////// - -//function __func__7(){var \u003d = 1;}; -//////////////////////////////////////////////////////////////////////////////// -////CHECK#7 -//if (typeof __func__7 !== "function") { -// $ERROR('#7: The FunctionBody must be SourceElements'); -//} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A7_T2.js b/test/suite/ch13/S13_A7_T2.js deleted file mode 100644 index c9be672b8..000000000 --- a/test/suite/ch13/S13_A7_T2.js +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The FunctionBody must be SourceElements - * - * @path ch13/S13_A7_T2.js - * @description Inserting elements that is different from SourceElements into the FunctionBody - */ - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -try{ - eval("function __func(){/ ABC}"); - $ERROR('#1: eval("function __func(){/ ABC}") lead to throwing exception'); -} catch(e){ - if(!(e instanceof SyntaxError)){ - $ERROR('#1.1: eval("function __func(){/ ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); - } -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -try{ - eval("function __func(){&1}"); - $ERROR('#3: eval("function __func(){&1}") lead to throwing exception'); -} catch(e){ - if(!(e instanceof SyntaxError)){ - $ERROR('#3.1: eval("function __func(){&1}") lead to throwing exception of SyntaxError. Actual: exception is '+e); - } -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#4 -try{ - eval("function __func(){# ABC}"); - $ERROR('#4: eval("function __func(){# ABC}") lead to throwing exception'); -} catch(e){ - if(!(e instanceof SyntaxError)){ - $ERROR('#4.1: eval("function __func(){# ABC}") lead to throwing exception of SyntaxError. Actual: exception is '+e); - } -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A7_T3.js b/test/suite/ch13/S13_A7_T3.js deleted file mode 100644 index ae10085e0..000000000 --- a/test/suite/ch13/S13_A7_T3.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * The FunctionBody must be SourceElements - * - * @path ch13/S13_A7_T3.js - * @description Checking if execution of "function __func(){\A\B\C}" fails - * @negative - */ - -function __func(){\A\B\C}; - diff --git a/test/suite/ch13/S13_A8_T1.js b/test/suite/ch13/S13_A8_T1.js deleted file mode 100644 index e5758cf60..000000000 --- a/test/suite/ch13/S13_A8_T1.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Arguments property of activation object contains real params to be passed - * - * @path ch13/S13_A8_T1.js - * @description Creating a function declared with "function __func(param1, param2, param3)" and using arguments.length property in order to perform the test - */ - - function __func(param1, param2, param3) { - return arguments.length; - } - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func('A') !== 1) { - $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func('A', 'B', 1, 2,__func) !== 5) { - $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); -} -// -////////////////////////////////////////////////////////////////////////////// - - - - diff --git a/test/suite/ch13/S13_A8_T2.js b/test/suite/ch13/S13_A8_T2.js deleted file mode 100644 index b947c8054..000000000 --- a/test/suite/ch13/S13_A8_T2.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Arguments property of activation object contains real params to be passed - * - * @path ch13/S13_A8_T2.js - * @description Creating a function with no parameters and using arguments.length property in order to perform the test - */ - - function __func() { - return arguments.length; - } - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func('A') !== 1) { - $ERROR('#1: __func(\'A\') === 1. Actual: __func(\'A\') ==='+__func('A')); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#2 -if (__func('A', 'B', 1, 2,__func) !== 5) { - $ERROR('#2: __func(\'A\', \'B\', 1, 2,__func) === 5. Actual: __func(\'A\', \'B\', 1, 2,__func) ==='+__func('A', 'B', 1, 2,__func)); -} -// -////////////////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////////////// -//CHECK#3 -if (__func() !== 0) { - $ERROR('#3: __func() === 0. Actual: __func() ==='+__func()); -} -// -////////////////////////////////////////////////////////////////////////////// - diff --git a/test/suite/ch13/S13_A9.js b/test/suite/ch13/S13_A9.js deleted file mode 100644 index 95848bc9d..000000000 --- a/test/suite/ch13/S13_A9.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 the Sputnik authors. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/** - * Function can be passed as argument - * - * @path ch13/S13_A9.js - * @description Using function as argument of another function - */ - -function __func__INC(arg){return arg + 1;}; -function __func__MULT(incrementator, arg, mult){ return incrementator(arg)*mult; }; - -////////////////////////////////////////////////////////////////////////////// -//CHECK#1 -if (__func__MULT(__func__INC, 2, 2) !== 6) { - $ERROR('#1: function can be passed as argument'); -} -// -////////////////////////////////////////////////////////////////////////////// - - diff --git a/test/suite/ch14/14.0/S14_A1.js b/test/suite/ch14/14.0/S14_A1.js new file mode 100644 index 000000000..f8ae88e0a --- /dev/null +++ b/test/suite/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/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/test/suite/ch14/14.0/S14_A2.js b/test/suite/ch14/14.0/S14_A2.js new file mode 100644 index 000000000..1329e7e1b --- /dev/null +++ b/test/suite/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/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/test/suite/ch14/14.0/S14_A3.js b/test/suite/ch14/14.0/S14_A3.js new file mode 100644 index 000000000..821d944d9 --- /dev/null +++ b/test/suite/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/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/test/suite/ch14/14.0/S14_A5_T1.js b/test/suite/ch14/14.0/S14_A5_T1.js new file mode 100644 index 000000000..20e16e924 --- /dev/null +++ b/test/suite/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/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/test/suite/ch14/14.0/S14_A5_T2.js b/test/suite/ch14/14.0/S14_A5_T2.js new file mode 100644 index 000000000..8e99a2ba8 --- /dev/null +++ b/test/suite/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/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/test/suite/ch14/S14_A1.js b/test/suite/ch14/S14_A1.js deleted file mode 100644 index f8ae88e0a..000000000 --- a/test/suite/ch14/S14_A1.js +++ /dev/null @@ -1,35 +0,0 @@ -// 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/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/test/suite/ch14/S14_A2.js b/test/suite/ch14/S14_A2.js deleted file mode 100644 index 1329e7e1b..000000000 --- a/test/suite/ch14/S14_A2.js +++ /dev/null @@ -1,31 +0,0 @@ -// 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/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/test/suite/ch14/S14_A3.js b/test/suite/ch14/S14_A3.js deleted file mode 100644 index 821d944d9..000000000 --- a/test/suite/ch14/S14_A3.js +++ /dev/null @@ -1,30 +0,0 @@ -// 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/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/test/suite/ch14/S14_A5_T1.js b/test/suite/ch14/S14_A5_T1.js deleted file mode 100644 index 20e16e924..000000000 --- a/test/suite/ch14/S14_A5_T1.js +++ /dev/null @@ -1,22 +0,0 @@ -// 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/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/test/suite/ch14/S14_A5_T2.js b/test/suite/ch14/S14_A5_T2.js deleted file mode 100644 index 8e99a2ba8..000000000 --- a/test/suite/ch14/S14_A5_T2.js +++ /dev/null @@ -1,21 +0,0 @@ -// 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/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 - -- cgit v1.2.3