js/src/tests/test262/ch08/8.7/S8.7_A7.js

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:124ac298f4d0
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /**
5 * Passing arguments by reference do change values of reference to be passed
6 *
7 * @path ch08/8.7/S8.7_A7.js
8 * @description Add new property to original variable inside function
9 */
10
11 var n = {};
12 var m = n;
13
14 //////////////////////////////////////////////////////////////////////////////
15 //CHECK#1
16 if (typeof m !== "object") {
17 $ERROR('#1: var n = {}; var m = n; typeof m === "object". Actual: ' + (typeof m));
18 }
19 //
20 //////////////////////////////////////////////////////////////////////////////
21
22 function populateAge(person){person.age = 50;}
23
24 populateAge(m);
25
26 //////////////////////////////////////////////////////////////////////////////
27 //CHECK#2
28 if (n.age !== 50) {
29 $ERROR('#2: var n = {}; var m = n; function populateAge(person){person.age = 50;} populateAge(m); n.age === 50. Actual: ' + (n.age));
30 }
31
32 //
33 //////////////////////////////////////////////////////////////////////////////
34
35

mercurial