tor-browser

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

duplicate-flags.js (1452B)


      1 // Copyright 2017 the V8 project authors.  All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 info: |
      6    RegExpInitialize ( obj, pattern, flags )
      7      5. If F contains any code unit other than "g", "i", "m", "s", "u", or "y" or if it contains the same code unit more than once, throw a SyntaxError exception.
      8 esid: sec-regexpinitialize
      9 description: Check that duplicate RegExp flags are disallowed
     10 features: [regexp-dotall, regexp-match-indices]
     11 ---*/
     12 
     13 new RegExp("", "mig"); // single g will not throw SyntaxError
     14 assert.throws(SyntaxError, () => new RegExp("", "migg"), "duplicate g");
     15 
     16 new RegExp("", "i"); // single i will not throw SyntaxError
     17 assert.throws(SyntaxError, () => new RegExp("", "ii"), "duplicate i");
     18 
     19 new RegExp("", "m"); // single m will not throw SyntaxError
     20 assert.throws(SyntaxError, () => new RegExp("", "mm"), "duplicate m");
     21 
     22 new RegExp("", "s"); // single s will not throw SyntaxError
     23 assert.throws(SyntaxError, () => new RegExp("", "ss"), "duplicate s");
     24 
     25 new RegExp("", "u"); // single u will not throw SyntaxError
     26 assert.throws(SyntaxError, () => new RegExp("", "uu"), "duplicate u");
     27 
     28 new RegExp("", "y"); // single y will not throw SyntaxError
     29 assert.throws(SyntaxError, () => new RegExp("", "yy"), "duplicate y");
     30 
     31 new RegExp("", "d"); // single d will not throw SyntaxError
     32 assert.throws(SyntaxError, () => new RegExp("", "dd"), "duplicate d");
     33 
     34 reportCompare(0, 0);