@@ -26,19 +26,19 @@ describe('inputs', () => {
26
26
it ( 'charIn' , ( ) => {
27
27
const input = charIn ( 'fo]^' )
28
28
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\[fo\\\\\\]\\\\\\^\\]/' )
29
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '[fo\\]\\^]' > ( )
29
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '[fo\\]\\^]' > ( )
30
30
} )
31
31
it ( 'charNotIn' , ( ) => {
32
32
const input = charNotIn ( 'fo^-' )
33
33
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\[\\^fo\\\\\\^\\\\-\\]/' )
34
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '[^fo\\^\\-]' > ( )
34
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '[^fo\\^\\-]' > ( )
35
35
} )
36
36
it ( 'anyOf' , ( ) => {
37
37
const values = [ 'fo/o' , 'bar' , 'baz' , oneOrMore ( 'this' ) ] as const
38
38
const input = anyOf ( ...values )
39
39
const regexp = new RegExp ( input as any )
40
40
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(fo\\\\/o\\|bar\\|baz\\|\\(this\\)\\+\\)/' )
41
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '(fo\\/o|bar|baz|(this)+)' > ( )
41
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '(fo\\/o|bar|baz|(this)+)' > ( )
42
42
for ( const value of values . slice ( 0 , - 1 ) as string [ ] ) {
43
43
expect ( regexp . test ( value ) ) . toBeTruthy ( )
44
44
}
@@ -47,89 +47,89 @@ describe('inputs', () => {
47
47
it ( 'char' , ( ) => {
48
48
const input = char
49
49
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\./' )
50
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '.' > ( )
50
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '.' > ( )
51
51
} )
52
52
it ( 'maybe' , ( ) => {
53
53
const input = maybe ( 'foo' )
54
54
const regexp = new RegExp ( input as any )
55
55
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(foo\\)\\?/' )
56
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '(foo)?' > ( )
56
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '(foo)?' > ( )
57
57
} )
58
58
it ( 'oneOrMore' , ( ) => {
59
59
const input = oneOrMore ( 'foo' )
60
60
const regexp = new RegExp ( input as any )
61
61
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(foo\\)\\+/' )
62
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '(foo)+' > ( )
62
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '(foo)+' > ( )
63
63
} )
64
64
it ( 'exactly' , ( ) => {
65
65
const input = exactly ( 'fo?[a-z]{2}/o?' )
66
66
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot (
67
67
'/fo\\\\\\?\\\\\\[a-z\\\\\\]\\\\\\{2\\\\\\}\\\\/o\\\\\\?/'
68
68
)
69
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < 'fo\\?\\[a-z\\]\\{2\\}\\/o\\?' > ( )
69
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < 'fo\\?\\[a-z\\]\\{2\\}\\/o\\?' > ( )
70
70
} )
71
71
it ( 'word' , ( ) => {
72
72
const input = word
73
73
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\b\\\\w\\+\\\\b/' )
74
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\b\\w+\\b' > ( )
74
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\b\\w+\\b' > ( )
75
75
} )
76
76
it ( 'wordChar' , ( ) => {
77
77
const input = wordChar
78
78
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\w/' )
79
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\w' > ( )
79
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\w' > ( )
80
80
} )
81
81
it ( 'digit' , ( ) => {
82
82
const input = digit
83
83
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\d/' )
84
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\d' > ( )
84
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\d' > ( )
85
85
} )
86
86
it ( 'wordBoundary' , ( ) => {
87
87
const input = wordBoundary
88
88
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\b/' )
89
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\b' > ( )
89
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\b' > ( )
90
90
} )
91
91
it ( 'whitespace' , ( ) => {
92
92
const input = whitespace
93
93
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\s/' )
94
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\s' > ( )
94
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\s' > ( )
95
95
} )
96
96
it ( 'letter' , ( ) => {
97
97
const input = letter
98
98
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\[a-zA-Z\\]/' )
99
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '[a-zA-Z]' > ( )
99
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '[a-zA-Z]' > ( )
100
100
} )
101
101
it ( 'tab' , ( ) => {
102
102
const input = tab
103
103
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\t/' )
104
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\t' > ( )
104
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\t' > ( )
105
105
} )
106
106
it ( 'linefeed' , ( ) => {
107
107
const input = linefeed
108
108
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\n/' )
109
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\n' > ( )
109
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\n' > ( )
110
110
} )
111
111
it ( 'carriageReturn' , ( ) => {
112
112
const input = carriageReturn
113
113
expect ( new RegExp ( input as any ) ) . toMatchInlineSnapshot ( '/\\\\r/' )
114
- expectTypeOf ( extractRegExp ( input ) ) . toMatchTypeOf < '\\r' > ( )
114
+ expectTypeOf ( extractRegExp ( input ) ) . toEqualTypeOf < '\\r' > ( )
115
115
} )
116
116
it ( 'not' , ( ) => {
117
117
expect ( not . wordChar . toString ( ) ) . toMatchInlineSnapshot ( '"\\\\W"' )
118
- expectTypeOf ( extractRegExp ( not . wordChar ) ) . toMatchTypeOf < '\\W' > ( )
118
+ expectTypeOf ( extractRegExp ( not . wordChar ) ) . toEqualTypeOf < '\\W' > ( )
119
119
expect ( not . wordBoundary . toString ( ) ) . toMatchInlineSnapshot ( '"\\\\B"' )
120
- expectTypeOf ( extractRegExp ( not . wordBoundary ) ) . toMatchTypeOf < '\\B' > ( )
120
+ expectTypeOf ( extractRegExp ( not . wordBoundary ) ) . toEqualTypeOf < '\\B' > ( )
121
121
expect ( not . digit . toString ( ) ) . toMatchInlineSnapshot ( '"\\\\D"' )
122
- expectTypeOf ( extractRegExp ( not . digit ) ) . toMatchTypeOf < '\\D' > ( )
122
+ expectTypeOf ( extractRegExp ( not . digit ) ) . toEqualTypeOf < '\\D' > ( )
123
123
expect ( not . whitespace . toString ( ) ) . toMatchInlineSnapshot ( '"\\\\S"' )
124
- expectTypeOf ( extractRegExp ( not . whitespace ) ) . toMatchTypeOf < '\\S' > ( )
124
+ expectTypeOf ( extractRegExp ( not . whitespace ) ) . toEqualTypeOf < '\\S' > ( )
125
125
expect ( not . letter . toString ( ) ) . toMatchInlineSnapshot ( '"[^a-zA-Z]"' )
126
- expectTypeOf ( extractRegExp ( not . letter ) ) . toMatchTypeOf < '[^a-zA-Z]' > ( )
126
+ expectTypeOf ( extractRegExp ( not . letter ) ) . toEqualTypeOf < '[^a-zA-Z]' > ( )
127
127
expect ( not . tab . toString ( ) ) . toMatchInlineSnapshot ( '"[^\\\\t]"' )
128
- expectTypeOf ( extractRegExp ( not . tab ) ) . toMatchTypeOf < '[^\\t]' > ( )
128
+ expectTypeOf ( extractRegExp ( not . tab ) ) . toEqualTypeOf < '[^\\t]' > ( )
129
129
expect ( not . linefeed . toString ( ) ) . toMatchInlineSnapshot ( '"[^\\\\n]"' )
130
- expectTypeOf ( extractRegExp ( not . linefeed ) ) . toMatchTypeOf < '[^\\n]' > ( )
130
+ expectTypeOf ( extractRegExp ( not . linefeed ) ) . toEqualTypeOf < '[^\\n]' > ( )
131
131
expect ( not . carriageReturn . toString ( ) ) . toMatchInlineSnapshot ( '"[^\\\\r]"' )
132
- expectTypeOf ( extractRegExp ( not . carriageReturn ) ) . toMatchTypeOf < '[^\\r]' > ( )
132
+ expectTypeOf ( extractRegExp ( not . carriageReturn ) ) . toEqualTypeOf < '[^\\r]' > ( )
133
133
} )
134
134
} )
135
135
@@ -139,90 +139,90 @@ describe('chained inputs', () => {
139
139
const val = input . and ( 'test.js' )
140
140
const regexp = new RegExp ( val as any )
141
141
expect ( regexp ) . toMatchInlineSnapshot ( '/\\\\\\?test\\\\\\.js/' )
142
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '\\?test\\.js' > ( )
142
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '\\?test\\.js' > ( )
143
143
} )
144
144
it ( 'and.referenceTo' , ( ) => {
145
145
const val = input . as ( 'namedGroup' ) . and ( exactly ( 'any' ) ) . and . referenceTo ( 'namedGroup' )
146
146
const regexp = new RegExp ( val as any )
147
147
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\?<namedGroup>\\\\\\?\\)any\\\\k<namedGroup>/' )
148
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(?<namedGroup>\\?)any\\k<namedGroup>' > ( )
148
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(?<namedGroup>\\?)any\\k<namedGroup>' > ( )
149
149
} )
150
150
it ( 'or' , ( ) => {
151
151
const val = input . or ( 'test.js' )
152
152
const regexp = new RegExp ( val as any )
153
153
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\|test\\\\\\.js\\)/' )
154
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?|test\\.js)' > ( )
154
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?|test\\.js)' > ( )
155
155
} )
156
156
it ( 'after' , ( ) => {
157
157
const val = input . after ( 'test.js' )
158
158
const regexp = new RegExp ( val as any )
159
159
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\?<=test\\\\\\.js\\)\\\\\\?/' )
160
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(?<=test\\.js)\\?' > ( )
160
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(?<=test\\.js)\\?' > ( )
161
161
} )
162
162
it ( 'before' , ( ) => {
163
163
const val = input . before ( 'test.js' )
164
164
const regexp = new RegExp ( val as any )
165
165
expect ( regexp ) . toMatchInlineSnapshot ( '/\\\\\\?\\(\\?=test\\\\\\.js\\)/' )
166
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '\\?(?=test\\.js)' > ( )
166
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '\\?(?=test\\.js)' > ( )
167
167
} )
168
168
it ( 'notAfter' , ( ) => {
169
169
const val = input . notAfter ( 'test.js' )
170
170
const regexp = new RegExp ( val as any )
171
171
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\?<!test\\\\\\.js\\)\\\\\\?/' )
172
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(?<!test\\.js)\\?' > ( )
172
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(?<!test\\.js)\\?' > ( )
173
173
} )
174
174
it ( 'notBefore' , ( ) => {
175
175
const val = input . notBefore ( 'test.js' )
176
176
const regexp = new RegExp ( val as any )
177
177
expect ( regexp ) . toMatchInlineSnapshot ( '/\\\\\\?\\(\\?!test\\\\\\.js\\)/' )
178
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '\\?(?!test\\.js)' > ( )
178
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '\\?(?!test\\.js)' > ( )
179
179
} )
180
180
it ( 'times' , ( ) => {
181
181
const val = input . times ( 500 )
182
182
const regexp = new RegExp ( val as any )
183
183
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\)\\{500\\}/' )
184
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?){500}' > ( )
184
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?){500}' > ( )
185
185
} )
186
186
it ( 'times.any' , ( ) => {
187
187
const val = input . times . any ( )
188
188
const regexp = new RegExp ( val as any )
189
189
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\)\\*/' )
190
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?)*' > ( )
190
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?)*' > ( )
191
191
} )
192
192
it ( 'times.atLeast' , ( ) => {
193
193
const val = input . times . atLeast ( 2 )
194
194
const regexp = new RegExp ( val as any )
195
195
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\)\\{2,\\}/' )
196
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?){2,}' > ( )
196
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?){2,}' > ( )
197
197
} )
198
198
it ( 'times.between' , ( ) => {
199
199
const val = input . times . between ( 3 , 5 )
200
200
const regexp = new RegExp ( val as any )
201
201
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\)\\{3,5\\}/' )
202
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?){3,5}' > ( )
202
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?){3,5}' > ( )
203
203
} )
204
204
it ( 'optionally' , ( ) => {
205
205
const val = input . optionally ( )
206
206
const regexp = new RegExp ( val as any )
207
207
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\\\\\?\\)\\?/' )
208
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(\\?)?' > ( )
208
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(\\?)?' > ( )
209
209
} )
210
210
it ( 'as' , ( ) => {
211
211
const val = input . as ( 'test' )
212
212
const regexp = new RegExp ( val as any )
213
213
expect ( regexp ) . toMatchInlineSnapshot ( '/\\(\\?<test>\\\\\\?\\)/' )
214
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '(?<test>\\?)' > ( )
214
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '(?<test>\\?)' > ( )
215
215
} )
216
216
it ( 'at.lineStart' , ( ) => {
217
217
const val = input . at . lineStart ( )
218
218
const regexp = new RegExp ( val as any )
219
219
expect ( regexp ) . toMatchInlineSnapshot ( '/\\^\\\\\\?/' )
220
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '^\\?' > ( )
220
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '^\\?' > ( )
221
221
} )
222
222
it ( 'at.lineEnd' , ( ) => {
223
223
const val = input . at . lineEnd ( )
224
224
const regexp = new RegExp ( val as any )
225
225
expect ( regexp ) . toMatchInlineSnapshot ( '/\\\\\\?\\$/' )
226
- expectTypeOf ( extractRegExp ( val ) ) . toMatchTypeOf < '\\?$' > ( )
226
+ expectTypeOf ( extractRegExp ( val ) ) . toEqualTypeOf < '\\?$' > ( )
227
227
} )
228
228
} )
0 commit comments