| 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_T2 |
| 9 |
description: > |
| 10 |
Checking if using dafined variable "x = 1" as flags leads to |
| 11 |
throwing the correct exception |
| 12 |
---*/ |
| 13 |
|
| 14 |
var x = 1; |
| 15 |
|
| 16 |
//CHECK#1 |
| 17 |
try { |
| 18 |
$ERROR('#1.1: var x = 1; RegExp(/[a-b]?/, x) throw SyntaxError. Actual: ' + (RegExp(/[a-b]?/, x))); |
| 19 |
} catch (e) { |
| 20 |
if ((e instanceof SyntaxError) !== true) { |
| 21 |
$ERROR('#1.2: var x = 1; RegExp(/[a-b]?/, x) throw SyntaxError. Actual: ' + (e)); |
| 22 |
} |
| 23 |
} |