@@ -32,6 +32,39 @@ describe('suite', () => {
32
32
{ expectMatch : false , testLine : 'no' } ,
33
33
] ,
34
34
} ,
35
+ {
36
+ desc : 'parenthesis' ,
37
+ GREP : '(my test)' ,
38
+ regExpected : / m y t e s t .* / i,
39
+ cases : [
40
+ { expectMatch : true , testLine : 'hello my test' } ,
41
+ { expectMatch : false , testLine : 'my tes hello ' } ,
42
+ ] ,
43
+ } ,
44
+ {
45
+ desc : 'parenthesis several' ,
46
+ GREP : '!(my test)&!(his test)' ,
47
+ regExpected : / (? = .* ^ (? ! .* m y t e s t .* ) ) + (? = .* ^ (? ! .* h i s t e s t .* ) ) + .* / i,
48
+ cases : [
49
+ { expectMatch : true , testLine : 'her test' } ,
50
+ { expectMatch : false , testLine : 'my test' } ,
51
+ { expectMatch : false , testLine : 'his test' } ,
52
+ { expectMatch : true , testLine : 'his tesPP' } ,
53
+ ] ,
54
+ } ,
55
+ {
56
+ desc : 'parenthesis several complex' ,
57
+ GREP : '(((her)&!(my test|his test)))' ,
58
+ regExpected : / (? = .* h e r ) + (? = .* ^ (? ! .* ( m y t e s t | h i s t e s t ) .* ) ) + .* / i,
59
+ cases : [
60
+ { expectMatch : true , testLine : 'test her' } ,
61
+ { expectMatch : true , testLine : 'her test' } ,
62
+ { expectMatch : false , testLine : 'her his test' } ,
63
+ { expectMatch : false , testLine : 'her my test' } ,
64
+ { expectMatch : false , testLine : 'my test' } ,
65
+ { expectMatch : false , testLine : 'his test' } ,
66
+ ] ,
67
+ } ,
35
68
{
36
69
desc : 'tag with dot encoded' ,
37
70
GREP : '@test\\.1' ,
@@ -71,7 +104,7 @@ describe('suite', () => {
71
104
{
72
105
desc : 'or' ,
73
106
GREP : '@e2e|@regression' ,
74
- regExpected : / @ e 2 e | @ r e g r e s s i o n .* / i,
107
+ regExpected : / ( @ e 2 e | @ r e g r e s s i o n ) .* / i,
75
108
cases : [
76
109
{ expectMatch : true , testLine : 'sdd @e2e dsd' } ,
77
110
{ expectMatch : true , testLine : 'sd @regression' } ,
@@ -84,7 +117,7 @@ describe('suite', () => {
84
117
{
85
118
desc : 'or' ,
86
119
GREP : '@e2e/@regression' ,
87
- regExpected : / @ e 2 e | @ r e g r e s s i o n .* / i,
120
+ regExpected : / ( @ e 2 e | @ r e g r e s s i o n ) .* / i,
88
121
cases : [
89
122
{ expectMatch : true , testLine : 'sdd @e2e dsd' } ,
90
123
{ expectMatch : true , testLine : 'sd @regression' } ,
@@ -127,7 +160,7 @@ describe('suite', () => {
127
160
{
128
161
desc : 'tag and not' ,
129
162
GREP : '@test&!suite' ,
130
- regExpected : / (? = .* @ t e s t ) + ^ (? ! .* s u i t e ) + .* / i,
163
+ regExpected : / (? = .* @ t e s t ) + ^ (? ! .* s u i t e . * ) + .* / i,
131
164
cases : [
132
165
{ expectMatch : true , testLine : 'abc @test my world' } ,
133
166
{ expectMatch : true , testLine : '@test' } ,
@@ -140,7 +173,7 @@ describe('suite', () => {
140
173
{
141
174
desc : 'not and not' ,
142
175
GREP : '!@test&!@suite' ,
143
- regExpected : / (? = .* ^ (? ! .* @ t e s t ) + ^ (? ! .* @ s u i t e .* ) ) + .* / i,
176
+ regExpected : / (? = .* ^ (? ! .* @ t e s t ) + ^ (? ! .* @ s u i t e .* ) . * ) + .* / i,
144
177
cases : [
145
178
{ expectMatch : true , testLine : 'abc my world' } ,
146
179
{ expectMatch : false , testLine : '@test' } ,
@@ -154,9 +187,10 @@ describe('suite', () => {
154
187
{
155
188
desc : 'not and not Inversed' ,
156
189
GREP : '!(!@test&!@suite)' ,
157
- regExpected : / ^ (? ! .* (? = .* ^ (? ! .* @ t e s t ) + ^ (? ! .* @ s u i t .* ) ) + ) .* / i,
190
+ regExpected : / ^ (? ! .* (? = .* ^ (? ! .* @ t e s t ) + ^ (? ! .* @ s u i t e .* ) . * ) + . * ) .* / i,
158
191
cases : [
159
192
{ expectMatch : false , testLine : 'abc my world' } ,
193
+ { expectMatch : false , testLine : '@suit abc my' } ,
160
194
{ expectMatch : true , testLine : '@test' } ,
161
195
{ expectMatch : true , testLine : '@TEST' } ,
162
196
{ expectMatch : true , testLine : 'abc @test my suite' } ,
@@ -182,7 +216,7 @@ describe('suite', () => {
182
216
{
183
217
desc : 'not and or combination different order' ,
184
218
GREP : '(@suite|@tag)&!@test' ,
185
- regExpected : / (? = .* ( @ s u i t e | @ t a g ) ) + ^ (? ! .* @ t e s t ) + .* / i,
219
+ regExpected : / (? = .* ( @ s u i t e | @ t a g ) ) + ^ (? ! .* @ t e s t . * ) + .* / i,
186
220
cases : [
187
221
{ expectMatch : false , testLine : 'abc my @test world' } ,
188
222
{ expectMatch : false , testLine : 'abc @suite @tag my @test world' } ,
@@ -197,16 +231,15 @@ describe('suite', () => {
197
231
{
198
232
desc : 'and with parenthesis and or combination' ,
199
233
GREP : '(@test&@suite)|@tag' ,
200
- regExpected : / (? = .* ( @ t e s t ) + (? = .* @ s u i t e ) | @ t a g ) + .* / i,
234
+ regExpected : / ( ( ?= .* @ t e s t ) + (? = .* @ s u i t e ) + | @ t a g ) .* / i,
201
235
cases : [
202
236
{ expectMatch : true , testLine : 'abc my @test @world @suite' } ,
203
237
{ expectMatch : false , testLine : 'abc my @suite' } ,
204
238
{ expectMatch : false , testLine : 'abc my @test' } ,
205
239
{ expectMatch : true , testLine : 'abc my @tag' } ,
206
240
{ expectMatch : true , testLine : 'abc my @test @tag' } ,
207
241
{ expectMatch : true , testLine : 'abc@suite my @test @tag' } ,
208
- // this case does not work
209
- { expectMatch : true , testLine : '@suite @test' , fixThis : true , actualResult : false } ,
242
+ { expectMatch : true , testLine : '@suite @test' } ,
210
243
] ,
211
244
} ,
212
245
{
@@ -226,10 +259,11 @@ describe('suite', () => {
226
259
{
227
260
desc : 'not with parenthesis' ,
228
261
GREP : '!(@test&@suite)' ,
229
- regExpected : / ^ (? ! .* (? = .* @ t e s t ) + (? = .* @ s u i t ) + ) .* / i,
262
+ regExpected : / ^ (? ! .* (? = .* @ t e s t ) + (? = .* @ s u i t e ) + . * ) .* / i,
230
263
cases : [
231
264
{ expectMatch : false , testLine : '@test @suite' } ,
232
265
{ expectMatch : false , testLine : '@suite @test' } ,
266
+ { expectMatch : true , testLine : '@suit @test' } ,
233
267
{ expectMatch : true , testLine : 'no suite test' } ,
234
268
{ expectMatch : true , testLine : 'only @test' } ,
235
269
{ expectMatch : true , testLine : 'only @TEST' } ,
@@ -239,7 +273,6 @@ describe('suite', () => {
239
273
] )
240
274
. each ( t => [ { desc : `: '${ t . GREP } '` } ] )
241
275
. each ( t => t . cases )
242
-
243
276
// .only(t => t.id === '1')
244
277
. run ( t => {
245
278
const regActual = selectionTestGrep ( t . GREP ) ;
@@ -251,7 +284,7 @@ describe('suite', () => {
251
284
}
252
285
253
286
// remove actualResult when fixed
254
- if ( t . actualResult ?? t . expectMatch ) {
287
+ if ( t . expectMatch ) {
255
288
expect ( t . testLine ) . toMatch ( regActual ) ;
256
289
} else {
257
290
expect ( t . testLine ) . not . toMatch ( regActual ) ;
0 commit comments