Debian Codegraph @

rhino/testsrc/tests/js1_5/Object/regress-465476.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 var gTestfile = 'regress-465476.js';
7 //-----------------------------------------------------------------------------
8 var BUGNUMBER = 465476;
9 var summary = '"-0" and "0" are distinct properties.';
10 var actual = '';
11 var expect = '';
12
13
14 //-----------------------------------------------------------------------------
15 test();
16 //-----------------------------------------------------------------------------
17
18 function test()
19 {
20 enterFunc ('test');
21 printBugNumber(BUGNUMBER);
22 printStatus (summary);
23
24 var x = { "0": 3, "-0": 7 };
25
26 expect = actual = 'No Exception';
27
28 try
29 {
30 if (!("0" in x))
31 throw "0 not in x";
32 if (!("-0" in x))
33 throw "-0 not in x";
34 delete x[0];
35 if ("0" in x)
36 throw "0 in x after delete";
37 if (!("-0" in x))
38 throw "-0 removed from x after unassociated delete";
39 delete x["-0"];
40 if ("-0" in x)
41 throw "-0 in x after delete";
42 x[0] = 3;
43 if (!("0" in x))
44 throw "0 not in x after insertion of 0 property";
45 if ("-0" in x)
46 throw "-0 in x after insertion of 0 property";
47 x["-0"] = 7;
48 if (!("-0" in x))
49 throw "-0 not in x after reinsertion";
50
51 var props = [];
52 for (var i in x)
53 props.push(i);
54 if (props.length !== 2)
55 throw "not all props found!";
56 }
57 catch(ex)
58 {
59 actual = ex + '';
60 }
61 reportCompare(expect, actual, summary);
62
63 exitFunc ('test');
64 }