js/src/tests/js1_8_5/extensions/clone-regexp.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:02bb64afd2cc
1 // |reftest| skip-if(!xulRuntime.shell)
2 // -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 // Any copyright is dedicated to the Public Domain.
4 // http://creativecommons.org/licenses/publicdomain/
5
6 function testRegExp(b) {
7 var a = deserialize(serialize(b));
8 assertEq(a === b, false);
9 assertEq(Object.getPrototypeOf(a), RegExp.prototype);
10 assertEq(Object.prototype.toString.call(a), "[object RegExp]");
11 for (p in a)
12 throw new Error("cloned RegExp should have no enumerable properties");
13
14 assertEq(a.source, b.source);
15 assertEq(a.global, b.global);
16 assertEq(a.ignoreCase, b.ignoreCase);
17 assertEq(a.multiline, b.multiline);
18 assertEq(a.sticky, b.sticky);
19 assertEq("expando" in a, false);
20 }
21
22 testRegExp(RegExp(""));
23 testRegExp(/(?:)/);
24 testRegExp(/^(.*)$/gimy);
25 testRegExp(RegExp.prototype);
26
27 var re = /\bx\b/gi;
28 re.expando = true;
29 testRegExp(re);
30 re.__proto__ = {};
31 testRegExp(re);
32
33 reportCompare(0, 0, 'ok');

mercurial