Debian Codegraph @

share/tests/draft2019-09/optional/format/ecmascript-regex.json

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