|
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 //----------------------------------------------------------------------------- |
|
7 var BUGNUMBER = 381304; |
|
8 var summary = 'getter/setter with keywords'; |
|
9 var actual = ''; |
|
10 var expect = ''; |
|
11 |
|
12 |
|
13 //----------------------------------------------------------------------------- |
|
14 test(); |
|
15 //----------------------------------------------------------------------------- |
|
16 |
|
17 function test() |
|
18 { |
|
19 enterFunc ('test'); |
|
20 printBugNumber(BUGNUMBER); |
|
21 printStatus (summary); |
|
22 |
|
23 var obj; |
|
24 |
|
25 print('1'); |
|
26 |
|
27 obj = { |
|
28 set inn(value) {this.for = value;}, |
|
29 get inn() {return this.for;} |
|
30 }; |
|
31 |
|
32 expect = '({get inn() { return this.for; }, set inn(value) { this.for = value; } })'; |
|
33 actual = obj.toSource(); |
|
34 compareSource(expect, actual, summary + ': 1'); |
|
35 |
|
36 print('2'); |
|
37 |
|
38 obj = { |
|
39 set in(value) {this.for = value;}, |
|
40 get in() {return this.for;} |
|
41 }; |
|
42 |
|
43 expect = '({ get in() { return this.for; }, set in(value) { this.for = value; } })'; |
|
44 actual = obj.toSource(); |
|
45 compareSource(expect, actual, summary + ': 2'); |
|
46 |
|
47 print('3'); |
|
48 |
|
49 obj = { |
|
50 set inn(value) {this.for = value;}, |
|
51 get in() {return this.for;} |
|
52 }; |
|
53 |
|
54 expect = '({ set inn(value) { this.for = value; }, get in() { return this.for; } })'; |
|
55 actual = obj.toSource(); |
|
56 compareSource(expect, actual, summary + ': 4'); |
|
57 |
|
58 print('4'); |
|
59 |
|
60 obj = { |
|
61 set in(value) {this.for = value;}, |
|
62 get inn() {return this.for;} |
|
63 }; |
|
64 |
|
65 expect = ' ({ set in(value) { this.for = value; }, get inn() { return this.for; } })'; |
|
66 actual = obj.toSource(); |
|
67 compareSource(expect, actual, summary + ': 5'); |
|
68 exitFunc ('test'); |
|
69 } |