tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

S15.10.3.1_A2_T2.js (895B)


      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 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  );
     24 }
     25 
     26 // TODO: Convert to assert.throws() format.
     27 
     28 reportCompare(0, 0);