@@ -19,6 +19,22 @@ describe("parseRegExpLiteral function:", () => {
19
19
const options = fixture . options
20
20
21
21
describe ( `${ filename } (options=${ JSON . stringify ( options ) } )` , ( ) => {
22
+ if ( filename . indexOf ( "-valid" ) !== - 1 ) {
23
+ it ( "should not contain any invalid test case" , ( ) => {
24
+ for ( const source of Object . keys ( fixture . patterns ) ) {
25
+ const result = fixture . patterns [ source ]
26
+ assert ( "ast" in result , `${ source } is invalid` )
27
+ }
28
+ } )
29
+ } else if ( filename . indexOf ( "-invalid" ) !== - 1 ) {
30
+ it ( "should not contain any valid test case" , ( ) => {
31
+ for ( const source of Object . keys ( fixture . patterns ) ) {
32
+ const result = fixture . patterns [ source ]
33
+ assert ( "error" in result , `${ source } is valid` )
34
+ }
35
+ } )
36
+ }
37
+
22
38
for ( const source of Object . keys ( fixture . patterns ) ) {
23
39
const result = fixture . patterns [ source ]
24
40
if ( "ast" in result ) {
@@ -58,27 +74,3 @@ describe("parseRegExpLiteral function:", () => {
58
74
assert . deepStrictEqual ( actual , expected )
59
75
} )
60
76
} )
61
-
62
- for ( const filename of Object . keys ( Fixtures ) ) {
63
- const fixture = Fixtures [ filename ]
64
-
65
- if ( filename . indexOf ( "-valid" ) !== - 1 ) {
66
- describe ( filename , ( ) => {
67
- it ( "should not contain any invalid test case" , ( ) => {
68
- for ( const source of Object . keys ( fixture . patterns ) ) {
69
- const result = fixture . patterns [ source ]
70
- assert ( "ast" in result , `${ source } is invalid` )
71
- }
72
- } )
73
- } )
74
- } else if ( filename . indexOf ( "-invalid" ) !== - 1 ) {
75
- describe ( filename , ( ) => {
76
- it ( "should not contain any valid test case" , ( ) => {
77
- for ( const source of Object . keys ( fixture . patterns ) ) {
78
- const result = fixture . patterns [ source ]
79
- assert ( "error" in result , `${ source } is valid` )
80
- }
81
- } )
82
- } )
83
- }
84
- }
0 commit comments