Skip to content

Commit cf3c4eb

Browse files
authored
test(array-bracket-newline): make tests more strict (#2799)
1 parent 72b186c commit cf3c4eb

File tree

1 file changed

+110
-14
lines changed

1 file changed

+110
-14
lines changed

tests/lib/rules/array-bracket-newline.js

Lines changed: 110 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,70 +40,166 @@ tester.run('array-bracket-newline', rule, {
4040
{
4141
code: '<template><div :attr="[\na]" /></template>',
4242
output: '<template><div :attr="[a]" /></template>',
43-
errors: ["There should be no linebreak after '['."]
43+
errors: [
44+
{
45+
message: "There should be no linebreak after '['.",
46+
line: 1,
47+
column: 23,
48+
endLine: 1,
49+
endColumn: 24
50+
}
51+
]
4452
},
4553
{
4654
code: '<template><div :attr="[a\n]" /></template>',
4755
output: '<template><div :attr="[a]" /></template>',
48-
errors: ["There should be no linebreak before ']'."]
56+
errors: [
57+
{
58+
message: "There should be no linebreak before ']'.",
59+
line: 2,
60+
column: 1,
61+
endLine: 2,
62+
endColumn: 2
63+
}
64+
]
4965
},
5066
{
5167
code: '<template><div :attr="[\na\n]" /></template>',
5268
output: '<template><div :attr="[a]" /></template>',
5369
errors: [
54-
"There should be no linebreak after '['.",
55-
"There should be no linebreak before ']'."
70+
{
71+
message: "There should be no linebreak after '['.",
72+
line: 1,
73+
column: 23,
74+
endLine: 1,
75+
endColumn: 24
76+
},
77+
{
78+
message: "There should be no linebreak before ']'.",
79+
line: 3,
80+
column: 1,
81+
endLine: 3,
82+
endColumn: 2
83+
}
5684
]
5785
},
5886
{
5987
code: '<template><div :attr="[\na]" /></template>',
6088
output: '<template><div :attr="[a]" /></template>',
6189
options: ['never'],
62-
errors: ["There should be no linebreak after '['."]
90+
errors: [
91+
{
92+
message: "There should be no linebreak after '['.",
93+
line: 1,
94+
column: 23,
95+
endLine: 1,
96+
endColumn: 24
97+
}
98+
]
6399
},
64100
{
65101
code: '<template><div :attr="[a\n]" /></template>',
66102
output: '<template><div :attr="[a]" /></template>',
67103
options: ['never'],
68-
errors: ["There should be no linebreak before ']'."]
104+
errors: [
105+
{
106+
message: "There should be no linebreak before ']'.",
107+
line: 2,
108+
column: 1,
109+
endLine: 2,
110+
endColumn: 2
111+
}
112+
]
69113
},
70114
{
71115
code: '<template><div :attr="[\na\n]" /></template>',
72116
output: '<template><div :attr="[a]" /></template>',
73117
options: ['never'],
74118
errors: [
75-
"There should be no linebreak after '['.",
76-
"There should be no linebreak before ']'."
119+
{
120+
message: "There should be no linebreak after '['.",
121+
line: 1,
122+
column: 23,
123+
endLine: 1,
124+
endColumn: 24
125+
},
126+
{
127+
message: "There should be no linebreak before ']'.",
128+
line: 3,
129+
column: 1,
130+
endLine: 3,
131+
endColumn: 2
132+
}
77133
]
78134
},
79135
{
80136
code: '<template><div :attr="[\na]" /></template>',
81137
output: '<template><div :attr="[\na\n]" /></template>',
82138
options: ['always'],
83-
errors: ["A linebreak is required before ']'."]
139+
errors: [
140+
{
141+
message: "A linebreak is required before ']'.",
142+
line: 2,
143+
column: 2,
144+
endLine: 2,
145+
endColumn: 3
146+
}
147+
]
84148
},
85149
{
86150
code: '<template><div :attr="[a\n]" /></template>',
87151
output: '<template><div :attr="[\na\n]" /></template>',
88152
options: ['always'],
89-
errors: ["A linebreak is required after '['."]
153+
errors: [
154+
{
155+
message: "A linebreak is required after '['.",
156+
line: 1,
157+
column: 23,
158+
endLine: 1,
159+
endColumn: 24
160+
}
161+
]
90162
},
91163
{
92164
code: '<template><div :attr="[a]" /></template>',
93165
output: '<template><div :attr="[\na\n]" /></template>',
94166
options: ['always'],
95167
errors: [
96-
"A linebreak is required after '['.",
97-
"A linebreak is required before ']'."
168+
{
169+
message: "A linebreak is required after '['.",
170+
line: 1,
171+
column: 23,
172+
endLine: 1,
173+
endColumn: 24
174+
},
175+
{
176+
message: "A linebreak is required before ']'.",
177+
line: 1,
178+
column: 25,
179+
endLine: 1,
180+
endColumn: 26
181+
}
98182
]
99183
},
100184
{
101185
code: '<template><div :[[attr]]="[a]" /></template>',
102186
output: '<template><div :[[attr]]="[\na\n]" /></template>',
103187
options: ['always'],
104188
errors: [
105-
"A linebreak is required after '['.",
106-
"A linebreak is required before ']'."
189+
{
190+
message: "A linebreak is required after '['.",
191+
line: 1,
192+
column: 27,
193+
endLine: 1,
194+
endColumn: 28
195+
},
196+
{
197+
message: "A linebreak is required before ']'.",
198+
line: 1,
199+
column: 29,
200+
endLine: 1,
201+
endColumn: 30
202+
}
107203
]
108204
}
109205
]

0 commit comments

Comments
 (0)