| 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 |
description: Without the dotAll flag, . does not match newlines |
| 6 |
info: | |
| 7 |
21.2.2.8 Atom |
| 8 |
The production Atom::. evaluates as follows: |
| 9 |
1. If DotAll is true, then |
| 10 |
a. Let A be the set of all characters. |
| 11 |
2. Otherwise, let A be the set of all characters except LineTerminator. |
| 12 |
3. Call CharacterSetMatcher(A, false) and return its Matcher result. |
| 13 |
|
| 14 |
esid: sec-atom |
| 15 |
features: [u180e] |
| 16 |
---*/ |
| 17 |
|
| 18 |
// The behavior is the same regardless of the m flag |
| 19 |
for (let re of [/^.$/, /^.$/m]) { |
| 20 |
assert(re.test("a")); |
| 21 |
assert(re.test("3")); |
| 22 |
assert(re.test("π")); |
| 23 |
assert(re.test("\u2027")); |
| 24 |
assert(re.test("\u0085")); |
| 25 |
assert(re.test("\v")); |
| 26 |
assert(re.test("\f")); |
| 27 |
assert(re.test("\u180E")); |
| 28 |
assert(!re.test("\u{10300}"), "Supplementary plane matched by a single ."); |
| 29 |
assert(!re.test("\n")); |
| 30 |
assert(!re.test("\r")); |
| 31 |
assert(!re.test("\u2028")); |
| 32 |
assert(!re.test("\u2029")); |
| 33 |
assert(re.test("\uD800")); |
| 34 |
assert(re.test("\uDFFF")); |
| 35 |
} |