tor-browser

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

negative.js (1661B)


      1 // Copyright (C) 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 esid: sec-assertion
      6 description: RegExp negative lookbehind
      7 info: |
      8  The production Assertion :: (?<!Disjunction) evaluates as follows:
      9    1. Evaluate Disjunction with -1 as its direction argument to obtain a Matcher m.
     10    2. Return an internal Matcher closure that takes two arguments, a State x and a
     11        Continuation c, and performs the following steps:
     12      a. Let d be a Continuation that always returns its State argument as a successful
     13          MatchResult.
     14      b. Call m(x, d) and let r be its result.
     15      c. If r is not failure, return failure.
     16      d. Call c(x) and return its result.
     17 features: [regexp-lookbehind]
     18 includes: [compareArray.js]
     19 ---*/
     20 
     21 assert.compareArray("abcdef".match(/(?<!abc)\w\w\w/), ["abc"], "#1");
     22 assert.compareArray("abcdef".match(/(?<!a.c)\w\w\w/), ["abc"], "#2");
     23 assert.compareArray("abcdef".match(/(?<!a\wc)\w\w\w/), ["abc"], "#3");
     24 assert.compareArray("abcdef".match(/(?<!a[a-z])\w\w\w/), ["abc"], "#4");
     25 assert.compareArray("abcdef".match(/(?<!a[a-z]{2})\w\w\w/), ["abc"], "#5");
     26 assert.sameValue("abcdef".match(/(?<!abc)def/), null, "#6");
     27 assert.sameValue("abcdef".match(/(?<!a.c)def/), null, "#7");
     28 assert.sameValue("abcdef".match(/(?<!a\wc)def/), null, "#8");
     29 assert.sameValue("abcdef".match(/(?<!a[a-z][a-z])def/), null, "#9");
     30 assert.sameValue("abcdef".match(/(?<!a[a-z]{2})def/), null, "#10");
     31 assert.sameValue("abcdef".match(/(?<!a{1}b{1})cde/), null, "#11");
     32 assert.sameValue("abcdef".match(/(?<!a{1}[a-z]{2})def/), null, "#12");
     33 
     34 reportCompare(0, 0);