@@ -207,11 +207,7 @@ describe('size', () => {
207
207
208
208
describe ( 'rewrite rules' , ( ) => {
209
209
210
- // TODO:
211
- // - test intersection/complement rules.
212
- // - test rules involving epsilon / empty set
213
- // (can't be tested right now because parser does not
214
- // support empty set `$.^` and epsilon `()`.
210
+ // TODO: test intersection/complement rules.
215
211
216
212
const rewriteCases = [
217
213
// concat rules:
@@ -225,8 +221,6 @@ describe('rewrite rules', () => {
225
221
[ / ^ a ? a ? $ / , / ^ ( a ? ) { 2 } $ / ] ,
226
222
[ / ^ ( ) a $ / , / ^ a $ / ] ,
227
223
[ / ^ a ( ) $ / , / ^ a $ / ] ,
228
- // TODO:
229
- // [/^a($.^)$/, /$.^/],
230
224
// union rules:
231
225
[ / ^ ( a | a ) $ / , / ^ a $ / ] ,
232
226
// expected expression:
@@ -245,12 +239,15 @@ describe('rewrite rules', () => {
245
239
[ / ^ ( b a | a ) $ / , / ^ b ? a $ / ] ,
246
240
[ / ^ ( a | a b ) $ / , / ^ a b ? $ / ] ,
247
241
[ / ^ ( a | b a ) $ / , / ^ b ? a $ / ] ,
242
+ // union-of-star rules:
243
+ [ / ^ ( a * | ) $ / , / ^ a * $ / ] ,
248
244
// TODO:
249
245
// [/^(a|a{2}|a{3}|a{4}|a{5})$/, /^(a{1,5})$/],
250
246
// [/^(a|a{2}|a{3}|a{4}|a{5}|b)$/, /^(a{1,5}|b)$/],
251
247
// star rules:
252
248
[ / ^ ( a * ) * $ / , / ^ a * $ / ] ,
253
249
[ / ^ ( a * b * ) * $ / , / ^ [ a b ] * $ / ] ,
250
+ [ / ^ ( ) * $ / , / ^ $ / ] ,
254
251
] as const
255
252
256
253
for ( const [ source , target ] of rewriteCases ) {
@@ -275,7 +272,7 @@ describe('derivative', () => {
275
272
276
273
for ( const [ input , str , expected ] of derivativeCases ) {
277
274
it ( `of ${ input } with respect to "${ str } " is ${ expected } ` , ( ) => {
278
- const actual = RE . derivative ( str , AST . toExtRegex ( parseRegExp ( input ) ) )
275
+ const actual = RE . derivative ( str , AST . toExtRegex ( parseRegExp ( input ) ) )
279
276
assert ( RE . isStdRegex ( actual ) )
280
277
assert . deepEqual ( RE . toRegExp ( actual ) , expected )
281
278
} )
0 commit comments