aboutsummaryrefslogtreecommitdiffstats
path: root/test/suite/sputnik_converted/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2.4_A2_T2.js
blob: 1e7d1d0db24beed25e456f5ecbd90cf56f5c1cb6 (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
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
* @name: S8.6.2.4_A2_T2;
* @section: 8.6.2.4, 12.6.4;
* @assertion: When the [[HasProperty]] method of O is called with property name P and if O has not a property with name P 
* then If the [[Prototype]] of O is null, return false or call the [[HasProperty]] method of [[Prototype]] with property name P;
* @description: Try find not existent property of any Object, but existent property of this Object prototype;
*/




// Converted for Test262 from original Sputnik source

ES5Harness.registerTest( {
id: "S8.6.2.4_A2_T2",

path: "TestCases/08_Types/8.6_The_Object_Type/8.6.2_Internal_Properties_and_Methods/S8.6.2.4_A2_T2.js",

assertion: "When the [[HasProperty]] method of O is called with property name P and if O has not a property with name P",

description: "Try find not existent property of any Object, but existent property of this Object prototype",

test: function testcase() {
   var __proto={phylum:"avis"};


//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (!("valueOf" in __proto)) {
  $ERROR('#1: var __proto={phylum:"avis"}; "valueOf" in __proto');
}
//
//////////////////////////////////////////////////////////////////////////////

function Robin(){this.name="robin"};
Robin.prototype=__proto;

var __my__robin = new Robin;

//////////////////////////////////////////////////////////////////////////////
//CHECK#2
if (!("phylum" in __my__robin)) {
  $ERROR('#2: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; "phylum" in __my__robin');
}
//
//////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////
//CHECK#3
if (__my__robin.hasOwnProperty("phylum")) {
  $ERROR('#3: var __proto={phylum:"avis"}; function Robin(){this.name="robin"}; Robin.prototype=__proto; var __my__robin = new Robin; __my__robin.hasOwnProperty("phylum") === false. Actual: ' + (__my__robin.hasOwnProperty("phylum")));
}
//
//////////////////////////////////////////////////////////////////////////////

 }
});