3 function stringify(x) {
4 if (typeof x == "string")
9 function assert(actual, expected) {
10 if (actual !== expected)
11 throw Error("FAIL: expected " + stringify(expected) + ", actual " + stringify(actual));
14 function assertThrows(func, expectedErrMsg) {
18 throw("FAIL: did not throw");
20 actualErrMsg = e.toString();
22 assert(actualErrMsg, expectedErrMsg);
25 assert(RegExp.prototype instanceof RegExp, false);
27 assert(RegExp.prototype.flags, "");
28 assert(RegExp.prototype.global, void 0);
29 assert(RegExp.prototype.ignoreCase, void 0);
30 assert(RegExp.prototype.multiline, void 0);
31 assert(RegExp.prototype.unicode, void 0);
32 assert(RegExp.prototype.sticky, void 0);
33 assert(RegExp.prototype.source, "(?:)");
34 assert(RegExp.prototype.toString(), "/(?:)/");
36 assert(Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call({}), "");
39 Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call(1);
41 "TypeError: The RegExp.prototype.flags getter can only be called on an object");
44 Object.getOwnPropertyDescriptor(RegExp.prototype, 'ignoreCase').get.call({});
46 "TypeError: The RegExp.prototype.ignoreCase getter can only be called on a RegExp object");
49 Object.getOwnPropertyDescriptor(RegExp.prototype, 'multiline').get.call({});
51 "TypeError: The RegExp.prototype.multiline getter can only be called on a RegExp object");
54 Object.getOwnPropertyDescriptor(RegExp.prototype, 'unicode').get.call({});
56 "TypeError: The RegExp.prototype.unicode getter can only be called on a RegExp object");
59 Object.getOwnPropertyDescriptor(RegExp.prototype, 'sticky').get.call({});
61 "TypeError: The RegExp.prototype.sticky getter can only be called on a RegExp object");
64 Object.getOwnPropertyDescriptor(RegExp.prototype, 'source').get.call({});
66 "TypeError: The RegExp.prototype.source getter can only be called on a RegExp object");
69 Object.getOwnPropertyDescriptor(RegExp.prototype, 'toString').get.call({});
71 "TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(RegExp.prototype, 'toString').get.call')");