|
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 * |
|
8 * Date: 07 February 2003 |
|
9 * SUMMARY: Testing 0/0 inside functions |
|
10 * |
|
11 * See http://bugzilla.mozilla.org/show_bug.cgi?id=192288 |
|
12 * |
|
13 */ |
|
14 //----------------------------------------------------------------------------- |
|
15 var UBound = 0; |
|
16 var BUGNUMBER = 192288; |
|
17 var summary = 'Testing 0/0 inside functions '; |
|
18 var status = ''; |
|
19 var statusitems = []; |
|
20 var actual = ''; |
|
21 var actualvalues = []; |
|
22 var expect= ''; |
|
23 var expectedvalues = []; |
|
24 |
|
25 |
|
26 function f() |
|
27 { |
|
28 return 0/0; |
|
29 } |
|
30 |
|
31 status = inSection(1); |
|
32 actual = isNaN(f()); |
|
33 expect = true; |
|
34 addThis(); |
|
35 |
|
36 status = inSection(2); |
|
37 actual = isNaN(f.apply(this)); |
|
38 expect = true; |
|
39 addThis(); |
|
40 |
|
41 status = inSection(3); |
|
42 actual = isNaN(eval("f.apply(this)")); |
|
43 expect = true; |
|
44 addThis(); |
|
45 |
|
46 status = inSection(4); |
|
47 actual = isNaN(Function('return 0/0;')()); |
|
48 expect = true; |
|
49 addThis(); |
|
50 |
|
51 status = inSection(5); |
|
52 actual = isNaN(eval("Function('return 0/0;')()")); |
|
53 expect = true; |
|
54 addThis(); |
|
55 |
|
56 |
|
57 |
|
58 //----------------------------------------------------------------------------- |
|
59 test(); |
|
60 //----------------------------------------------------------------------------- |
|
61 |
|
62 |
|
63 |
|
64 function addThis() |
|
65 { |
|
66 statusitems[UBound] = status; |
|
67 actualvalues[UBound] = actual; |
|
68 expectedvalues[UBound] = expect; |
|
69 UBound++; |
|
70 } |
|
71 |
|
72 |
|
73 function test() |
|
74 { |
|
75 enterFunc('test'); |
|
76 printBugNumber(BUGNUMBER); |
|
77 printStatus(summary); |
|
78 |
|
79 for (var i=0; i<UBound; i++) |
|
80 { |
|
81 reportCompare(expectedvalues[i], actualvalues[i], statusitems[i]); |
|
82 } |
|
83 |
|
84 exitFunc ('test'); |
|
85 } |