Debian Codegraph @

js/src/tests/test262/built-ins/RegExp/S15.10.3.1_A2_T1.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 If pattern is an object R whose [[Class]] property is "RegExp" and flags is defined, then
7 call the RegExp constructor (15.10.4.1), passing it the pattern and flags arguments and return the object constructed by that constructor
8 es5id: 15.10.3.1_A2_T1
9 description: >
10 Checking if using "1" as flags leads to throwing the correct
11 exception
12 ---*/
13
14 try {
15 throw new Test262Error('#1.1: RegExp(new RegExp("\\d"), "1")) throw SyntaxError. Actual: ' + (RegExp(new RegExp("\d"), "1")));
16 } catch (e) {
17 assert.sameValue(
18 e instanceof SyntaxError,
19 true,
20 'The result of evaluating (e instanceof SyntaxError) is expected to be true'
21 );
22 }
23
24 // TODO: Convert to assert.throws() format.
25
26 reportCompare(0, 0);