aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/sputnik_converted/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A8_T3.js
blob: e0c58102ec5add12e6edfb86d341b9854d3eed27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S13.2.2_A8_T3;
* @section: 13.2.2;
* @assertion: When the [[Construct]] property for a Function object F is called: 
* A new native ECMAScript object is created. 
* Invoke the [[Call]] property of F, providing just created native ECMAScript object as the this value and providing the argument 
* list passed into [[Construct]] as the argument values. 
* If Type( [[Call]] returned) is an Function then return this just as obtained function;
* @description: Creating a function whose prototype contains declaration of another function defined by using Function.call method;
*/


// Converted for Test262 from original Sputnik source

ES5Harness.registerTest( {
id: "S13.2.2_A8_T3",

path: "TestCases/13_Function_Definition/13.2_Creating_Function_Objects/S13.2.2_A8_T3.js",

assertion: "When the [[Construct]] property for a Function object F is called:",

description: "Creating a function whose prototype contains declaration of another function defined by using Function.call method",

test: function testcase() {
   var __FRST="one";
var __SCND="two";

var __func = function(arg1, arg2){
	this.first=arg1;
	var __gunc = Function.call(this,"arg","return ++arg;");
	__gunc.prop=arg2;
    return __gunc;
	
};

var __instance = new __func(__FRST, __SCND);

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (__instance.first !== undefined) {
	$ERROR('#1: __instance.first === undefined. Actual: __instance.first ==='+__instance.first);
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (__instance.prop!==__SCND) {
	$ERROR('#2: __instance.prop === __SCND. Actual: __instance.prop ==='+__instance.prop);
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__instance(1)!== 2) {
	$ERROR('#2: __instance(1)=== 2. Actual: __instance(1) ==='+__instance(1));
}
//
//////////////////////////////////////////////////////////////////////////////


 }
});