aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/sputnik_converted/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T2.js
blob: 817b73a0e87c3e72fc5cb654b29088696b411bd2 (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
// 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;
*/


// Converted for Test262 from original Sputnik source

ES5Harness.registerTest( {
id: "S15.3.4.1_A1_T2",

path: "TestCases/15_Native/15.3_Function_Objects/15.3.4_Properties_of_the_Function_Prototype_Object/S15.3.4.1_A1_T2.js",

assertion: "The initial value of Function.prototype.constructor is the built-in Function constructor",

description: "Create new Function.prototype.constructor object",

test: function testcase() {
   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"');
}

 }
});