summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/regexp-modifiers-dotall.js
blob: 70c379c2e8e6f5bc73336d9cadfcbec35f7cc030 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Flags: --regexp-mode-modifiers

// S flag switches dotall mode on and off.  Combine with i flag changes to test
// the parser.
test(/.(?s).(?i-s).a(?-i)a/);
test(/.(?s:.)(?i:.a)a/);
test(/.(?s).(?i-s).a(?-i)a/u);
test(/.(?s:.)(?i:.a)a/u);

// m flag makes no difference
test(/.(?sm).(?i-s).a(?-i)a/);
test(/.(?s:.)(?i:.a)a/);
test(/.(?sm).(?im-s).a(?m-i)a/u);
test(/.(?s:.)(?i:.a)a/u);

function test(re) {
  assertTrue(re.test("...aa"));
  assertTrue(re.test(".\n.aa"));
  assertTrue(re.test(".\n.Aa"));
  assertFalse(re.test("\n\n.Aa"));
  assertFalse(re.test(".\n\nAa"));
  assertFalse(re.test(".\n.AA"));
}