@@ -62,6 +62,14 @@ ruleTester.run("generator-star-spacing", rule, {
62
62
code : "class Foo { static *foo(){} }" ,
63
63
parserOptions : { ecmaVersion : 6 }
64
64
} ,
65
+ {
66
+ code : "var foo = {*[ foo ](){} };" ,
67
+ parserOptions : { ecmaVersion : 6 }
68
+ } ,
69
+ {
70
+ code : "class Foo {*[ foo ](){} }" ,
71
+ parserOptions : { ecmaVersion : 6 }
72
+ } ,
65
73
66
74
// "before"
67
75
{
@@ -113,6 +121,16 @@ ruleTester.run("generator-star-spacing", rule, {
113
121
options : [ "before" ] ,
114
122
parserOptions : { ecmaVersion : 6 }
115
123
} ,
124
+ {
125
+ code : "class Foo {*[ foo ](){} }" ,
126
+ options : [ "before" ] ,
127
+ parserOptions : { ecmaVersion : 6 }
128
+ } ,
129
+ {
130
+ code : "var foo = {*[ foo ](){} };" ,
131
+ options : [ "before" ] ,
132
+ parserOptions : { ecmaVersion : 6 }
133
+ } ,
116
134
117
135
// "after"
118
136
{
@@ -164,6 +182,16 @@ ruleTester.run("generator-star-spacing", rule, {
164
182
options : [ "after" ] ,
165
183
parserOptions : { ecmaVersion : 6 }
166
184
} ,
185
+ {
186
+ code : "var foo = {* [foo](){} };" ,
187
+ options : [ "after" ] ,
188
+ parserOptions : { ecmaVersion : 6 }
189
+ } ,
190
+ {
191
+ code : "class Foo {* [foo](){} }" ,
192
+ options : [ "after" ] ,
193
+ parserOptions : { ecmaVersion : 6 }
194
+ } ,
167
195
168
196
// "both"
169
197
{
@@ -215,6 +243,16 @@ ruleTester.run("generator-star-spacing", rule, {
215
243
options : [ "both" ] ,
216
244
parserOptions : { ecmaVersion : 6 }
217
245
} ,
246
+ {
247
+ code : "var foo = {* [foo](){} };" ,
248
+ options : [ "both" ] ,
249
+ parserOptions : { ecmaVersion : 6 }
250
+ } ,
251
+ {
252
+ code : "class Foo {* [foo](){} }" ,
253
+ options : [ "both" ] ,
254
+ parserOptions : { ecmaVersion : 6 }
255
+ } ,
218
256
219
257
// "neither"
220
258
{
@@ -266,6 +304,16 @@ ruleTester.run("generator-star-spacing", rule, {
266
304
options : [ "neither" ] ,
267
305
parserOptions : { ecmaVersion : 6 }
268
306
} ,
307
+ {
308
+ code : "var foo = {*[ foo ](){} };" ,
309
+ options : [ "neither" ] ,
310
+ parserOptions : { ecmaVersion : 6 }
311
+ } ,
312
+ {
313
+ code : "class Foo {*[ foo ](){} }" ,
314
+ options : [ "neither" ] ,
315
+ parserOptions : { ecmaVersion : 6 }
316
+ } ,
269
317
270
318
// {"before": true, "after": false}
271
319
{
@@ -616,6 +664,26 @@ ruleTester.run("generator-star-spacing", rule, {
616
664
type : "Punctuator"
617
665
} ]
618
666
} ,
667
+ {
668
+ code : "var foo = {* [ foo ](){} };" ,
669
+ output : "var foo = {*[ foo ](){} };" ,
670
+ options : [ "before" ] ,
671
+ parserOptions : { ecmaVersion : 6 } ,
672
+ errors : [ {
673
+ message : "Unexpected space after *." ,
674
+ type : "Punctuator"
675
+ } ]
676
+ } ,
677
+ {
678
+ code : "class Foo {* [ foo ](){} }" ,
679
+ output : "class Foo {*[ foo ](){} }" ,
680
+ options : [ "before" ] ,
681
+ parserOptions : { ecmaVersion : 6 } ,
682
+ errors : [ {
683
+ message : "Unexpected space after *." ,
684
+ type : "Punctuator"
685
+ } ]
686
+ } ,
619
687
620
688
// "after"
621
689
{
@@ -700,6 +768,26 @@ ruleTester.run("generator-star-spacing", rule, {
700
768
type : "Punctuator"
701
769
} ]
702
770
} ,
771
+ {
772
+ code : "var foo = { *[foo](){} };" ,
773
+ output : "var foo = { * [foo](){} };" ,
774
+ options : [ "after" ] ,
775
+ parserOptions : { ecmaVersion : 6 } ,
776
+ errors : [ {
777
+ message : "Missing space after *." ,
778
+ type : "Punctuator"
779
+ } ]
780
+ } ,
781
+ {
782
+ code : "class Foo { *[foo](){} }" ,
783
+ output : "class Foo { * [foo](){} }" ,
784
+ options : [ "after" ] ,
785
+ parserOptions : { ecmaVersion : 6 } ,
786
+ errors : [ {
787
+ message : "Missing space after *." ,
788
+ type : "Punctuator"
789
+ } ]
790
+ } ,
703
791
704
792
// "both"
705
793
{
@@ -787,6 +875,26 @@ ruleTester.run("generator-star-spacing", rule, {
787
875
type : "Punctuator"
788
876
} ]
789
877
} ,
878
+ {
879
+ code : "var foo = {*[foo](){} };" ,
880
+ output : "var foo = {* [foo](){} };" ,
881
+ options : [ "both" ] ,
882
+ parserOptions : { ecmaVersion : 6 } ,
883
+ errors : [ {
884
+ message : "Missing space after *." ,
885
+ type : "Punctuator"
886
+ } ]
887
+ } ,
888
+ {
889
+ code : "class Foo {*[foo](){} }" ,
890
+ output : "class Foo {* [foo](){} }" ,
891
+ options : [ "both" ] ,
892
+ parserOptions : { ecmaVersion : 6 } ,
893
+ errors : [ {
894
+ message : "Missing space after *." ,
895
+ type : "Punctuator"
896
+ } ]
897
+ } ,
790
898
791
899
// "neither"
792
900
{
@@ -874,6 +982,26 @@ ruleTester.run("generator-star-spacing", rule, {
874
982
type : "Punctuator"
875
983
} ]
876
984
} ,
985
+ {
986
+ code : "var foo = { * [ foo ](){} };" ,
987
+ output : "var foo = { *[ foo ](){} };" ,
988
+ options : [ "neither" ] ,
989
+ parserOptions : { ecmaVersion : 6 } ,
990
+ errors : [ {
991
+ message : "Unexpected space after *." ,
992
+ type : "Punctuator"
993
+ } ]
994
+ } ,
995
+ {
996
+ code : "class Foo { * [ foo ](){} }" ,
997
+ output : "class Foo { *[ foo ](){} }" ,
998
+ options : [ "neither" ] ,
999
+ parserOptions : { ecmaVersion : 6 } ,
1000
+ errors : [ {
1001
+ message : "Unexpected space after *." ,
1002
+ type : "Punctuator"
1003
+ } ]
1004
+ } ,
877
1005
878
1006
// {"before": true, "after": false}
879
1007
{
0 commit comments