Debian Codegraph @

rhino/testsrc/tests/ecma/Types/8.6.2.1-1.js

raw symbols SCIP
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 gTestfile = '8.6.2.1-1.js';
7
8 /**
9 File Name: 8.6.2.1-1.js
10 ECMA Section: 8.6.2.1 Get (Value)
11 Description:
12
13 When the [[Get]] method of O is called with property name P, the following
14 steps are taken:
15
16 1. If O doesn't have a property with name P, go to step 4.
17 2. Get the value of the property.
18 3. Return Result(2).
19 4. If the [[Prototype]] of O is null, return undefined.
20 5. Call the [[Get]] method of [[Prototype]] with property name P.
21 6. Return Result(5).
22
23 This tests [[Get]] (Value).
24
25 Author: [email protected]
26 Date: 12 november 1997
27 */
28 var SECTION = "8.6.2.1-1";
29 var VERSION = "ECMA_1";
30 startTest();
31
32 writeHeaderToLog( SECTION + " [[Get]] (Value)");
33
34 new TestCase( SECTION, "var OBJ = new MyObject(true); OBJ.valueOf()", true, eval("var OBJ = new MyObject(true); OBJ.valueOf()") );
35
36 new TestCase( SECTION, "var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()", Number.POSITIVE_INFINITY, eval("var OBJ = new MyObject(Number.POSITIVE_INFINITY); OBJ.valueOf()") );
37
38 new TestCase( SECTION, "var OBJ = new MyObject('string'); OBJ.valueOf()", 'string', eval("var OBJ = new MyObject('string'); OBJ.valueOf()") );
39
40 test();
41
42 function MyObject( value ) {
43 this.valueOf = new Function( "return this.value" );
44 this.value = value;
45 }