Debian Codegraph @

share/tests/draft7/optional/format/ecmascript-regex.json

raw
1 [
2 {
3 "description": "\\a is not an ECMA 262 control escape",
4 "schema": { "format": "regex" },
5 "tests": [
6 {
7 "description": "when used as a pattern",
8 "data": "\\a",
9 "valid": false
10 }
11 ]
12 },
13 {
14 "description": "Python-specific regular expression syntax is not valid ECMA 262",
15 "schema": { "format": "regex" },
16 "tests": [
17 {
18 "description": "Python named group (?P<name>...) is not ECMA 262",
19 "data": "(?P<name>x)",
20 "valid": false
21 },
22 {
23 "description": "Python named backreference (?P=name) is not ECMA 262",
24 "data": "(?P<n>a)(?P=n)",
25 "valid": false
26 },
27 {
28 "description": "inline comment group (?#...) is not ECMA 262",
29 "data": "(?#comment)a",
30 "valid": false
31 }
32 ]
33 },
34 {
35 "description": "global inline flag groups are not valid ECMA 262",
36 "schema": { "format": "regex" },
37 "tests": [
38 {
39 "description": "a single global inline flag (?i)",
40 "data": "(?i)abc",
41 "valid": false
42 },
43 {
44 "description": "multiple global inline flags (?ims)",
45 "data": "(?ims)abc",
46 "valid": false
47 }
48 ]
49 },
50 {
51 "description": "ECMA 262 named groups and backreferences are valid",
52 "schema": { "format": "regex" },
53 "tests": [
54 {
55 "description": "an ECMA 262 named group (?<name>...)",
56 "data": "(?<name>x)",
57 "valid": true
58 },
59 {
60 "description": "an ECMA 262 named backreference \\k<name>",
61 "data": "(?<n>a)\\k<n>",
62 "valid": true
63 }
64 ]
65 },
66 {
67 "description": "ECMA 262 lookbehind is valid, including variable width",
68 "schema": { "format": "regex" },
69 "tests": [
70 {
71 "description": "a variable-width lookbehind (ES2018)",
72 "data": "(?<=a+)b",
73 "valid": true
74 }
75 ]
76 },
77 {
78 "description": "ECMA 262 character classes and escapes",
79 "schema": { "format": "regex" },
80 "tests": [
81 {
82 "description": "an empty character class is valid ECMA 262",
83 "data": "[]",
84 "valid": true
85 },
86 {
87 "description": "a negated empty character class is valid ECMA 262",
88 "data": "[^]",
89 "valid": true
90 },
91 {
92 "description": "a control escape \\cA is valid ECMA 262",
93 "data": "\\cA",
94 "valid": true
95 }
96 ]
97 }
98 ]