Debian Codegraph @

js/src/tests/test262/built-ins/RegExp/S15.10.4.1_A2_T2.js

raw
1 // Copyright 2009 the Sputnik authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
3
4 /*---
5 info: |
6 pattern is an object R whose [[Class]] property is "RegExp" and flags
7 is not undefined. If ToString(pattern) is not a valid flags arguments,
8 then throw a SyntaxError exception
9 es5id: 15.10.4.1_A2_T2
10 description: >
11 Checking if execution of "new RegExp(pattern, {})", where the
12 pattern is "/1?1/mig", fails
13 ---*/
14
15 try {
16 throw new Test262Error('#1.1: new RegExp(/1?1/mig, {}) throw SyntaxError. Actual: ' + (new RegExp(/1?1/mig, {})));
17 } catch (e) {
18 assert.sameValue(
19 e instanceof SyntaxError,
20 true,
21 'The result of evaluating (e instanceof SyntaxError) is expected to be true'
22 );
23 }
24
25 // TODO: Convert to assert.throws() format.
26
27 reportCompare(0, 0);