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/. */
9
* SUMMARY: Testing |with (f)| inside the definition of |function f()|
11
* See http://bugzilla.mozilla.org/show_bug.cgi?id=208496
13
* In this test, we check that static function properties of
14
* of |f| are read correctly from within the |with(f)| block.
17
//-----------------------------------------------------------------------------
19
var BUGNUMBER = 208496;
20
var summary = 'Testing |with (f)| inside the definition of |function f()|';
21
var STATIC_VALUE = 'read the static property';
24
var actual = '(TEST FAILURE)';
25
var actualvalues = [];
27
var expectedvalues = [];
42
status = inSection(1);
43
f('abc'); // this sets |actual| inside |f|
44
expect = STATIC_VALUE;
47
// test the return: should be the dynamic value
48
status = inSection(2);
53
status = inSection(3);
54
f(111 + 222); // sets |actual| inside |f|
55
expect = STATIC_VALUE;
58
// test the return: should be the dynamic value
59
status = inSection(4);
60
actual = f(111 + 222);
66
* Add a level of indirection via |x|
81
status = inSection(5);
82
g('abc'); // this sets |actual| inside |g|
83
expect = STATIC_VALUE;
86
// test the return: should be the dynamic value
87
status = inSection(6);
92
status = inSection(7);
93
g(111 + 222); // sets |actual| inside |g|
94
expect = STATIC_VALUE;
97
// test the return: should be the dynamic value
98
status = inSection(8);
99
actual = g(111 + 222);
105
//-----------------------------------------------------------------------------
107
//-----------------------------------------------------------------------------
113
statusitems[UBound] = status;
114
actualvalues[UBound] = actual;
115
expectedvalues[UBound] = expect;
123
printBugNumber(BUGNUMBER);
124
printStatus(summary);
126
for (var i=0; i<UBound; i++)
128
reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]);