diff options
Diffstat (limited to 'external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects')
209 files changed, 4913 insertions, 0 deletions
diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T1.js new file mode 100644 index 000000000..4682d0e3b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T1.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. + +/** +* @name: S15.3.2.1_A1_T1; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: The body of the function is "{toString:function(){throw 7;}}"; +*/ + +var body = {toString:function(){throw 7;}} + +//CHECK#1 +try { + var f = new Function(body); + $FAIL('#1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)'); +} catch (e) { + if (e !== 7) { + $ERROR('#1.1: When the Function constructor is called with one argument then body be that argument the following step are taken: call ToString(body)'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T10.js new file mode 100644 index 000000000..b4080a6eb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T10.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. + +/** +* @name: S15.3.2.1_A1_T10; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "null"; +*/ + +//CHECK#1 +try { + var f = new Function(null); +} catch (e) { + $FAIL('#1: test fails with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f() !== undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T11.js new file mode 100644 index 000000000..5c5e152fc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T11.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. + +/** +* @name: S15.3.2.1_A1_T11; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "undefined"; +*/ + + +//CHECK#1 +try { + var f = new Function(undefined); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f() !== undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T12.js new file mode 100644 index 000000000..ae41df581 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T12.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. + +/** +* @name: S15.3.2.1_A1_T12; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "void 0"; +*/ + + +//CHECK#1 +try { + var f = new Function(void 0); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T13.js new file mode 100644 index 000000000..49bf7910b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T13.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. + +/** +* @name: S15.3.2.1_A1_T13; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "{}"; +*/ + + +//CHECK#1 +try { + var f = new Function({}); + $FAIL('#1: test failed with error '+e); +} catch (e) { + if (!(e instanceof SyntaxError)) { + $ERROR('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T2.js new file mode 100644 index 000000000..48113c840 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T2.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. + +/** +* @name: S15.3.2.1_A1_T2; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: The body of the function is "{toString:function(){return "return 1;";}}"; +*/ + +var body={toString:function(){return "return 1;";}}; + +//CHECK#1 +try { + var f = new Function(body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==1) { + $ERROR('#3: hen the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T3.js new file mode 100644 index 000000000..b1a789489 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T3.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. + +/** +* @name: S15.3.2.1_A1_T3; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is 1; +*/ + + +//CHECK#1 +try { + var f = new Function(1); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T4.js new file mode 100644 index 000000000..869b6e4bb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T4.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. + +/** +* @name: S15.3.2.1_A1_T4; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is x, where x is specified with "undefined"; +*/ + + +//CHECK#1 +try { + var f = new Function(x); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} + +var x; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T5.js new file mode 100644 index 000000000..1750357df --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_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. + +/** +* @name: S15.3.2.1_A1_T5; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "Object("return \'A\'")"; +*/ + +var body = Object("return \'A\'"); + +//CHECK#1 +try { + var f = new Function(body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!=="\u0041") { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T6.js new file mode 100644 index 000000000..5d8c69356 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T6.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. + +/** +* @name: S15.3.2.1_A1_T6; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is the string "return true;"; +*/ + +//CHECK#1 +try { + var f = new Function("return true;"); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (!(f())) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T7.js new file mode 100644 index 000000000..f5273bf3f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T7.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. + +/** +* @name: S15.3.2.1_A1_T7; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "Object(1)"; +*/ + +var body = new Object(1); + +//CHECK#1 +try { + var f = new Function(body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T8.js new file mode 100644 index 000000000..aaad81f9e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T8.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. + +/** +* @name: S15.3.2.1_A1_T8; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "var 1=1;"; +*/ + +var body = "var 1=1;"; + +//CHECK#1 +try { + var f = new Function(body); + $FAIL('#1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); +} catch (e) { + if (!(e instanceof SyntaxError)) { + $ERROR('#1.1: If body is not parsable as FunctionBody then throw a SyntaxError exception'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T9.js new file mode 100644 index 000000000..2484d2d13 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A1_T9.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. + +/** +* @name: S15.3.2.1_A1_T9; +* @section: 15.3.2.1; +* @assertion: When the Function constructor is called with one argument then body be that argument and the following steps are taken: +* i) Call ToString(body) +* ii) If P is not parsable as a FormalParameterListopt then throw a SyntaxError exception +* iii) If body is not parsable as FunctionBody then throw a SyntaxError exception +* iv) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody. +* Pass in a scope chain consisting of the global object as the Scope parameter +* v) Return Result(iv); +* @description: Value of the function constructor argument is "return arguments[0];"; +*/ + +var f = new Function("return arguments[0];"); + +//CHECK#1 +if (!(f instanceof Function)) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument and the following steps are taken...'); +} + +//CHECK#2 +if (f("A") !== "A") { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T1.js new file mode 100644 index 000000000..f626e04e3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_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. + +/** +* @name: S15.3.2.1_A2_T1; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "arg1", "arg2", "arg3", "return arg1+arg2+arg3;"; +*/ + +//CHECK#1 +try { + var f = Function("arg1", "arg2", "arg3", "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f(1,2,3) !== 6) { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T2.js new file mode 100644 index 000000000..a657905e9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T2.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. + +/** +* @name: S15.3.2.1_A2_T2; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "arg1, arg2", "arg3", "return arg1+arg2+arg3;"; +*/ + +//CHECK#1 +try { + var f = Function("arg1, arg2", "arg3", "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f("AB","BA",1) !== "ABBA1") { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T3.js new file mode 100644 index 000000000..b604361f6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T3.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. + +/** +* @name: S15.3.2.1_A2_T3; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "arg1, arg2, arg3", "return arg1+arg2+arg3;"; +*/ + +//CHECK#1 +try { + var f = Function("arg1, arg2, arg3", "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f(1,1,"ABBA") !== "2ABBA") { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T4.js new file mode 100644 index 000000000..a8ca5309c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T4.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. + +/** +* @name: S15.3.2.1_A2_T4; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "return"-s of various results; +*/ + +var i=0; + +var p={toString:function(){return "arg"+(++i);}}; + +//CHECK#1 +try { + var f = Function(p, p, p, "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f(4,"2","QUESTION") !== "42QUESTION") { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} +
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T5.js new file mode 100644 index 000000000..0cd819ee0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T5.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. + +/** +* @name: S15.3.2.1_A2_T5; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "return"-s of various results and a concotenation of strings; +*/ + +var i=0; + +var p={toString:function(){return "arg"+(++i)}}; + +//CHECK#1 +try { + var f = Function(p+","+p,p, "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f("",1,2) !== "12") { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T6.js new file mode 100644 index 000000000..fa39274b3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A2_T6.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. + +/** +* @name: S15.3.2.1_A2_T6; +* @section: 15.3.2.1; +* @assertion: It is permissible but not necessary to have one argument for each formal parameter to be specified; +* @description: Values of the function constructor arguments are "return"-s of various results and a concotenation of strings; +*/ + +var i=0; + +var p={toString:function(){return "arg"+(++i)}}; + +//CHECK#1 +try { + var f = Function(p+","+p+","+p, "return arg1+arg2+arg3;"); +} catch (e) { + $FAIL('#1: test failed'); +} + +//CHECK#2 +if (!(f instanceof Function)){ + $ERROR('#2: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} + +//CHECK#3 +if (f("",1,p) !== "1arg4") { + $ERROR('#3: It is permissible but not necessary to have one argument for each formal parameter to be specified'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T1.js new file mode 100644 index 000000000..10a7da8fe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_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. + +/** +* @name: S15.3.2.1_A3_T1; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "{toString:function(){throw 1;}}" and "{toString:function(){throw 'body';}}"; +*/ + +var p = {toString:function(){throw 1;}}; +var body = {toString:function(){throw "body";}}; + +//CHECK#1 +try { + var f = new Function(p,body); + $FAIL('#1: test failed'); +} catch (e) { + if (e !== 1) { + $ERROR('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); + } +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T10.js new file mode 100644 index 000000000..ef3a5d903 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T10.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. + +/** +* @name: S15.3.2.1_A3_T10; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "{toString:function(){return "z;x"}}" and "return this;"; +*/ + +var body = "return this;"; +var p={toString:function(){return "z;x"}}; + +//CHECK#1 +try { + var f = new Function(p,body); + $FAIL('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); +} catch (e) { + if (!(e instanceof SyntaxError)) { + $ERROR('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T11.js new file mode 100644 index 000000000..8b02b7d3a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T11.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. + +/** +* @name: S15.3.2.1_A3_T11; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "a,b,c" and "void 0"; +*/ + +var p = "a,b,c"; + +//CHECK#1 +try { + var f = new Function(p, void 0); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T12.js new file mode 100644 index 000000000..8c934eb61 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T12.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. + +/** +* @name: S15.3.2.1_A3_T12; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "a,b,c" and "undefined"; +*/ + +var p = "a,b,c"; + +//CHECK#1 +try { + var f = new Function(p, undefined); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T13.js new file mode 100644 index 000000000..d479742bf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T13.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. + +/** +* @name: S15.3.2.1_A3_T13; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "a,b,c" and "null"; +*/ + +var p = "a,b,c"; + +//CHECK#1 +try { + var f = new Function(p, null); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T14.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T14.js new file mode 100644 index 000000000..813d1c2c4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T14.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. + +/** +* @name: S15.3.2.1_A3_T14; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "a,b,c" and an undefined variable; +*/ + +var p = "a,b,c"; + +//CHECK#1 +try { + var f = new Function(p, body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); +} + +var body; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T15.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T15.js new file mode 100644 index 000000000..9a7ba015c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T15.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. + +/** +* @name: S15.3.2.1_A3_T15; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are are two empty strings; +*/ + +//CHECK#1 +try { + var f = new Function("", ""); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==undefined) { + $ERROR('#3: When the Function constructor is called with arguments p, body the following steps are taken...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T2.js new file mode 100644 index 000000000..f91148cfa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T2.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.2.1_A3_T2; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "{toString:function(){return 'a';}}" and "return a;"; +*/ + +var p = {toString:function(){return "a";}}; +var body = "return a;"; + +//CHECK#1 +try { + var f = new Function(p,body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f(42)!==42) { + $ERROR('#3: When the Function constructor is called with arguments p, body creates a new Function object as specified in 13.2'); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T3.js new file mode 100644 index 000000000..53609833b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T3.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. + +/** +* @name: S15.3.2.1_A3_T3; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "{toString:function(){p=1;return "a";}}" and "{toString:function(){throw "body";}}"; +*/ + +var p = {toString:function(){p=1;return "a";}}; +var body = {toString:function(){throw "body";}}; + +//CHECK#1 +try { + var f = new Function(p,body); + $FAIL('#1: test failed'); +} catch (e) { + if (e !== "body") { + $ERROR('#1.1: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); + } +} + +//CHECK#2 +if (p !== 1) { + $ERROR('#2: i) Let Result(i) be the first argument; ii) Let P be ToString(Result(i))'); +} + + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T4.js new file mode 100644 index 000000000..3db3e5008 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T4.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. + +/** +* @name: S15.3.2.1_A3_T4; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are an undefined variable and "return 1.1;"; +*/ + +var body = "return 1.1;"; + +//CHECK#1 +try { + var f = new Function(p,body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==1.1) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} + +var p;
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T5.js new file mode 100644 index 000000000..e81e97a4d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T5.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.2.1_A3_T5; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "void 0" and "return \"A\";"; +*/ + + +var body = "return \"A\";"; + +//CHECK#1 +try { + var f = new Function(void 0,body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!=='\u0041') { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T6.js new file mode 100644 index 000000000..6a8189d30 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T6.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. + +/** +* @name: S15.3.2.1_A3_T6; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "null" and "return true;"; +*/ + + +var body = "return true;"; + +//CHECK#1 +try { + var f = new Function(null,body); + $FAIL('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); +} catch (e) { + if (!(e instanceof SyntaxError)) { + $ERROR('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); + } +}
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T7.js new file mode 100644 index 000000000..79b3c261c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T7.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.2.1_A3_T7; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "Object("a")" and "return a;"; +*/ + + +var body = "return a;"; + +var p=Object("a"); + +//CHECK#1 +try { + var f = new Function(p, body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f(1)!==1) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +}
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T8.js new file mode 100644 index 000000000..6a0702872 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T8.js @@ -0,0 +1,39 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.2.1_A3_T8; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "undefined" and "return this;"; +*/ + + +var body = "return this;"; + +//CHECK#1 +try { + var f = new Function(undefined,body); +} catch (e) { + $FAIL('#1: test failed with error '+e); +} + +//CHECK#2 +if (f.constructor !== Function) { + $ERROR('#2: When the Function constructor is called with one argument then body be that argument and creates a new Function object as specified in 13.2'); +} + +//CHECK#3 +if (f()!==this) { + $ERROR('#3: When the Function constructor is called with one argument then body be that argument the following steps are taken...'); +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T9.js new file mode 100644 index 000000000..9fe7a2da3 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2.1_A3_T9.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. + +/** +* @name: S15.3.2.1_A3_T9; +* @section: 15.3.2.1, 13.2; +* @assertion: When the Function constructor is called with arguments p, body the following steps are taken: +* i) Let Result(i) be the first argument +* ii) Let P be ToString(Result(i)) +* iii) Call ToString(body) +* iv) If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception +* v) If body is not parsable as FunctionBody then throw a SyntaxError exception +* vi) Create a new Function object as specified in 13.2 with parameters specified by parsing P as a FormalParameterListopt and body specified by parsing body as a FunctionBody +* Pass in a scope chain consisting of the global object as the Scope parameter +* vii) Return Result(vi); +* @description: Values of the function constructor arguments are "1,1" and "return this;"; +*/ + + +var body = "return this;"; +var p="1,1"; + +//CHECK#1 +try { + var f = new Function(p,body); + $FAIL('#1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); +} catch (e) { + if (!(e instanceof SyntaxError)) { + $ERROR('#1.1: If P is not parsable as a FormalParameterList_opt then throw a SyntaxError exception'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2_A1.js new file mode 100644 index 000000000..c04f6706b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.2_The_Function_Constructor/S15.3.2_A1.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. + +/** +* @name: S15.3.2_A1; +* @section: 15.3.2; +* @assertion: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object; +* @description: Checking the constuctor of the object that is created as a new Function; +*/ + +var f = new Function; + +//CHECK#1 +if (f.constructor !== Function) { + $ERROR('#1: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object'); +} + +//CHECK#2 +if (f === undefined) { + $ERROR('#2: When Function is called as part of a new expression, it is a constructor: it initialises the newly created object'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A1.js new file mode 100644 index 000000000..c734d032a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A1.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. + +/** +* @name: S15.3.3.1_A1; +* @section: 15.3.3.1, 15.3.4; +* @assertion: The Function.prototype property has the attribute ReadOnly; +* @description: Checking if varying the Function.prototype property fails; +*/ + +var obj = Function.prototype; +Function.prototype = function(){return "shifted";}; + +//CHECK#1 +if (Function.prototype !== obj) { + $ERROR('#1: the Function.prototype property has the attributes ReadOnly.'); +} + +//CHECK#2 +try { + if(Function.prototype()!==undefined){ + $ERROR('#2: the Function.prototype property has the attributes ReadOnly'); + } +} catch (e) { + $ERROR('#2.1: the Function.prototype property has the attributes ReadOnly: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A2.js new file mode 100644 index 000000000..494c44a7f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A2.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. + +/** +* @name: S15.3.3.1_A2; +* @section: 15.3.3.1, 15.3.4; +* @assertion: The Function.prototype property has the attribute DontEnum; +* @description: Checking if enumerating the Function.prototype property fails; +*/ + +// CHECK#1 +if (Function.propertyIsEnumerable('prototype')) { + $ERROR('#1: the Function.prototype property has the attributes DontEnum'); +} + +// CHECK#2 +var count=0; + +for (p in Function){ + if (p==="prototype") count++; +} + +if (count !== 0) { + $ERROR('#2: the Function.prototype property has the attributes DontEnum'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A3.js new file mode 100644 index 000000000..a57d3d93c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/15.3.3.1_Function.prototype/S15.3.3.1_A3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.3.1_A3; +* @section: 15.3.3.1, 15.3.4; +* @assertion: The Function.prototype property has the attribute DontDelete; +* @description: Checking if deleting the Function.prototype property fails; +*/ + +delete Function.prototype; + +//CHECK#1 +if (!(Function.hasOwnProperty('prototype'))) { + $ERROR('#1: the Function.prototype property has the attributes DontDelete.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A1.js new file mode 100644 index 000000000..d2c6070fd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.3.3_A1; + * @section: 15.3.3; + * @assertion: The Function constructor has the property "prototype"; + * @description: Checking existence of the property "prototype"; + */ + +if(!Function.hasOwnProperty("prototype")){ + $ERROR('#1: The Function constructor has the property "prototype"'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T1.js new file mode 100644 index 000000000..51841a666 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.3_A2_T1; +* @section: 15.3.3, 15.3.4; +* @assertion: The value of the internal [[Prototype]] property of the Function constructor +* is the Function prototype object; +* @description: Checking prototype of Function; +*/ + +// CHECK# +if (!(Function.prototype.isPrototypeOf(Function))) { + $ERROR('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T2.js new file mode 100644 index 000000000..870684308 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A2_T2.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.3_A2_T2; +* @section: 15.3.3, 15.3.4; +* @assertion: The value of the internal [[Prototype]] property of the Function constructor +* is the Function prototype object; +* @description: Add new property to Function.prototype and check it; +*/ + +Function.prototype.indicator = 1; + +//CHECK# +if (Function.indicator != 1) { + $ERROR('#1: the value of the internal [[Prototype]] property of the Function constructor is the Function prototype object.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A3.js new file mode 100644 index 000000000..50402370c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.3_Properties_of_the_Function_Constructor/S15.3.3_A3.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.3_A3; +* @section: 15.3.3, 15.3.4; +* @assertion: Function constructor has length property whose value is 1; +* @description: Checking Function.length property; +*/ + +//CHECK#1 +if (!Function.hasOwnProperty("length")){ + $ERROR('#1: Function constructor has length property'); +} + +//CHECK#2 +if (Function.length !== 1) { + $ERROR('#2: Function constructor length property value is 1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A10.js new file mode 100644 index 000000000..f44729e95 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A10.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. + +/** +* @name: S15.3.4.2_A10; +* @section: 15.3.4.2; +* @assertion: The Function.prototype.toString.length property has the attribute ReadOnly; +* @description: Checking if varying the Function.prototype.toString.length property fails; +*/ + +//CHECK#1 +if (!(Function.prototype.toString.hasOwnProperty('length'))) { + $FAIL('#1: the Function.prototype.toString has length property.'); +} + +var obj = Function.prototype.toString.length; + +Function.prototype.toString.length = function(){return "shifted";}; + +//CHECK#2 +if (Function.prototype.toString.length !== obj) { + $ERROR('#2: the Function.prototype.toString length property has the attributes ReadOnly.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A11.js new file mode 100644 index 000000000..8c1c6fc7a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A11.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A11; +* @section: 15.3.4.2; +* @assertion: The length property of the toString method is 0; +* @description: Checking Function.prototype.toString.length; +*/ + +//CHECK#1 +if (!(Function.prototype.toString.hasOwnProperty("length"))) { + $ERROR('#1: The Function.prototype.toString has the length property'); +} + +//CHECK#2 +if (Function.prototype.toString.length !== 0) { + $ERROR('#2: The length property of the toString method is 0'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A12.js new file mode 100644 index 000000000..6c26bd6a8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A12.js @@ -0,0 +1,13 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A12; +* @section: 15.3.4.2; +* @assertion: The Function.prototype.toString function is not generic; +* it throws a TypeError exception if its this value is not +* a Function object. +* @negative TypeError; +*/ + +Function.prototype.toString.call(undefined); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A13.js new file mode 100644 index 000000000..32a391302 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A13.js @@ -0,0 +1,13 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A13; +* @section: 15.3.4.2; +* @assertion: The toString function is not generic; it throws a +* TypeError exception if its this value is not a Function +* object. +* @negative TypeError; +*/ + +Function.prototype.toString.call(null); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A14.js new file mode 100644 index 000000000..8ff48e6de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A14.js @@ -0,0 +1,13 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A14; +* @section: 15.3.4.2; +* @assertion: The toString function is not generic; it throws a +* TypeError exception if its this value is not a Function +* object. +* @negative TypeError; +*/ + +Function.prototype.toString.call({}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A15.js new file mode 100644 index 000000000..4dbd35928 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A15.js @@ -0,0 +1,16 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A15; +* @section: 15.3.4.2; +* @assertion: The toString function is not generic; it throws a +* TypeError exception if its this value is not a Function +* object. +* @description: Whether or not they are callable, RegExp objects are +* not Function objects, so toString should throw a +* TypeError. +* @negative TypeError; +*/ + +Function.prototype.toString.call(/x/); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A16.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A16.js new file mode 100644 index 000000000..6a51b0cee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A16.js @@ -0,0 +1,18 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A16; +* @section: 15.3.4.2; +* @assertion: The toString function is not generic; it throws a +* TypeError exception if its this value is not a Function +* object. +* @description: The String constructor, given an object, should invoke +* that object's toString method as a method, i.e., with +* its this value bound to that object. +* @negative TypeError; +*/ + +var obj = {toString: Function.prototype.toString}; + +String(obj); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A1_T1.js new file mode 100644 index 000000000..7cc0d5bf8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A1_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A1_T1; +* @section: 15.3.4.2; +* @assertion: An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration; +* @description: For testing use Function.prototype.toString() function; +*/ + +var f = function(x) { + return x*x; +}; + +//CHECK#1 +if (eval(f.toString())(10) !== f(10)) { + $ERROR('#1: An implementation-dependent representation of the function is returned. This representation has the syntax of a FunctionDeclaration'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A6.js new file mode 100644 index 000000000..810a3fdee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A6.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A6; +* @section: 15.3.4.2, 13.2; +* @assertion: Function.prototype.toString has not prototype property; +* @description: Checking if obtaining the prototype property of Function.prototype.toString fails; +*/ + +//CHECK#1 +if (Function.prototype.toString.prototype !== undefined) { + $ERROR('#1: Function.prototype.toString has not prototype property'+Function.prototype.toString.prototype); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A7.js new file mode 100644 index 000000000..9d15fe42f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A7.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A7; +* @section: 15.3.4.2, 13.2; +* @assertion: Function.prototype.toString can't be used as constructor; +* @description: Checking if creating "new Function.prototype.toString" fails; +*/ + +var FACTORY = Function.prototype.toString; + +try { + var instance = new FACTORY; + $FAIL('#1: Function.prototype.toString can\'t be used as constructor'); +} catch (e) { + $PRINT(e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A8.js new file mode 100644 index 000000000..a86c9c77f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A8.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. + +/** +* @name: S15.3.4.2_A8; +* @section: 15.3.4.2; +* @assertion: The Function.prototype.toString.length property has the attribute DontEnum; +* @description: Checking if enumerating the Function.prototype.toString.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.toString.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.toString has length property.'); +} + + +// CHECK#1 +if (Function.prototype.toString.propertyIsEnumerable('length')) { + $ERROR('#1: the Function.prototype.toString.length property has the attributes DontEnum'); +} + +// CHECK#2 +for (p in Function.prototype.toString){ + if (p==="length") + $ERROR('#2: the Function.prototype.toString.length property has the attributes DontEnum'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A9.js new file mode 100644 index 000000000..bbf4a7b20 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.2_Function.prototype.toString/S15.3.4.2_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.2_A9; +* @section: 15.3.4.2; +* @assertion: The Function.prototype.toString.length property has the attribute DontDelete; +* @description: Checking if deleting the Function.prototype.toString.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.toString.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.toString has length property'); +} + +//CHECK#1 +if (delete Function.prototype.toString.length) { + $ERROR('#1: The Function.prototype.toString.length property has the attributes DontDelete'); +} + +//CHECK#2 +if (!(Function.prototype.toString.hasOwnProperty('length'))) { + $FAIL('#2: The Function.prototype.toString.length property has the attributes DontDelete'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A10.js new file mode 100644 index 000000000..86fa9ad92 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A10.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. + +/** +* @name: S15.3.4.3_A10; +* @section: 15.3.4.3; +* @assertion: The Function.prototype.apply.length property has the attribute ReadOnly; +* @description: Checking if varying the Function.prototype.apply.length property fails; +*/ + +//CHECK#1 +if (!(Function.prototype.apply.hasOwnProperty('length'))) { + $FAIL('#1: the Function.prototype.apply has length property.'); +} + +var obj = Function.prototype.apply.length; + +Function.prototype.apply.length = function(){return "shifted";}; + +//CHECK#2 +if (Function.prototype.apply.length !== obj) { + $ERROR('#2: the Function.prototype.apply length property has the attributes ReadOnly.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A11.js new file mode 100644 index 000000000..18664ef07 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A11.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. + +/** +* @name: S15.3.4.3_A11; +* @section: 15.3.4.3; +* @assertion: The Function.prototype.apply.length property has the attribute DontEnum; +* @description: TChecking if enumerating the Function.prototype.apply.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.apply.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.apply has length property.'); +} + + +// CHECK#1 +if (Function.prototype.apply.propertyIsEnumerable('length')) { + $ERROR('#1: the Function.prototype.apply.length property has the attributes DontEnum'); +} + +// CHECK#2 +for (var p in Function.prototype.apply){ + if (p==="length") + $ERROR('#2: the Function.prototype.apply.length property has the attributes DontEnum'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A12.js new file mode 100644 index 000000000..3be50be81 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A12.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A12; +* @section: 15.3.4.3, 13.2; +* @assertion: Function.prototype.apply has not prototype property; +* @description: Checking if obtaining the prototype property of Function.prototype.apply fails; +*/ + +//CHECK#1 +if (Function.prototype.apply.prototype !== undefined) { + $ERROR('#1: Function.prototype.apply has not prototype property'+Function.prototype.apply.prototype); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A13.js new file mode 100644 index 000000000..01196f9a0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A13.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A13; +* @section: 15.3.4.3; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.apply.call(undefined, {}, []); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A14.js new file mode 100644 index 000000000..c756e4c41 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A14.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A14; +* @section: 15.3.4.3; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.apply.call(null, {}, []); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A15.js new file mode 100644 index 000000000..339d44689 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A15.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A15; +* @section: 15.3.4.3; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.apply.call({}, {}, []); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A16.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A16.js new file mode 100644 index 000000000..08425ed70 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A16.js @@ -0,0 +1,27 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A16; +* @section: 15.3.4.3; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @description: A RegExp is not a function, but it may be +* callable. Iff it is, it's typeof should be 'function', +* in which case apply should accept it as a valid this +* value. +*/ + +var re = (/x/); +if (typeof re === 'function') { + Function.prototype.apply.call(re, undefined, ['x']); +} else { + try { + Function.prototype.bind.call(re, undefined); + $FAIL('#1: If IsCallable(func) is false, ' + + 'then (bind should) throw a TypeError exception'); + } catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1: TypeError expected. Actual: ' + e); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_T1.js new file mode 100644 index 000000000..d3dc9e0cc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_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. + +/** +* @name: S15.3.4.3_A1_T1; +* @section: 15.3.4.3; +* @assertion: The apply method performs a function call using the [[Call]] property of the object. If the object does not have a [[Call]] property, a TypeError exception is thrown; +* @description: Calling "apply" method of the object that does not have a [[Call]] property. +* Prototype of the object is Function(); +*/ + +var proto=Function(); + +function FACTORY(){}; + +FACTORY.prototype=proto; + +var obj = new FACTORY; + +//CHECK#1 +if (typeof obj.apply !== "function") { + $ERROR('#1: apply method accessed'); +} + +//CHECK#2 +try { + obj.apply(); + $FAIL('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_T2.js new file mode 100644 index 000000000..04ea48b62 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A1_T2.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. + +/** +* @name: S15.3.4.3_A1_T2; +* @section: 15.3.4.3; +* @assertion: The apply method performs a function call using the [[Call]] property of the object. If the object does not have a [[Call]] property, a TypeError exception is thrown; +* @description: Calling "apply" method of the object that does not have a [[Call]] property. +* Prototype of the object is Function.prototype; +*/ + +function FACTORY(){}; + +FACTORY.prototype=Function.prototype; + +var obj = new FACTORY; + +//CHECK#1 +if (typeof obj.apply !== "function") { + $ERROR('#1: apply method accessed'); +} + +//CHECK#2 +try { + obj.apply(); + $FAIL('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T1.js new file mode 100644 index 000000000..e7d375f3f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A2_T1; +* @section: 15.3.4.3; +* @assertion: The length property of the apply method is 2; +* @description: Checking Function.prototype.apply.length; +*/ + +//CHECK#1 +if (typeof Function.prototype.apply !== "function") { + $ERROR('#1: apply method defined'); +} + +//CHECK#2 +if (typeof Function.prototype.apply.length === "undefined") { + $ERROR('#2: length property of apply method defined'); +} + +//CHECK#3 +if (Function.prototype.apply.length !== 2) { + $ERROR('#3: The length property of the apply method is 2'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T2.js new file mode 100644 index 000000000..4ccc10353 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A2_T2.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. + +/** +* @name: S15.3.4.3_A2_T2; +* @section: 15.3.4.3; +* @assertion: The length property of the apply method is 2; +* @description: Checking f.apply.length, where f is new Function; +*/ + +var f=new Function; + +//CHECK#1 +if (typeof f.apply !== "function") { + $ERROR('#1: apply method accessed'); +} + +//CHECK#2 +if (typeof f.apply.length === "undefined") { + $ERROR('#2: length property of apply method defined'); +} + +//CHECK#3 +if (f.apply.length !== 2) { + $ERROR('#3: The length property of the apply method is 2'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T1.js new file mode 100644 index 000000000..194aee792 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T1; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Not any arguments at apply function; +*/ + +Function("this.field=\"strawberry\"").apply(); + +//CHECK#1 +if (this["field"] !== "strawberry") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T10.js new file mode 100644 index 000000000..ee53b6bf9 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T10.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T10; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Checking by using eval, no any arguments at apply function; +*/ + +eval(" (function(){this.feat=1}).apply()"); + +//CHECK#1 +if (this["feat"] !== 1) { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T2.js new file mode 100644 index 000000000..2f4f0ebb8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T2; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is null; +*/ + +Function("this.field=\"green\"").apply(null); + +//CHECK#1 +if (this["field"] !== "green") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T3.js new file mode 100644 index 000000000..e13458a89 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T3; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is void 0; +*/ + +Function("this.field=\"battle\"").apply(void 0); + +//CHECK#1 +if (this["field"] !== "battle") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T4.js new file mode 100644 index 000000000..8bb939e0b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T4; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is undefined; +*/ + +Function("this.field=\"oil\"").apply(undefined); + +//CHECK#1 +if (this["field"] !== "oil") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T5.js new file mode 100644 index 000000000..dd4f08dff --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T5.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. + +/** +* @name: S15.3.4.3_A3_T5; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: No any arguments at apply function and it called inside function declaration; +*/ + +function FACTORY(){ + Function("this.feat=\"in da haus\"").apply(); +}; + +var obj = new FACTORY; + +//CHECK#1 +if (this["feat"] !== "in da haus") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} + +//CHECK#2 +if (typeof obj.feat !== "undefined") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T6.js new file mode 100644 index 000000000..913903275 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T6.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. + +/** +* @name: S15.3.4.3_A3_T6; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is null and it called inside function declaration; +*/ + +function FACTORY(){ + (function(){this.feat="kamon beyba"}).apply(null); +}; + +var obj = new FACTORY; + +//CHECK#1 +if (this["feat"] !== "kamon beyba") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} + +//CHECK#2 +if (typeof obj.feat !== "undefined") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T7.js new file mode 100644 index 000000000..a7b469040 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T7; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is void 0 and it called inside function declaration; +*/ + +(function FACTORY(){ + Function("this.feat=\"in da haus\"").apply(void 0); +})(); + + +//CHECK#1 +if (this["feat"] !== "in da haus") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T8.js new file mode 100644 index 000000000..89e2627b7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T8.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T8; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at apply function is undefined and it called inside function declaration; +*/ + +(function FACTORY(){ + (function(){this.feat="kamon beyba"}).apply(undefined); +})(); + +//CHECK#1 +if (this["feat"] !== "kamon beyba") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T9.js new file mode 100644 index 000000000..dce9397a1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A3_T9.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A3_T9; +* @section: 15.3.4.3; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Checking by using eval, argument at apply function is void 0; +*/ + +eval( " Function(\"this.feat=1\").apply(void 0) " ); + +//CHECK#1 +if (this["feat"] !== 1) { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T1.js new file mode 100644 index 000000000..b20620174 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T1.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. + +/** +* @name: S15.3.4.3_A5_T1; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is number; +*/ + +var obj=1; + +var retobj = Function("this.touched= true; return this;").apply(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +}
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T2.js new file mode 100644 index 000000000..d7e191f5d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A5_T2; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is boolean true; +*/ + +var obj=true; + +var retobj = new Function("this.touched= true; return this;").apply(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T3.js new file mode 100644 index 000000000..27c08ff88 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A5_T3; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is string; +*/ + +var obj="soap"; + +var retobj = ( function(){this.touched= true; return this;} ).apply(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T4.js new file mode 100644 index 000000000..e01212846 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_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. + +/** +* @name: S15.3.4.3_A5_T4; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is function variable that return this; +*/ + +f = function(){this.touched= true; return this;}; + +retobj = f.apply(obj); + +//CHECK#1 +if (typeof obj !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +var obj; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T5.js new file mode 100644 index 000000000..235a3d489 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T5.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. + +/** +* @name: S15.3.4.3_A5_T5; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is function variable; +*/ + +var f = function(){this.touched= true;}; + +var obj={}; + +f.apply(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T6.js new file mode 100644 index 000000000..ca64419b2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A5_T6; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is new String(); +*/ + +var obj=new String("soap"); + +( function(){this.touched= true;}).apply(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T7.js new file mode 100644 index 000000000..96a28fb31 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A5_T7; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is new Number(); +*/ + +var obj=new Number(1); + +Function("this.touched= true;").apply(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T8.js new file mode 100644 index 000000000..d3a814f81 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A5_T8.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A5_T8; +* @section: 15.3.4.3; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is Function(); +*/ + +var obj=Function(); + +new Function("this.touched= true; return this;").apply(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T1.js new file mode 100644 index 000000000..66123546d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A6_T1; +* @section: 15.3.4.3; +* @assertion: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown; +* @description: argArray is (1,{}); +*/ + +//CHECK#1 +try { + Function().apply(1,{}); + $FAIL('#1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T2.js new file mode 100644 index 000000000..88ed4a692 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A6_T2; +* @section: 15.3.4.3; +* @assertion: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown; +* @description: argArray is (null,1); +*/ + +//CHECK#1 +try { + Function().apply(null,1); + $FAIL('#1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T3.js new file mode 100644 index 000000000..9049ae414 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T3.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. + +/** +* @name: S15.3.4.3_A6_T3; +* @section: 15.3.4.3; +* @assertion: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown; +* @description: argArray is (object,"1,3,4"); +*/ + +obj={}; + +//CHECK#1 +try { + Function().apply(obj,"1,3,4"); + $FAIL('#1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T4.js new file mode 100644 index 000000000..3fbb53935 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A6_T4.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A6_T4; +* @section: 15.3.4.3; +* @assertion: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown; +* @description: argArray is (this,function(){return arguments;}); +*/ + +//CHECK#1 +try { + Function().apply(this,function(){return arguments;}); + $FAIL('#1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: if argArray is neither an array nor an arguments object (see 10.1.8), a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T1.js new file mode 100644 index 000000000..a83bfce0a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A7_T1; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (null,[1]); +*/ + +Function("a1,a2,a3","this.shifted=a1;").apply(null,[1]); + +//CHECK#1 +if (this["shifted"] !== 1) { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T10.js new file mode 100644 index 000000000..11ffe978c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T10.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. + +/** +* @name: S15.3.4.3_A7_T10; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (empty object, arguments), inside function call without declaration used; +*/ + +var obj={}; + +(function (){ + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(obj,arguments); +})("",4,2); + +//CHECK#1 +if (obj["shifted"] !== "42") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T2.js new file mode 100644 index 000000000..72ab307d2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A7_T2; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (null,[1,2,3]); +*/ + +new Function("a1,a2","a3","this.shifted=a2;").apply(null,[1,2,3]); + +//CHECK#1 +if (this["shifted"] !== 2) { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T3.js new file mode 100644 index 000000000..93afc2b0e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_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. + +/** +* @name: S15.3.4.3_A7_T3; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (empty object, new Array("nine","inch","nails")); +*/ + +i=0; + +p={toString:function(){return "a"+(++i);}}; + +obj={}; + +Function(p,"a2,a3","this.shifted=a1;").apply(obj, new Array("nine","inch","nails")); + +//CHECK#1 +if (obj["shifted"] !== "nine") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T4.js new file mode 100644 index 000000000..a56aea8aa --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T4.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. + +/** +* @name: S15.3.4.3_A7_T4; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (empty object, ( function(){return arguments;}) ("a","b","c")); +*/ + +i=0; + +p={toString:function(){return "a"+(++i);}}; + +obj={}; + +new Function(p,p,p, "this.shifted=a3;").apply( obj,( function(){return arguments;}) ("a","b","c") ); + +//CHECK#1 +if (obj["shifted"] !== "c") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T5.js new file mode 100644 index 000000000..342599129 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T5.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. + +/** +* @name: S15.3.4.3_A7_T5; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (null, arguments), inside function declaration used; +*/ + +function FACTORY(){ + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(null,arguments); +} + +obj=new FACTORY("",1,2); + +//CHECK#1 +if (this["shifted"] !== "12") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (typeof obj.shifted !== "undefined") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T6.js new file mode 100644 index 000000000..cd3a45c81 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T6.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. + +/** +* @name: S15.3.4.3_A7_T6; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (this, arguments), inside function declaration used; +*/ + +function FACTORY(){ + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(this,arguments); +} + +obj=new FACTORY("",4,2); + +//CHECK#1 +if (obj["shifted"] !== "42") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T7.js new file mode 100644 index 000000000..a129184dd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A7_T7; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (null, arguments), inside function call without declaration used; +*/ + +(function (){ + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(null,arguments); +})("",1,2); + +//CHECK#1 +if (this["shifted"] !== "12") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T8.js new file mode 100644 index 000000000..58428b72d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T8.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. + +/** +* @name: S15.3.4.3_A7_T8; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (this, arguments), inside function call without declaration used; +*/ + +(function (){ + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(this,arguments); +})("",4,2); + +//CHECK#2 +if (this["shifted"] !== "42") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T9.js new file mode 100644 index 000000000..79dae88d8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A7_T9.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. + +/** +* @name: S15.3.4.3_A7_T9; +* @section: 15.3.4.3; +* @assertion: If argArray is either an array or an arguments object, +* the function is passed the (ToUint32(argArray.length)) arguments argArray[0], argArray[1],...,argArray[ToUint32(argArray.length)-1]; +* @description: argArray is (empty object, arguments), inside function declaration used; +*/ + +function FACTORY(){ + var obj = {}; + Function("a1,a2,a3","this.shifted=a1+a2+a3;").apply(obj,arguments); + return obj; +} + +obj=new FACTORY("",1,2); + +//CHECK#1 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (obj.shifted !== "12") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T1.js new file mode 100644 index 000000000..4b2ec53e0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A8_T1; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new Function.prototype.apply" fails; +*/ + +try { + obj = new Function.prototype.apply; + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.apply can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T2.js new file mode 100644 index 000000000..cf6e5a42c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A8_T2; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new Function.prototype.apply()" fails; +*/ + +try { + obj = new Function.prototype.apply(); + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.apply can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T3.js new file mode 100644 index 000000000..d97d2c2d7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A8_T3; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new Function.apply" fails; +*/ + +try { + obj = new Function.apply; + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.apply can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T4.js new file mode 100644 index 000000000..51a17f8fe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T4.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A8_T4; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new (Function("this.p1=1").apply)" fails; +*/ + +try { + obj = new (Function("this.p1=1").apply); + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.apply can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T5.js new file mode 100644 index 000000000..37f65da29 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A8_T5; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new Function("this.p1=1").apply" fails; +*/ + +try { + FACTORY = Function("this.p1=1").apply; + obj = new FACTORY(); + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.apply can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T6.js new file mode 100644 index 000000000..a1838190e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A8_T6.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. + +/** +* @name: S15.3.4.3_A8_T6; +* @section: 15.3.4.3; +* @assertion: Function.prototype.apply can`t be used as [[create]] caller; +* @description: Checking if creating "new (Function("function f(){this.p1=1;};return f").apply())" fails; +*/ + +//CHECK#1 +try { + obj = new (Function("function f(){this.p1=1;};return f").apply()); +} catch (e) { + $ERROR('#1: Function.prototype.apply can\'t be used as [[create]] caller'); +} + +//CHECK#2 +if (obj.p1!== 1) { + $ERROR('#2: Function.prototype.apply can\'t be used as [[create]] caller'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A9.js new file mode 100644 index 000000000..e5ce9fb89 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.3_Function.prototype.apply/S15.3.4.3_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.3_A9; +* @section: 15.3.4.3; +* @assertion: The Function.prototype.apply.length property has the attribute DontDelete; +* @description: Checking if deleting the Function.prototype.apply.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.apply.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.apply has length property'); +} + +//CHECK#1 +if (delete Function.prototype.apply.length) { + $ERROR('#1: The Function.prototype.apply.length property has the attributes DontDelete'); +} + +//CHECK#2 +if (!(Function.prototype.apply.hasOwnProperty('length'))) { + $FAIL('#2: The Function.prototype.apply.length property has the attributes DontDelete'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A10.js new file mode 100644 index 000000000..fc8cdb2fb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A10.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. + +/** +* @name: S15.3.4.4_A10; +* @section: 15.3.4.4; +* @assertion: The Function.prototype.call.length property has the attribute ReadOnly; +* @description: Checking if varying the Function.prototype.call.length property fails; +*/ + +//CHECK#1 +if (!(Function.prototype.call.hasOwnProperty('length'))) { + $FAIL('#1: the Function.prototype.call has length property.'); +} + +var obj = Function.prototype.call.length; + +Function.prototype.call.length = function(){return "shifted";}; + +//CHECK#2 +if (Function.prototype.call.length !== obj) { + $ERROR('#2: the Function.prototype.call length property has the attributes ReadOnly.'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A11.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A11.js new file mode 100644 index 000000000..bcc981fe8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A11.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. + +/** +* @name: S15.3.4.4_A11; +* @section: 15.3.4.4; +* @assertion: The Function.prototype.call.length property has the attribute DontEnum; +* @description: Checking if enumerating the Function.prototype.call.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.call.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.call has length property.'); +} + + +// CHECK#1 +if (Function.prototype.call.propertyIsEnumerable('length')) { + $ERROR('#1: the Function.prototype.call.length property has the attributes DontEnum'); +} + +// CHECK#2 +for (p in Function.prototype.call){ + if (p==="length") + $ERROR('#2: the Function.prototype.call.length property has the attributes DontEnum'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A12.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A12.js new file mode 100644 index 000000000..422eaf52a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A12.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A12; +* @section: 15.3.4.4, 13.2; +* @assertion: Function.prototype.call has not prototype property; +* @description: Checking if obtaining the prototype property of Function.prototype.call fails; +*/ + +//CHECK#1 +if (Function.prototype.call.prototype !== undefined) { + $ERROR('#1: Function.prototype.call has not prototype property'+Function.prototype.call.prototype); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A13.js new file mode 100644 index 000000000..6dcf1f960 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A13.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A13; +* @section: 15.3.4.4; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.call.call(undefined, {}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A14.js new file mode 100644 index 000000000..88a8ae002 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A14.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A14; +* @section: 15.3.4.4; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.call.call(null, {}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A15.js new file mode 100644 index 000000000..d337793eb --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A15.js @@ -0,0 +1,11 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A15; +* @section: 15.3.4.4; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.call.call({}, {}); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A16.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A16.js new file mode 100644 index 000000000..2333f4ec4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A16.js @@ -0,0 +1,27 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A16; +* @section: 15.3.4.4; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @description: A RegExp is not a function, but it may be +* callable. Iff it is, it's typeof should be 'function', +* in which case call should accept it as a valid this +* value. +*/ + +var re = (/x/); +if (typeof re === 'function') { + Function.prototype.call.call(re, undefined, 'x'); +} else { + try { + Function.prototype.bind.call(re, undefined); + $FAIL('#1: If IsCallable(func) is false, ' + + 'then (bind should) throw a TypeError exception'); + } catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1: TypeError expected. Actual: ' + e); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T1.js new file mode 100644 index 000000000..8e3ac5510 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T1.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. + +/** +* @name: S15.3.4.4_A1_T1; +* @section: 15.3.4.4; +* @assertion: The call method performs a function call using the [[Call]] property of the object. If the object does not have a [[Call]] property, a TypeError exception is thrown; +* @description: Call "call" method of the object that does not have a [[Call]] property. +* Prototype of the object is Function(); +*/ + +var proto=Function(); + +function FACTORY(){}; + +FACTORY.prototype=proto; + +var obj = new FACTORY; + +//CHECK#1 +if (typeof obj.call !== "function") { + $ERROR('#1: call method accessed'); +} + +//CHECK#2 +try { + obj.call(); + $FAIL('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); + } +} +
\ No newline at end of file diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T2.js new file mode 100644 index 000000000..1c29bc248 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A1_T2.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. + +/** +* @name: S15.3.4.4_A1_T2; +* @section: 15.3.4.4; +* @assertion: The call method performs a function call using the [[Call]] property of the object. If the object does not have a [[Call]] property, a TypeError exception is thrown; +* @description: Calling "call" method of the object that does not have a [[Call]] property. +* Prototype of the object is Function.prototype; +*/ + +function FACTORY(){}; + +FACTORY.prototype=Function.prototype; + +var obj = new FACTORY; + +//CHECK#1 +if (typeof obj.call !== "function") { + $ERROR('#1: call method accessed'); +} + +//CHECK#2 +try { + obj.call(); + $FAIL('#2: If the object does not have a [[Call]] property, a TypeError exception is thrown'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#2.1: If the object does not have a [[Call]] property, a TypeError exception is thrown'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T1.js new file mode 100644 index 000000000..2c81d7ad8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A2_T1; +* @section: 15.3.4.4; +* @assertion: The length property of the call method is 1; +* @description: Checking Function.prototype.call.length; +*/ + +//CHECK#1 +if (typeof Function.prototype.call !== "function") { + $ERROR('#1: call method defined'); +} + +//CHECK#2 +if (typeof Function.prototype.call.length === "undefined") { + $ERROR('#2: length property of call method defined'); +} + +//CHECK#3 +if (Function.prototype.call.length !== 1) { + $ERROR('#3: The length property of the call method is 1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T2.js new file mode 100644 index 000000000..bcf374c4d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A2_T2.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. + +/** +* @name: S15.3.4.4_A2_T2; +* @section: 15.3.4.4; +* @assertion: The length property of the call method is 1; +* @description: Checking f.call.length, where f is new Function; +*/ + +var f=new Function; + +//CHECK#1 +if (typeof f.call !== "function") { + $ERROR('#1: call method accessed'); +} + +//CHECK#2 +if (typeof f.call.length === "undefined") { + $ERROR('#2: length property of call method defined'); +} + +//CHECK#3 +if (f.call.length !== 1) { + $ERROR('#3: The length property of the call method is 1'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T1.js new file mode 100644 index 000000000..07f3f2410 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T1; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Not any arguments at call function; +*/ + +Function("this.field=\"strawberry\"").call(); + +//CHECK#1 +if (this["field"] !== "strawberry") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T10.js new file mode 100644 index 000000000..a6edd7b43 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T10.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T10; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Checking by using eval, no any arguments at call function; +*/ + +eval(" (function(){this.feat=1}).call()"); + +//CHECK#1 +if (this["feat"] !== 1) { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T2.js new file mode 100644 index 000000000..f43fd0231 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T2; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is null; +*/ + +Function("this.field=\"green\"").call(null); + +//CHECK#1 +if (this["field"] !== "green") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T3.js new file mode 100644 index 000000000..1b9d2354e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T3; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is void 0; +*/ + +Function("this.field=\"battle\"").call(void 0); + +//CHECK#1 +if (this["field"] !== "battle") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T4.js new file mode 100644 index 000000000..61252cd96 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T4; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is undefined; +*/ + +Function("this.field=\"oil\"").call(undefined); + +//CHECK#1 +if (this["field"] !== "oil") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T5.js new file mode 100644 index 000000000..7f0e331d6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T5.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. + +/** +* @name: S15.3.4.4_A3_T5; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: No any arguments at call function and it called inside function declaration; +*/ + +function FACTORY(){ + Function("this.feat=\"in da haus\"").call(); +}; + +var obj = new FACTORY; + +//CHECK#1 +if (this["feat"] !== "in da haus") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} + +//CHECK#2 +if (typeof obj.feat !== "undefined") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T6.js new file mode 100644 index 000000000..4b110aabc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T6.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. + +/** +* @name: S15.3.4.4_A3_T6; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is null and it called inside function declaration; +*/ + +function FACTORY(){ + (function(){this.feat="kamon beyba"}).call(null); +}; + +var obj = new FACTORY; + +//CHECK#1 +if (this["feat"] !== "kamon beyba") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} + +//CHECK#2 +if (typeof obj.feat !== "undefined") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T7.js new file mode 100644 index 000000000..839a47849 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T7; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is void 0 and it called inside function declaration; +*/ + +(function FACTORY(){ + Function("this.feat=\"in da haus\"").call(void 0); +})(); + + +//CHECK#1 +if (this["feat"] !== "in da haus") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T8.js new file mode 100644 index 000000000..e4ed5976e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T8.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T8; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Argument at call function is undefined and it called inside function declaration; +*/ + +(function FACTORY(){ + (function(){this.feat="kamon beyba"}).call(undefined); +})(); + + +//CHECK#1 +if (this["feat"] !== "kamon beyba") { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T9.js new file mode 100644 index 000000000..e1c681667 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A3_T9.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A3_T9; +* @section: 15.3.4.4; +* @assertion: If thisArg is null or undefined, the called function is passed the global object as the this value; +* @description: Checking by using eval, argument at call function is void 0; +*/ + +eval( " Function(\"this.feat=1\").call(void 0) " ); + + +//CHECK#1 +if (this["feat"] !== 1) { + $ERROR('#1: If thisArg is null or undefined, the called function is passed the global object as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T1.js new file mode 100644 index 000000000..8a5e26dec --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T1; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is number; +*/ + +var obj=1; + +var retobj = Function("this.touched= true; return this;").call(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T2.js new file mode 100644 index 000000000..7ff019f87 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T2; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is boolean true; +*/ + +var obj=true; + +var retobj = new Function("this.touched= true; return this;").call(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T3.js new file mode 100644 index 000000000..d21b33354 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T3.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T3; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is string; +*/ + +var obj="soap"; + +var retobj = ( function(){this.touched= true; return this;} ).call(obj); + +//CHECK#1 +if (typeof obj.touched !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T4.js new file mode 100644 index 000000000..d260fcb78 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_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. + +/** +* @name: S15.3.4.4_A5_T4; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is function variable that return this; +*/ + +var f = function(){this.touched= true; return this;}; + +var retobj = f.call(obj); + +//CHECK#1 +if (typeof obj !== "undefined") { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +//CHECK#2 +if (!(retobj["touched"])) { + $ERROR('#2: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + +var obj; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T5.js new file mode 100644 index 000000000..673246522 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T5.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. + +/** +* @name: S15.3.4.4_A5_T5; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is function variable; +*/ + +var f = function(){this.touched= true;}; + +var obj={}; + +f.call(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T6.js new file mode 100644 index 000000000..d25db0afe --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T6.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T6; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is new String(); +*/ + +var obj=new String("soap"); + +( function(){this.touched= true;}).call(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T7.js new file mode 100644 index 000000000..04c59a854 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T7; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is new Number(); +*/ + +var obj=new Number(1); + +Function("this.touched= true;").call(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T8.js new file mode 100644 index 000000000..12507ed86 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A5_T8.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A5_T8; +* @section: 15.3.4.4; +* @assertion: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value; +* @description: thisArg is Function(); +*/ + +var obj=Function(); + +new Function("this.touched= true; return this;").call(obj); + +//CHECK#1 +if (!(obj.touched)) { + $ERROR('#1: If thisArg is not null(defined) the called function is passed ToObject(thisArg) as the this value'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T1.js new file mode 100644 index 000000000..6f0827965 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_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. + +/** +* @name: S15.3.4.4_A6_T1; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (null,[1]); +*/ + +Function("a1,a2,a3","this.shifted=a1;").call(null,[1]); + +//CHECK#1 +if (this["shifted"].constructor !== Array) { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if (this["shifted"].length !== 1) { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#3 +if (this["shifted"][0] !== 1) { + $ERROR('#3: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T10.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T10.js new file mode 100644 index 000000000..bbeb26ee7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T10.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. + +/** +* @name: S15.3.4.4_A6_T10; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (empty object, "", arguments,2), inside function call without declaration used; +*/ + +var obj={}; + +(function (){ + Function("a1,a2,a3","this.shifted=a1.length+a2+a3;").call(obj,arguments,"","2"); +})("",4,2,"a"); + +//CHECK#1 +if (obj["shifted"] !== "42") { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T2.js new file mode 100644 index 000000000..caa27dab4 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_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. + +/** +* @name: S15.3.4.4_A6_T2; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (null,[3,2,1]); +*/ + +new Function("a1,a2","a3","this.shifted=a1;").call(null,[3,2,1]); + +//CHECK#1 +if (this["shifted"].length !== 3) { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if ((this["shifted"][0] !== 3)||(this["shifted"][1] !== 2)||(this["shifted"][2] !== 1)) { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T3.js new file mode 100644 index 000000000..ed536b764 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T3.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. + +/** +* @name: S15.3.4.4_A6_T3; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (empty object, new Array("nine","inch","nails")); +*/ + +var i=0; + +var p={toString:function(){return "a"+(++i);}}; + +var obj={}; + +Function(p,"a2,a3","this.shifted=a1;").call(obj, new Array("nine","inch","nails")); + +//CHECK#1 +if (obj["shifted"].length !== 3) { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if ((obj["shifted"][0] !== "nine")||(obj["shifted"][1] !== "inch")||(obj["shifted"][2] !== "nails")) { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#3 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#3: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T4.js new file mode 100644 index 000000000..0cc34c670 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T4.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. + +/** +* @name: S15.3.4.4_A6_T4; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (empty object, ( function(){return arguments;})("a","b","c","d"),"",2); +*/ + +var i=0; + +var p={toString:function(){return "a"+(++i);}}; + +var obj={}; + +new Function(p,p,p, "this.shifted=a3+a2+a1.length;").call( obj,( function(){return arguments;})("a","b","c","d"),"",2 ); + +//CHECK#1 +if (obj["shifted"] !== "24") { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T5.js new file mode 100644 index 000000000..6f38a8f28 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T5.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. + +/** +* @name: S15.3.4.4_A6_T5; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (null, arguments,"",2), inside function declaration used; +*/ + +function FACTORY(){ + Function("a1,a2,a3","this.shifted=a1.length+a2+a3;").call(null,arguments,"",2); +} + +var obj=new FACTORY("",1,2,"A"); + +//CHECK#1 +if (this["shifted"] !== "42") { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if (typeof obj.shifted !== "undefined") { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T6.js new file mode 100644 index 000000000..9dbd6d30b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T6.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. + +/** +* @name: S15.3.4.4_A6_T6; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (this, arguments,"",2), inside function declaration used; +*/ + +function FACTORY(){ + Function("a1,a2,a3","this.shifted=a1.length+a2+a3;").call(this,arguments,"",2); +} + +var obj=new FACTORY("",4,2,"A"); + +//CHECK#1 +if (obj["shifted"] !== "42") { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + +//CHECK#2 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T7.js new file mode 100644 index 000000000..ce45c6b75 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T7.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A6_T7; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (null, arguments,"",2), inside function call without declaration used; +*/ + +(function (){ + Function("a1,a2,a3","this.shifted=a1.length+a2+a3;").call(null,arguments,"",2); +})("",1,2,true); + +//CHECK#1 +if (this["shifted"] !== "42") { + $ERROR('#1: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T8.js new file mode 100644 index 000000000..2f6a5a782 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T8.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. + +/** +* @name: S15.3.4.4_A6_T8; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (this, arguments,"",2), inside function call without declaration used; +*/ + +(function (){ + Function("a1,a2,a3","this.shifted=a1.length+a2+a3;").call(this,arguments,"",2); +})("",4,2,null); + +//CHECK#2 +if (this["shifted"] !== "42") { + $ERROR('#2: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs a function call using the [[Call]] property of the object'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T9.js new file mode 100644 index 000000000..dbd38c381 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A6_T9.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. + +/** +* @name: S15.3.4.4_A6_T9; +* @section: 15.3.4.4; +* @assertion: The call method takes one or more arguments, thisArg and (optionally) arg1, arg2 etc, and performs +* a function call using the [[Call]] property of the object; +* @description: Argunemts of call function is (empty object, "", arguments,2), inside function declaration used; +*/ + +function FACTORY(){ + var obj = {}; + Function("a1,a2,a3","this.shifted=a1+a2.length+a3;").call(obj,"",arguments,2); + return obj; +} + +var obj=new FACTORY("",1,2,void 0); + +//CHECK#1 +if (typeof this["shifted"] !== "undefined") { + $ERROR('#1: If argArray is either an array or an arguments object, the function is passed the...'); +} + +//CHECK#2 +if (obj.shifted !== "42") { + $ERROR('#2: If argArray is either an array or an arguments object, the function is passed the...'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T1.js new file mode 100644 index 000000000..c611ad46f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A7_T1; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new Function.prototype.call" fails; +*/ + +try { + var obj = new Function.prototype.call; + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.call can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T2.js new file mode 100644 index 000000000..97bc288c1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A7_T2; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new Function.prototype.call()" fails; +*/ + +try { + var FACTORY = Function.prototype.call; + var obj = new FACTORY(); + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.call can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T3.js new file mode 100644 index 000000000..cd79b9cef --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T3.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A7_T3; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new Function.call" fails; +*/ + +try { + var obj = new Function.call; + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.call can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T4.js new file mode 100644 index 000000000..7de3ac7de --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T4.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A7_T4; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new (Function("this.p1=1").call)" fails; +*/ + +try { + var obj = new (Function("this.p1=1").call); + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.call can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T5.js new file mode 100644 index 000000000..d55c9b9f8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T5.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A7_T5; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new Function("this.p1=1").call" fails; +*/ + +try { + var FACTORY = Function("this.p1=1").call; + var obj = new FACTORY(); + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: Function.prototype.call can\'t be used as [[create]] caller'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T6.js new file mode 100644 index 000000000..741d4e380 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A7_T6.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. + +/** +* @name: S15.3.4.4_A7_T6; +* @section: 15.3.4.4; +* @assertion: Function.prototype.call can't be used as [[create]] caller; +* @description: Checking if creating "new (Function("function f(){this.p1=1;};return f").call())" fails; +*/ + +//CHECK#1 +try { + var obj = new (Function("function f(){this.p1=1;};return f").call()); +} catch (e) { + $ERROR('#1: Function.prototype.call can\'t be used as [[create]] caller'); +} + +//CHECK#2 +if (obj.p1!== 1) { + $ERROR('#2: Function.prototype.call can\'t be used as [[create]] caller'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A9.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A9.js new file mode 100644 index 000000000..361788ae6 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.4_Function.prototype.call/S15.3.4.4_A9.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.4_A9; +* @section: 15.3.4.4; +* @assertion: The Function.prototype.call.length property has the attribute DontDelete; +* @description: Checking if deleting the Function.prototype.call.length property fails; +*/ + +//CHECK#0 +if (!(Function.prototype.call.hasOwnProperty('length'))) { + $FAIL('#0: the Function.prototype.call has length property'); +} + +//CHECK#1 +if (delete Function.prototype.call.length) { + $ERROR('#1: The Function.prototype.call.length property has the attributes DontDelete'); +} + +//CHECK#2 +if (!(Function.prototype.call.hasOwnProperty('length'))) { + $FAIL('#2: The Function.prototype.call.length property has the attributes DontDelete'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A1.js new file mode 100644 index 000000000..c58334ba2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A1.js @@ -0,0 +1,15 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A1; +* @section: 15.3.4.5; +* @assertion: "caller" of bound function is poisoned (step 20); +* @description A bound function should fail to find its "caller"; +* @negative TypeError; +*/ + +function foo() { return bar.caller; } +var bar = foo.bind({}); +function baz() { return bar(); } +baz(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A13.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A13.js new file mode 100644 index 000000000..9b677d8cd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A13.js @@ -0,0 +1,12 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A13; +* @section: 15.3.4.5; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.bind.call(undefined, {}); + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A14.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A14.js new file mode 100644 index 000000000..f3b209f24 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A14.js @@ -0,0 +1,12 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A14; +* @section: 15.3.4.5; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.bind.call(null, {}); + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A15.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A15.js new file mode 100644 index 000000000..281983a64 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A15.js @@ -0,0 +1,12 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A15; +* @section: 15.3.4.5; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @negative TypeError; +*/ + +Function.prototype.bind.call({}, {}); + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A16.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A16.js new file mode 100644 index 000000000..c0d57b81a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A16.js @@ -0,0 +1,27 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A16; +* @section: 15.3.4.5; +* @assertion: If IsCallable(func) is false, then throw a TypeError exception. +* @description: A RegExp is not a function, but it may be +* callable. Iff it is, it's typeof should be 'function', +* in which case bind should accept it as a valid this +* value. +*/ + +var re = (/x/); +if (typeof re === 'function') { + Function.prototype.bind.call(re, undefined); +} else { + try { + Function.prototype.bind.call(re, undefined); + $FAIL('#1: If IsCallable(func) is false, ' + + 'then (bind should) throw a TypeError exception'); + } catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1: TypeError expected. Actual: ' + e); + } + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A2.js new file mode 100644 index 000000000..08e3489a5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/15.3.4.5_Function.prototype.bind/S15.3.4.5_A2.js @@ -0,0 +1,16 @@ +// Copyright 2011 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.5_A1; +* @section: 15.3.4.5; +* @assertion: "arguments" of bound function is poisoned (step 21); +* @description a bound function should fail to find the bound function +* "arguments"; +* @negative TypeError; +*/ + +function foo() { return bar.arguments; } +var bar = foo.bind({}); +function baz() { return bar(); } +baz(); diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T1.js new file mode 100644 index 000000000..48a39100e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T1.js @@ -0,0 +1,14 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4.1_A1_T1; +* @section: 15.3.4.1; +* @assertion: The initial value of Function.prototype.constructor is the built-in Function constructor; +* @description: Checking Function.prototype.constructor; +*/ + +//CHECK#1 +if (Function.prototype.constructor !== Function) { + $ERROR('#1: The initial value of Function.prototype.constructor is the built-in Function constructor'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T2.js new file mode 100644 index 000000000..673c323ed --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_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. + +/** +* @name: S15.3.4.1_A1_T2; +* @section: 15.3.4.1; +* @assertion: The initial value of Function.prototype.constructor is the built-in Function constructor; +* @description: Create new Function.prototype.constructor object; +*/ + +var constr = Function.prototype.constructor; + +var f = new constr; + +// CHECK#0 +if (f === undefined) { + $ERROR('#0: new Function() return the newly created function object.'); +} + +// CHECK#1 +if (f.constructor !== Function) { + $ERROR('#1: new Function() create a new function object'); +} + +// CHECK#2 +if (!(Function.prototype.isPrototypeOf(f))) { + $ERROR('#2: when new Function() calls the [[Prototype]] property of the newly constructed object is set to the Function prototype object.'); +} + +// CHECK#3 +var to_string_result = '[object '+ 'Function' +']'; + +delete Function.prototype.toString; + +if (f.toString() !== to_string_result) { + $ERROR('#3: when new Function() calls the [[Class]] property of the newly constructed object is set to "Function"'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A1.js new file mode 100644 index 000000000..4f4639648 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A1; +* @section: 15.3.4; +* @assertion: The Function prototype object is itself a Function +* object (its [[Class]] is "Function"); +* @description: Object.prototype.toString returns [object+[[Class]]+]; +*/ + +if (Object.prototype.toString.call(Function.prototype) !== "[object Function]") { + $ERROR('#2: The Function prototype object is itself a Function ' + + 'object (its [[Class]] is "Function") (15.3.4)'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T1.js new file mode 100644 index 000000000..f86f88460 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T1.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A2_T1; +* @section: 15.3.4; +* @assertion: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined; +* @description: Call Function.prototype(); +*/ + +//CHECK#1 +try { + if (Function.prototype() !== undefined) { + $ERROR('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); + } +} catch (e) { + $ERROR('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T2.js new file mode 100644 index 000000000..5229e5e7c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T2.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A2_T2; +* @section: 15.3.4; +* @assertion: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined; +* @description: Call Function.prototype(null,void 0); +*/ + +//CHECK#1 +try { + if (Function.prototype(null,void 0) !== undefined) { + $ERROR('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); + } +} catch (e) { + $ERROR('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: '+e); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T3.js new file mode 100644 index 000000000..255d2dc23 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A2_T3.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. + +/** +* @name: S15.3.4_A2_T3; +* @section: 15.3.4; +* @assertion: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined; +* @description: Call Function.prototype(x), where x is undefined variable; +*/ + +//CHECK#1 +try { + if (Function.prototype(x) !== undefined) { + var x; + $ERROR('#1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined'); + } +} catch (e) { + $ERROR('#1.1: The Function prototype object is itself a Function object that, when invoked, accepts any arguments and returns undefined: '+e); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T1.js new file mode 100644 index 000000000..423bf92f1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A3_T1; +* @section: 15.3.4; +* @assertion: The value of the internal [[Prototype]] property of the +* Function prototype object is the Object prototype object +* (15.3.4); +* @description: Checking prototype of Function.prototype; +*/ + +if (Object.getPrototypeOf(Function.prototype) !== Object.prototype) { + $ERROR('#1: The value of the internal [[Prototype]] property of ' + + 'the Function prototype object is the Object prototype ' + + 'object (15.3.4)'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T2.js new file mode 100644 index 000000000..25f8380b1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A3_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A3_T2; +* @section: 15.3.4, 15.3.2.1; +* @assertion: The value of the internal [[Prototype]] property of the Function prototype object is the Object prototype object (15.3.2.1); +* @description: Add new property to Object.prototype and check it at Function.prototype; +*/ + +Object.prototype.indicator = 1; + +//CHECK#1 +if (Function.prototype.indicator!==1) { + $ERROR('#1: The value of the internal [[Prototype]] property of the Function prototype object is the Object prototype object (15.3.2.1)'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A4.js new file mode 100644 index 000000000..06bd162fc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A4; +* @section: 15.3.4; +* @assertion: The Function prototype object does not have a valueOf property of its own. however, it inherits the valueOf property from the Object prototype Object; +* @description: Checking valueOf property at Function.prototype; +*/ + +//CHECK#1 +if (Function.prototype.hasOwnProperty("valueOf") !== false) { + $ERROR('#1: The Function prototype object does not have a valueOf property of its own'); +} + +//CHECK#2 +if (typeof Function.prototype.valueOf === "undefined") { + $ERROR('#2: however, it inherits the valueOf property from the Object prototype Object'); +} + +//CHECK#3 +if (Function.prototype.valueOf !== Object.prototype.valueOf) { + $ERROR('#3: however, it inherits the valueOf property from the Object prototype Object'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A5.js new file mode 100644 index 000000000..ce73a635e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4_A5.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.4_A5; +* @section: 15.3.4; +* @assertion: The Function prototype object is itself a Function object without [[create]] property; +* @description: Checking if creating "new Function.prototype object" fails; +*/ + +//CHECK# +try { + var obj = new Function.prototype; + $FAIL('#1: The Function prototype object is itself a Function object without [[create]] property: '+e); +} catch (e) { + $PRINT("#1.1: The Function prototype object is itself a Function object without [[create]] property "+e); + +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T1.js new file mode 100644 index 000000000..9f23a6efc --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T1.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. + +/** +* @name: S15.3.5.1_A1_T1; +* @section: 15.3.5.1; +* @assertion: The value of the length property is usually an integer +* that indicates the 'typical' number of arguments +* expected by the function; +* @description: Checking length property of Function("arg1,arg2,arg3", null); +*/ + +f = new Function("arg1,arg2,arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +//CHECK#2 +if (f.length !== 3) { + $ERROR('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T2.js new file mode 100644 index 000000000..96fa90f62 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_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. + +/** +* @name: S15.3.5.1_A1_T2; +* @section: 15.3.5.1; +* @assertion: The value of the length property is usually an integer that indicates the 'typical' number of arguments expected by the function; +* @description: Checking length property of Function("arg1,arg2,arg3","arg4,arg5", null); +*/ + +f = Function("arg1,arg2,arg3","arg4,arg5", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +//CHECK#2 +if (f.length !== 5) { + $ERROR('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T3.js new file mode 100644 index 000000000..aa74b24d8 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A1_T3.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. + +/** +* @name: S15.3.5.1_A1_T3; +* @section: 15.3.5.1; +* @assertion: The value of the length property is usually an integer that indicates the 'typical' number of arguments expected by the function; +* @description: Checking length property of Function("arg1,arg2,arg3","arg1,arg2","arg3", null); +*/ + +f = new Function("arg1,arg2,arg3","arg1,arg2","arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +//CHECK#2 +if (f.length !== 6) { + $ERROR('#2: The value of the length property is usually an integer that indicates the "typical" number of arguments expected by the function'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T1.js new file mode 100644 index 000000000..26985283a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T1.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. + +/** +* @name: S15.3.5.1_A2_T1; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontDelete }; +* @description: Checking if deleting the length property of Function("arg1,arg2,arg3", null) fails; +*/ + +f = new Function("arg1,arg2,arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +//CHECK#2 +if(delete f.length){ + $ERROR('#2: the function.length property has the attributes DontDelete.'); +} + +//CHECK#3 +if (!(f.hasOwnProperty('length'))) { + $ERROR('#3: the function.length property has the attributes DontDelete.'); +} + +//CHECK#4 +if (f.length !== 3) { + $ERROR('#4: the length property has the attributes { DontDelete }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T2.js new file mode 100644 index 000000000..2520357bd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_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. + +/** +* @name: S15.3.5.1_A2_T2; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontDelete }; +* @description: Checking if deleting the length property of Function("arg1,arg2,arg3","arg4,arg5", null) fails; +*/ + +f = Function("arg1,arg2,arg3","arg4,arg5", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +delete f.length; + +//CHECK#2 +if (!(f.hasOwnProperty('length'))) { + $ERROR('#2: the function.length property has the attributes DontDelete.'); +} + +//CHECK#3 +if (f.length !== 5) { + $ERROR('#3: the length property has the attributes { DontDelete }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_T3.js new file mode 100644 index 000000000..e5f878318 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A2_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. + +/** +* @name: S15.3.5.1_A2_T3; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontDelete }; +* @description: Checking if deleting the length property of Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails; +*/ + +f = new Function("arg1,arg2,arg3","arg1,arg2","arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +delete f.length; + +//CHECK#2 +if (!(f.hasOwnProperty('length'))) { + $ERROR('#2: the function.length property has the attributes DontDelete.'); +} + +//CHECK#3 +if (f.length !== 6) { + $ERROR('#3: the length property has the attributes { DontDelete }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T1.js new file mode 100644 index 000000000..0763b71f1 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T1.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. + +/** +* @name: S15.3.5.1_A3_T1; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { ReadOnly }; +* @description: Checking if varying the length property of Function("arg1,arg2,arg3","arg4,arg5", null) fails; +*/ + +f = new Function("arg1,arg2,arg3","arg4,arg5", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +length = f.length; + +f.length = function(){}; + +//CHECK#2 +if (f.length !== length) { + $ERROR('#2: the function.length property has the attributes ReadOnly'); +} + +//CHECK#3 +try { + f.length(); + $ERROR('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + ; +} + +//CHECK#4 +if (f.length !== 5) { + $ERROR('#4: the length property has the attributes { ReadOnly }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T2.js new file mode 100644 index 000000000..76c90d8ee --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_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. + +/** +* @name: S15.3.5.1_A3_T2; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { ReadOnly }; +* @description: Checking if varying the length property of Function("arg1,arg2,arg3", null) fails; +*/ + +f = Function("arg1,arg2,arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +length = f.length; + +f.length = function(){}; + +//CHECK#2 +if (f.length !== length) { + $ERROR('#2: the function.length property has the attributes ReadOnly'); +} + +//CHECK#3 +try { + f.length(); + $ERROR('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + ; +} + +//CHECK#4 +if (f.length !== 3) { + $ERROR('#4: the length property has the attributes { ReadOnly }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T3.js new file mode 100644 index 000000000..94ca3cf2a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A3_T3.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. + +/** +* @name: S15.3.5.1_A3_T3; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { ReadOnly }; +* @description: Checking if varying the length property of Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails; +*/ + +f = new Function("arg1,arg2,arg3","arg1,arg2","arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +length = f.length; + +f.length = function(){}; + +//CHECK#2 +if (f.length !== length) { + $ERROR('#2: the function.length property has the attributes ReadOnly'); +} + +//CHECK#3 +try { + f.length(); + $ERROR('#3: the function.length property has the attributes ReadOnly'); +} catch (e) { + ; +} + +//CHECK#4 +if (f.length !== 6) { + $ERROR('#4: the length property has the attributes { ReadOnly }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T1.js new file mode 100644 index 000000000..6dab79af5 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T1.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. + +/** +* @name: S15.3.5.1_A4_T1; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontEnum }; +* @description: Checking if enumerating the length property of Function("arg1,arg2,arg3", null) fails; +*/ + +f = new Function("arg1,arg2,arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +for(key in f) + if(key=="length") + var lengthenumed=true; + +//CHECK#2 +if (lengthenumed) { + $ERROR('#2: the length property has the attributes { DontEnum }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T2.js new file mode 100644 index 000000000..5fbc8190c --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_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. + +/** +* @name: S15.3.5.1_A4_T2; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontEnum }; +* @description: Checking if enumerating the length property of Function("arg1,arg2,arg3","arg4,arg5", null) fails; +*/ + +f = Function("arg1,arg2,arg3","arg5,arg4", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +for(key in f) + if(key=="length") + var lengthenumed=true; + +//CHECK#2 +if (lengthenumed) { + $ERROR('#2: the length property has the attributes { DontEnum }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_T3.js new file mode 100644 index 000000000..fe658c658 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.1_A4_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. + +/** +* @name: S15.3.5.1_A4_T3; +* @section: 15.3.5.1; +* @assertion: the length property has the attributes { DontEnum }; +* @description: Checking if enumerating the length property of Function("arg1,arg2,arg3","arg1,arg2","arg3", null) fails; +*/ + +f = new Function("arg1,arg2,arg3","arg1,arg2","arg3", null); + +//CHECK#1 +if (!(f.hasOwnProperty('length'))) { + $FAIL('#1: the function has length property.'); +} + +for(key in f) + if(key=="length") + var lengthenumed=true; + +//CHECK#2 +if (lengthenumed) { + $ERROR('#2: the length property has the attributes { DontEnum }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_T1.js new file mode 100644 index 000000000..4892494a0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_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. + +/** +* @name: S15.3.5.2_A1_T1; +* @section: 15.3.5.2; +* @assertion: the prototype property has the attributes { DontDelete }; +* @description: Checking if deleting the prototype property of Function("", null) fails; +*/ + +f = new Function("", null); + +//CHECK#1 +if (!(f.hasOwnProperty('prototype'))) { + $FAIL('#1: the function has length property.'); +} + +fproto = f.prototype; + +//CHECK#2 +if (delete f.prototype) { + $ERROR('#2: the prototype property has the attributes { DontDelete }'); +} + +//CHECK#3 +if (f.prototype !== fproto) { + $ERROR('#3: the prototype property has the attributes { DontDelete }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_T2.js new file mode 100644 index 000000000..a682d3c5b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.2_A1_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. + +/** +* @name: S15.3.5.2_A1_T2; +* @section: 15.3.5.2; +* @assertion: the prototype property has the attributes { DontDelete }; +* @description: Checking if deleting the prototype property of Function(void 0, "") fails; +*/ + +f = Function(void 0, ""); + +//CHECK#1 +if (!(f.hasOwnProperty('prototype'))) { + $FAIL('#1: the function has length property.'); +} + +fproto = f.prototype; + +//CHECK#2 +if (delete f.prototype) { + $ERROR('#2: the prototype property has the attributes { DontDelete }'); +} + +//CHECK#3 +if (f.prototype !== fproto) { + $ERROR('#3: the prototype property has the attributes { DontDelete }'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T1.js new file mode 100644 index 000000000..e091fed70 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T1.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T1; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is number; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((1 instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T2.js new file mode 100644 index 000000000..0975e8ade --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T2; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is string; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if (("1" instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T3.js new file mode 100644 index 000000000..9c98b88cf --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T3.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T3; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is boolean true; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((true instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T4.js new file mode 100644 index 000000000..5b74752f2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T4.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T4; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is boolean false; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((false instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T5.js new file mode 100644 index 000000000..110439ddd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T5.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T5; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is void 0; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((void 0 instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T6.js new file mode 100644 index 000000000..e2a3c5ce0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T6.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T6; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is null; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((null instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T7.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T7.js new file mode 100644 index 000000000..14319f1da --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T7.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T7; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is undefined; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((undefined instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T8.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T8.js new file mode 100644 index 000000000..067459c86 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A1_T8.js @@ -0,0 +1,18 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5.3_A1_T8; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false; +* @description: V is undefined variable; +*/ + +FACTORY = Function("name","this.name=name;"); + +//CHECK#1 +if ((x instanceof FACTORY)!==false) { + $ERROR('#1: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V, the following steps are taken: i) If V is not an object, return false'); +} + +var x; diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T2.js new file mode 100644 index 000000000..1e555f5d0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T2.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. + +/** +* @name: S15.3.5.3_A2_T2; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: +* i) Call the [[Get]] method of F with property name "prototype". +* ii) Let O be Result(i). +* iii) O is not an object, throw a TypeError exception; +* @description: F.prototype is undefined, and V is empty object; +*/ + +FACTORY = new Function; + +FACTORY.prototype = undefined; + +obj={}; + +//CHECK#1 +try { + obj instanceof FACTORY; + $FAIL('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: O is not an object, throw a TypeError exception'); + } +} + + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T5.js new file mode 100644 index 000000000..373c81efd --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T5.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. + +/** + * @name: S15.3.5.3_A2_T5; + * @section: 15.3.5.3, 11.8.6; + * @assertion: Assume F is a Function object. When the [[HasInstance]] method of + * F is called with value V and V is an object, the following steps + * are taken: i) Call the [[Get]] method of F with property name + * "prototype". ii) Let O be Result(i). iii) O is not an object, + * throw a TypeError exception; + * @description: F.prototype is void 0, and V is new F; + */ + +FACTORY = Function("this.prop=1;"); + +FACTORY.prototype.name = "fairy"; + +instance = new FACTORY; + +FACTORY.prototype = void 0; + +// CHECK#1 +try { + instance instanceof FACTORY; + $FAIL('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: O is not an object, throw a TypeError exception'); + } +} + +// CHECK#2 +if ((instance.constructor !== FACTORY) || (instance.name !== "fairy")) { + $ERROR('#2: instance.constructor === FACTORY'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T6.js new file mode 100644 index 000000000..eacf10907 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A2_T6.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. + +/** + * @name: S15.3.5.3_A2_T6; + * @section: 15.3.5.3, 11.8.6; + * @assertion: Assume F is a Function object. When the [[HasInstance]] method of + * F is called with value V and V is an object, the following steps + * are taken: i) Call the [[Get]] method of F with property name + * "prototype". ii) Let O be Result(i). iii) O is not an object, + * throw a TypeError exception; + * @description: F.prototype is string, and V is function; + */ + +FACTORY = new Function; + +FACTORY.prototype = "error"; + +// CHECK#1 +try { + ( function() { + }) instanceof FACTORY; + $FAIL('#1: O is not an object, throw a TypeError exception'); +} catch (e) { + if (!(e instanceof TypeError)) { + $ERROR('#1.1: O is not an object, throw a TypeError exception'); + } +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_T1.js new file mode 100644 index 000000000..0be22da8f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_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. + +/** +* @name: S15.3.5.3_A3_T1; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: +* i) Call the [[Get]] method of F with property name "prototype". +* ii) Let O be Result(i) and O is an object. +* iii) Let V be the value of the [[Prototype]] property of V. +* iv) If V is null, return false. +* v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true. +* vi) Go to step iii); +* @description: F.prototype.type is 1, and V is new F; +*/ + +FACTORY = Function("this.name=\"root\""); + +FACTORY.prototype.type=1; + +instance = new FACTORY; + +//CHECK#1 +if (!(instance instanceof FACTORY)) { + $ERROR('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_T2.js new file mode 100644 index 000000000..865a1dd7d --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5.3_A3_T2.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. + +/** +* @name: S15.3.5.3_A3_T2; +* @section: 15.3.5.3, 11.8.6; +* @assertion: Assume F is a Function object. When the [[HasInstance]] method of F is called with value V and V is an object, the following steps are taken: +* i) Call the [[Get]] method of F with property name "prototype". +* ii) Let O be Result(i) and O is an object. +* iii) Let V be the value of the [[Prototype]] property of V. +* iv) If V is null, return false. +* v) If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true. +* vi) Go to step iii); +* @description: F.prototype is Object.prototype, and V is empty object; +*/ + +FAKEFACTORY = Function(); + +fakeinstance = {}; + +//CHECK#1 +if (fakeinstance instanceof FAKEFACTORY) { + $ERROR('#1: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} + +FAKEFACTORY.prototype=Object.prototype; + +//CHECK#2 +if (!(fakeinstance instanceof FAKEFACTORY)) { + $ERROR('#2: If O and V refer to the same object or if they refer to objects joined to each other (13.1.2), return true'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T1.js new file mode 100644 index 000000000..51444367a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T1.js @@ -0,0 +1,15 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5_A1_T1; +* @section: 15.3.5; +* @assertion: The value of the [[Class]] property is "Function"; +* @description: For testing use variable f = new Function; +*/ + +var f = new Function; + +if (Object.prototype.toString.call(f) !== "[object Function]") { + $ERROR('#1: The value of the [[Class]] property is "Function"'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T2.js new file mode 100644 index 000000000..893dbc3ae --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A1_T2.js @@ -0,0 +1,16 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5_A1_T2; +* @section: 15.3.5; +* @assertion: The value of the [[Class]] property is "Function" ; +* @description: For testing use variable f = Function(); +*/ + +var f = Function(); + +if (Object.prototype.toString.call(f) !== "[object Function]") { + $ERROR('#1: The value of the [[Class]] property is "Function"'); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T1.js new file mode 100644 index 000000000..d012d07c7 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T1.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5_A2_T1; +* @section: 15.3.5; +* @assertion: Every function instance has a [[Call]] property ; +* @description: For testing call Function("var x =1; this.y=2;return \"OK\";")(); +*/ + +//CHECK#1 +if (Function("var x =1; this.y=2;return \"OK\";")() !== "OK") { + $ERROR('#1: Every function instance has a [[Call]] property'); +} + +//CHECK#2 +if (typeof x !== "undefined") { + $ERROR('#2: Every function instance has a [[Call]] property'); +} + +//CHECK#3 +if (y !== 2) { + $ERROR('#3: Every function instance has a [[Call]] property'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T2.js new file mode 100644 index 000000000..c4cbe77d0 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A2_T2.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.5_A2_T2; +* @section: 15.3.5; +* @assertion: Every function instance has a [[Call]] property ; +* @description: For testing call (new Function("arg1,arg2","var x =arg1; this.y=arg2;return arg1+arg2;"))("1",2); +*/ + +//CHECK#1 +if ((new Function("arg1,arg2","var x =arg1; this.y=arg2;return arg1+arg2;"))("1",2) !== "12") { + $ERROR('#1: Every function instance has a [[Call]] property'); +} + +//CHECK#2 +if (typeof x !== "undefined") { + $ERROR('#2: Every function instance has a [[Call]] property'); +} + +//CHECK#3 +if (y !== 2) { + $ERROR('#3: Every function instance has a [[Call]] property'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_T1.js new file mode 100644 index 000000000..e8e49477f --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_T1.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. + +/** +* @name: S15.3.5_A3_T1; +* @section: 15.3.5; +* @assertion: every function instance has a [[Construct]] property ; +* @description: As constructor use Function("var x =1; this.y=2;return \"OK\";"); +*/ + +FACTORY = Function("var x =1; this.y=2;return \"OK\";"); +obj = new FACTORY; + +//CHECK#1 +if (typeof obj !== "object") { + $ERROR('#1: every function instance has a [[Construct]] property'); +} + +//CHECK#2 +if (obj.constructor !== FACTORY) { + $ERROR('#2: every function instance has a [[Construct]] property'); +} + +//CHECK#3 +if (obj.y !== 2) { + $ERROR('#3: every function instance has a [[Construct]] property'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_T2.js new file mode 100644 index 000000000..a8fba239e --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/15.3.5_Properties_of_Function_Instances/S15.3.5_A3_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. + +/** +* @name: S15.3.5_A3_T2; +* @section: 15.3.5; +* @assertion: every function instance has a [[Construct]] property ; +* @description: As constructor use new Function("arg1,arg2","var x =1; this.y=arg1+arg2;return \"OK\";"); +*/ + +FACTORY = new Function("arg1,arg2","var x =1; this.y=arg1+arg2;return \"OK\";"); +obj = new FACTORY("1",2); + +//CHECK#1 +if (typeof obj !== "object") { + $ERROR('#1: every function instance has a [[Construct]] property'); +} + +//CHECK#2 +if (obj.constructor !== FACTORY) { + $ERROR('#2: every function instance has a [[Construct]] property'); +} + +//CHECK#3 +if (obj.y !== "12") { + $ERROR('#3: every function instance has a [[Construct]] property'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3.1_A1_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3.1_A1_T1.js new file mode 100644 index 000000000..d9d3e9269 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3.1_A1_T1.js @@ -0,0 +1,40 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3.1_A1_T1; +* @section: 15.3.1; +* @assertion: The function call Function(…) is equivalent to the object creation expression +* new Function(…) with the same arguments. +* @description: Create simple functions and check returned values; +*/ + +var f = Function("return arguments[0];"); + +//CHECK#1 +if (!(f instanceof Function)){ + $ERROR('#1: f instanceof Function'); +} + +//CHECK#2 +if (f(1) !== 1) { + $ERROR('#2: f(1) !== 1'); +} + +var g = new Function("return arguments[0];"); + + +//CHECK#3 +if (!(g instanceof Function)) { + $ERROR('#3: g instanceof Function'); +} + +//CHECK#4 +if (g("A") !== "A") { + $ERROR('#4: g("A") !== "A"'); +} + +//CHECK#5 +if (g("A") !== f("A")) { + $ERROR('#5: g("A") !== f("A")'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A1.js new file mode 100644 index 000000000..49a9ad72b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A1.js @@ -0,0 +1,17 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** + * @name: S15.3_A1; + * @section: 15.3; + * @assertion: Function is the property of global; + * @description: Compare Function with this.Function; + */ + +var obj = Function; + +var thisobj = this.Function; + +if (obj !== thisobj) { + $ERROR('Function is the property of global'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T1.js new file mode 100644 index 000000000..d69c14cac --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T1.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3_A2_T1; +* @section: 15.3, 10.2.3, 15.3.2.1; +* @assertion: Since applying the "call" method to Function constructor themself leads to creating a new function instance, the second argument must be a valid function body; +* @description: Checking if executing "Function.call(this, "var x / = 1;")" fails; +*/ + +//CHECK# +try{ + Function.call(this, "var x / = 1;"); +} catch(e){ + if (!(e instanceof SyntaxError)) { + $ERROR('#1: function body must be valid'); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T2.js new file mode 100644 index 000000000..4d3933dce --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A2_T2.js @@ -0,0 +1,19 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3_A2_T2; +* @section: 15.3, 10.2.3, 15.3.2.1; +* @assertion: Since applying the "call" method to Function constructor themself leads to creating a new function instance, the second argument must be a valid function body; +* @description: Checking if executing "Function.call(this, "var #x = 1;")" fails; +*/ + +//CHECK# +try{ + Function.call(this, "var #x = 1;"); +} catch(e){ + if (!(e instanceof SyntaxError)) { + $ERROR('#1: function body must be valid'); + } +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T1.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T1.js new file mode 100644 index 000000000..814d09620 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_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. + +/** +* @name: S15.3_A3_T1; +* @section: 15.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is object; +*/ + +//CHECK#1 +try{ + var f = Function.call(mars, "return name;"); + $ERROR('#1: When applied to the Function object itself, thisArg should be ignored'); +} catch(e){ + if (!(e instanceof ReferenceError)) { + $ERROR('#1.1: When applied to the Function object itself, thisArg should be ignored'); + } +} + +var mars={name:"mars", color:"red", number:4}; + +var f = Function.call(mars, "this.godname=\"ares\"; return this.color;"); + +var about_mars = f(); + +//CHECK#2 +if (about_mars !== undefined) { + $ERROR('#2: When applied to the Function object itself, thisArg should be ignored'); +} + +//CHECK#3 +if (this.godname !== "ares") { + $ERROR('#3: When applied to the Function object itself, thisArg should be ignored'); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T2.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T2.js new file mode 100644 index 000000000..cd05c0025 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_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. + +/** +* @name: S15.3_A3_T2; +* @section: 15.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is string and null; +*/ + +this.color="red"; +var name="mars"; + +var f = Function.call("blablastring", "return this.color;"); + +//CHECK#1 +if (f() !== "red") { + $ERROR('#1: '); +} + +var g = Function.call(null, "return this.name;"); + +//CHECK#2 +if (g() !== "mars") { + $ERROR('#2: '); +} + diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T3.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T3.js new file mode 100644 index 000000000..571656f5b --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T3.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. + +/** +* @name: S15.3_A3_T3; +* @section: 15.3, 10.2.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is this, and this don`t have needed variable; +*/ + +var f=Function.call(this, "return planet;"); +var g=Function.call(this, "return color;"); + +//CHECK#1 +try{ + f(); + $ERROR('#1: '); +} catch(e){ + if (!(e instanceof ReferenceError)) + $ERROR('#1.1: '); +} + +var planet="mars"; + +//CHECK#2 +if (f() !== "mars") { + $ERROR('#2: '); +} + +//CHECK#3 +try{ + g(); + $ERROR('#3: '); +} catch(e){ + if (!(e instanceof ReferenceError)) + $ERROR('#3.1: '); +} + +this.color="red"; + +//CHECK#4 +if (g() !== "red") { + $ERROR('#4: '); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T4.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T4.js new file mode 100644 index 000000000..a785a114a --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T4.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3_A3_T4; +* @section: 15.3, 10.2.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is this, and this have needed variable; +*/ + +var f=Function.call(this, "return planet;"); + +//CHECK#1 +if (f() !== undefined) { + $ERROR('#1: '); +} + +var planet="mars"; + +//CHECK#2 +if (f() !== "mars") { + $ERROR('#2: '); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T5.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T5.js new file mode 100644 index 000000000..4ee75c149 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T5.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. + +/** +* @name: S15.3_A3_T5; +* @section: 15.3, 10.2.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is this, and this don`t have needed variable. Function return this.var_name; +*/ + +var f=Function.call(this, "return this.planet;"); +var g=Function.call(this, "return this.color;"); + +//CHECK#1 +if (f() !== undefined) { + $ERROR('#2: '); +} + +var planet="mars"; + +//CHECK#2 +if (f() !== "mars") { + $ERROR('#2: '); +} + +//CHECK#3 +if (g() !== undefined) { + $ERROR('#3: '); +} + +this.color="red"; + +//CHECK#4 +if (g() !== "red") { + $ERROR('#4: '); +} diff --git a/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T6.js b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T6.js new file mode 100644 index 000000000..f9e21e5a2 --- /dev/null +++ b/external/contributions/Google/sputniktests/tests/Conformance/15_Native_ECMA_Script_Objects/15.3_Function_Objects/S15.3_A3_T6.js @@ -0,0 +1,24 @@ +// Copyright 2009 the Sputnik authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/** +* @name: S15.3_A3_T6; +* @section: 15.3, 10.2.3; +* @assertion: Since when call is used for Function constructor themself new function instance creates +* and then first argument(thisArg) should be ignored; +* @description: First argument is this, and this have needed variable. Function return this.var_name; +*/ + +var f=Function.call(this, "return this.planet;"); + +//CHECK#1 +if (f() !== undefined) { + $ERROR('#1: '); +} + +var planet="mars"; + +//CHECK#2 +if (f() !== "mars") { + $ERROR('#2: '); +} |