Bug 1892041 - Part 2: Update test262. r=spidermonkey-reviewers,dminor
[gecko.git] / js / src / tests / test262 / built-ins / RegExp / S15.10.3.1_A2_T2.js
blob9b4b4c8bc1414d215045134d492af8538a01cd49
1 // Copyright 2009 the Sputnik authors.  All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
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_T2
9 description: >
10     Checking if using dafined variable "x = 1" as flags leads to
11     throwing the correct exception
12 ---*/
14 var x = 1;
16 try {
17     throw new Test262Error('#1.1: var x = 1; RegExp(/[a-b]?/, x) throw SyntaxError. Actual: ' + (RegExp(/[a-b]?/, x)));
18 } catch (e) {
19   assert.sameValue(
20     e instanceof SyntaxError,
21     true,
22     'The result of evaluating (e instanceof SyntaxError) is expected to be true'
23   );
26 // TODO: Convert to assert.throws() format.
28 reportCompare(0, 0);