Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(931)

Side by Side Diff: pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart

Issue 585073002: Issue 18296. Harden the name checks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/extract_method_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.refactoring.naming_conventions; 5 library test.services.refactoring.naming_conventions;
6 6
7 import 'package:analysis_server/src/protocol.dart' show 7 import 'package:analysis_server/src/protocol.dart' show
8 RefactoringProblemSeverity; 8 RefactoringProblemSeverity;
9 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart '; 9 import 'package:analysis_server/src/services/refactoring/naming_conventions.dart ';
10 import 'package:analysis_server/src/services/refactoring/refactoring.dart'; 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 void test_validateClassName_empty() { 51 void test_validateClassName_empty() {
52 assertRefactoringStatus( 52 assertRefactoringStatus(
53 validateClassName(""), 53 validateClassName(""),
54 RefactoringProblemSeverity.FATAL, 54 RefactoringProblemSeverity.FATAL,
55 expectedMessage: "Class name must not be empty."); 55 expectedMessage: "Class name must not be empty.");
56 } 56 }
57 57
58 void test_validateClassName_leadingBlanks() { 58 void test_validateClassName_leadingBlanks() {
59 assertRefactoringStatus( 59 assertRefactoringStatus(
60 validateClassName(" NewName"), 60 validateClassName(" NewName"),
61 RefactoringProblemSeverity.ERROR, 61 RefactoringProblemSeverity.FATAL,
62 expectedMessage: "Class name must not start or end with a blank."); 62 expectedMessage: "Class name must not start or end with a blank.");
63 } 63 }
64 64
65 void test_validateClassName_notIdentifierMiddle() { 65 void test_validateClassName_notIdentifierMiddle() {
66 assertRefactoringStatus( 66 assertRefactoringStatus(
67 validateClassName("New-Name"), 67 validateClassName("New-Name"),
68 RefactoringProblemSeverity.ERROR, 68 RefactoringProblemSeverity.FATAL,
69 expectedMessage: "Class name must not contain '-'."); 69 expectedMessage: "Class name must not contain '-'.");
70 } 70 }
71 71
72 void test_validateClassName_notIdentifierStart() { 72 void test_validateClassName_notIdentifierStart() {
73 assertRefactoringStatus( 73 assertRefactoringStatus(
74 validateClassName("-NewName"), 74 validateClassName("-NewName"),
75 RefactoringProblemSeverity.ERROR, 75 RefactoringProblemSeverity.FATAL,
76 expectedMessage: 76 expectedMessage:
77 "Class name must begin with an uppercase letter or underscore."); 77 "Class name must begin with an uppercase letter or underscore.");
78 } 78 }
79 79
80 void test_validateClassName_null() { 80 void test_validateClassName_null() {
81 assertRefactoringStatus( 81 assertRefactoringStatus(
82 validateClassName(null), 82 validateClassName(null),
83 RefactoringProblemSeverity.FATAL, 83 RefactoringProblemSeverity.FATAL,
84 expectedMessage: "Class name must not be null."); 84 expectedMessage: "Class name must not be null.");
85 } 85 }
86 86
87 void test_validateClassName_trailingBlanks() { 87 void test_validateClassName_trailingBlanks() {
88 assertRefactoringStatus( 88 assertRefactoringStatus(
89 validateClassName("NewName "), 89 validateClassName("NewName "),
90 RefactoringProblemSeverity.ERROR, 90 RefactoringProblemSeverity.FATAL,
91 expectedMessage: "Class name must not start or end with a blank."); 91 expectedMessage: "Class name must not start or end with a blank.");
92 } 92 }
93 void test_validateConstantName_OK() { 93 void test_validateConstantName_OK() {
94 assertRefactoringStatusOK(validateConstantName("NAME")); 94 assertRefactoringStatusOK(validateConstantName("NAME"));
95 } 95 }
96 96
97 void test_validateConstantName_OK_digit() { 97 void test_validateConstantName_OK_digit() {
98 assertRefactoringStatusOK(validateConstantName("NAME2")); 98 assertRefactoringStatusOK(validateConstantName("NAME2"));
99 } 99 }
100 100
101 void test_validateConstantName_OK_underscoreLeading() { 101 void test_validateConstantName_OK_underscoreLeading() {
102 assertRefactoringStatusOK(validateConstantName("_NAME")); 102 assertRefactoringStatusOK(validateConstantName("_NAME"));
103 } 103 }
104 104
105 void test_validateConstantName_OK_underscoreMiddle() { 105 void test_validateConstantName_OK_underscoreMiddle() {
106 assertRefactoringStatusOK(validateConstantName("MY_NEW_NAME")); 106 assertRefactoringStatusOK(validateConstantName("MY_NEW_NAME"));
107 } 107 }
108 108
109 void test_validateConstantName_empty() { 109 void test_validateConstantName_empty() {
110 assertRefactoringStatus( 110 assertRefactoringStatus(
111 validateConstantName(""), 111 validateConstantName(""),
112 RefactoringProblemSeverity.FATAL, 112 RefactoringProblemSeverity.FATAL,
113 expectedMessage: "Constant name must not be empty."); 113 expectedMessage: "Constant name must not be empty.");
114 } 114 }
115 115
116 void test_validateConstantName_leadingBlanks() { 116 void test_validateConstantName_leadingBlanks() {
117 assertRefactoringStatus( 117 assertRefactoringStatus(
118 validateConstantName(" NewName"), 118 validateConstantName(" NewName"),
119 RefactoringProblemSeverity.ERROR, 119 RefactoringProblemSeverity.FATAL,
120 expectedMessage: "Constant name must not start or end with a blank."); 120 expectedMessage: "Constant name must not start or end with a blank.");
121 } 121 }
122 122
123 void test_validateConstantName_notAllCaps() { 123 void test_validateConstantName_notAllCaps() {
124 assertRefactoringStatus( 124 assertRefactoringStatus(
125 validateConstantName("NewName"), 125 validateConstantName("NewName"),
126 RefactoringProblemSeverity.WARNING, 126 RefactoringProblemSeverity.WARNING,
127 expectedMessage: "Constant name should be all uppercase with underscores ."); 127 expectedMessage: "Constant name should be all uppercase with underscores .");
128 } 128 }
129 129
130 void test_validateConstantName_notIdentifierMiddle() { 130 void test_validateConstantName_notIdentifierMiddle() {
131 assertRefactoringStatus( 131 assertRefactoringStatus(
132 validateConstantName("NA-ME"), 132 validateConstantName("NA-ME"),
133 RefactoringProblemSeverity.ERROR, 133 RefactoringProblemSeverity.FATAL,
134 expectedMessage: "Constant name must not contain '-'."); 134 expectedMessage: "Constant name must not contain '-'.");
135 } 135 }
136 136
137 void test_validateConstantName_notIdentifierStart() { 137 void test_validateConstantName_notIdentifierStart() {
138 assertRefactoringStatus( 138 assertRefactoringStatus(
139 validateConstantName("99_RED_BALLOONS"), 139 validateConstantName("99_RED_BALLOONS"),
140 RefactoringProblemSeverity.ERROR, 140 RefactoringProblemSeverity.FATAL,
141 expectedMessage: 141 expectedMessage:
142 "Constant name must begin with an uppercase letter or underscore."); 142 "Constant name must begin with an uppercase letter or underscore.");
143 } 143 }
144 144
145 void test_validateConstantName_null() { 145 void test_validateConstantName_null() {
146 assertRefactoringStatus( 146 assertRefactoringStatus(
147 validateConstantName(null), 147 validateConstantName(null),
148 RefactoringProblemSeverity.FATAL, 148 RefactoringProblemSeverity.FATAL,
149 expectedMessage: "Constant name must not be null."); 149 expectedMessage: "Constant name must not be null.");
150 } 150 }
151 151
152 void test_validateConstantName_trailingBlanks() { 152 void test_validateConstantName_trailingBlanks() {
153 assertRefactoringStatus( 153 assertRefactoringStatus(
154 validateConstantName("NewName "), 154 validateConstantName("NewName "),
155 RefactoringProblemSeverity.ERROR, 155 RefactoringProblemSeverity.FATAL,
156 expectedMessage: "Constant name must not start or end with a blank."); 156 expectedMessage: "Constant name must not start or end with a blank.");
157 } 157 }
158 158
159 void test_validateConstructorName_OK() { 159 void test_validateConstructorName_OK() {
160 assertRefactoringStatusOK(validateConstructorName("newName")); 160 assertRefactoringStatusOK(validateConstructorName("newName"));
161 } 161 }
162 162
163 void test_validateConstructorName_OK_leadingUnderscore() { 163 void test_validateConstructorName_OK_leadingUnderscore() {
164 assertRefactoringStatusOK(validateConstructorName("_newName")); 164 assertRefactoringStatusOK(validateConstructorName("_newName"));
165 } 165 }
166 166
167 void test_validateConstructorName_doesNotStartWithLowerCase() { 167 void test_validateConstructorName_doesNotStartWithLowerCase() {
168 assertRefactoringStatus( 168 assertRefactoringStatus(
169 validateConstructorName("NewName"), 169 validateConstructorName("NewName"),
170 RefactoringProblemSeverity.WARNING, 170 RefactoringProblemSeverity.WARNING,
171 expectedMessage: "Constructor name should start with a lowercase letter. "); 171 expectedMessage: "Constructor name should start with a lowercase letter. ");
172 } 172 }
173 173
174 void test_validateConstructorName_empty() { 174 void test_validateConstructorName_empty() {
175 assertRefactoringStatusOK(validateConstructorName("")); 175 assertRefactoringStatusOK(validateConstructorName(""));
176 } 176 }
177 177
178 void test_validateConstructorName_leadingBlanks() { 178 void test_validateConstructorName_leadingBlanks() {
179 assertRefactoringStatus( 179 assertRefactoringStatus(
180 validateConstructorName(" newName"), 180 validateConstructorName(" newName"),
181 RefactoringProblemSeverity.ERROR, 181 RefactoringProblemSeverity.FATAL,
182 expectedMessage: "Constructor name must not start or end with a blank.") ; 182 expectedMessage: "Constructor name must not start or end with a blank.") ;
183 } 183 }
184 184
185 void test_validateConstructorName_notIdentifierMiddle() { 185 void test_validateConstructorName_notIdentifierMiddle() {
186 assertRefactoringStatus( 186 assertRefactoringStatus(
187 validateConstructorName("na-me"), 187 validateConstructorName("na-me"),
188 RefactoringProblemSeverity.ERROR, 188 RefactoringProblemSeverity.FATAL,
189 expectedMessage: "Constructor name must not contain '-'."); 189 expectedMessage: "Constructor name must not contain '-'.");
190 } 190 }
191 191
192 void test_validateConstructorName_notIdentifierStart() { 192 void test_validateConstructorName_notIdentifierStart() {
193 assertRefactoringStatus( 193 assertRefactoringStatus(
194 validateConstructorName("2name"), 194 validateConstructorName("2name"),
195 RefactoringProblemSeverity.ERROR, 195 RefactoringProblemSeverity.FATAL,
196 expectedMessage: 196 expectedMessage:
197 "Constructor name must begin with a lowercase letter or underscore." ); 197 "Constructor name must begin with a lowercase letter or underscore." );
198 } 198 }
199 199
200 void test_validateConstructorName_null() { 200 void test_validateConstructorName_null() {
201 assertRefactoringStatus( 201 assertRefactoringStatus(
202 validateConstructorName(null), 202 validateConstructorName(null),
203 RefactoringProblemSeverity.FATAL, 203 RefactoringProblemSeverity.FATAL,
204 expectedMessage: "Constructor name must not be null."); 204 expectedMessage: "Constructor name must not be null.");
205 } 205 }
206 206
207 void test_validateConstructorName_trailingBlanks() { 207 void test_validateConstructorName_trailingBlanks() {
208 assertRefactoringStatus( 208 assertRefactoringStatus(
209 validateConstructorName("newName "), 209 validateConstructorName("newName "),
210 RefactoringProblemSeverity.ERROR, 210 RefactoringProblemSeverity.FATAL,
211 expectedMessage: "Constructor name must not start or end with a blank.") ; 211 expectedMessage: "Constructor name must not start or end with a blank.") ;
212 } 212 }
213 213
214 void test_validateFieldName_OK() { 214 void test_validateFieldName_OK() {
215 assertRefactoringStatusOK(validateFieldName("newName")); 215 assertRefactoringStatusOK(validateFieldName("newName"));
216 } 216 }
217 217
218 void test_validateFieldName_OK_leadingUnderscore() { 218 void test_validateFieldName_OK_leadingUnderscore() {
219 assertRefactoringStatusOK(validateFieldName("_newName")); 219 assertRefactoringStatusOK(validateFieldName("_newName"));
220 } 220 }
(...skipping 12 matching lines...) Expand all
233 void test_validateFieldName_empty() { 233 void test_validateFieldName_empty() {
234 assertRefactoringStatus( 234 assertRefactoringStatus(
235 validateFieldName(""), 235 validateFieldName(""),
236 RefactoringProblemSeverity.FATAL, 236 RefactoringProblemSeverity.FATAL,
237 expectedMessage: "Field name must not be empty."); 237 expectedMessage: "Field name must not be empty.");
238 } 238 }
239 239
240 void test_validateFieldName_leadingBlanks() { 240 void test_validateFieldName_leadingBlanks() {
241 assertRefactoringStatus( 241 assertRefactoringStatus(
242 validateFieldName(" newName"), 242 validateFieldName(" newName"),
243 RefactoringProblemSeverity.ERROR, 243 RefactoringProblemSeverity.FATAL,
244 expectedMessage: "Field name must not start or end with a blank."); 244 expectedMessage: "Field name must not start or end with a blank.");
245 } 245 }
246 246
247 void test_validateFieldName_notIdentifierMiddle() { 247 void test_validateFieldName_notIdentifierMiddle() {
248 assertRefactoringStatus( 248 assertRefactoringStatus(
249 validateFieldName("new-Name"), 249 validateFieldName("new-Name"),
250 RefactoringProblemSeverity.ERROR, 250 RefactoringProblemSeverity.FATAL,
251 expectedMessage: "Field name must not contain '-'."); 251 expectedMessage: "Field name must not contain '-'.");
252 } 252 }
253 253
254 void test_validateFieldName_notIdentifierStart() { 254 void test_validateFieldName_notIdentifierStart() {
255 assertRefactoringStatus( 255 assertRefactoringStatus(
256 validateFieldName("2newName"), 256 validateFieldName("2newName"),
257 RefactoringProblemSeverity.ERROR, 257 RefactoringProblemSeverity.FATAL,
258 expectedMessage: 258 expectedMessage:
259 "Field name must begin with a lowercase letter or underscore."); 259 "Field name must begin with a lowercase letter or underscore.");
260 } 260 }
261 261
262 void test_validateFieldName_null() { 262 void test_validateFieldName_null() {
263 assertRefactoringStatus( 263 assertRefactoringStatus(
264 validateFieldName(null), 264 validateFieldName(null),
265 RefactoringProblemSeverity.FATAL, 265 RefactoringProblemSeverity.FATAL,
266 expectedMessage: "Field name must not be null."); 266 expectedMessage: "Field name must not be null.");
267 } 267 }
268 268
269 void test_validateFieldName_trailingBlanks() { 269 void test_validateFieldName_trailingBlanks() {
270 assertRefactoringStatus( 270 assertRefactoringStatus(
271 validateFieldName("newName "), 271 validateFieldName("newName "),
272 RefactoringProblemSeverity.ERROR, 272 RefactoringProblemSeverity.FATAL,
273 expectedMessage: "Field name must not start or end with a blank."); 273 expectedMessage: "Field name must not start or end with a blank.");
274 } 274 }
275 275
276 void test_validateFunctionName_OK() { 276 void test_validateFunctionName_OK() {
277 assertRefactoringStatusOK(validateFunctionName("newName")); 277 assertRefactoringStatusOK(validateFunctionName("newName"));
278 } 278 }
279 279
280 void test_validateFunctionName_OK_leadingUnderscore() { 280 void test_validateFunctionName_OK_leadingUnderscore() {
281 assertRefactoringStatusOK(validateFunctionName("_newName")); 281 assertRefactoringStatusOK(validateFunctionName("_newName"));
282 } 282 }
(...skipping 12 matching lines...) Expand all
295 void test_validateFunctionName_empty() { 295 void test_validateFunctionName_empty() {
296 assertRefactoringStatus( 296 assertRefactoringStatus(
297 validateFunctionName(""), 297 validateFunctionName(""),
298 RefactoringProblemSeverity.FATAL, 298 RefactoringProblemSeverity.FATAL,
299 expectedMessage: "Function name must not be empty."); 299 expectedMessage: "Function name must not be empty.");
300 } 300 }
301 301
302 void test_validateFunctionName_leadingBlanks() { 302 void test_validateFunctionName_leadingBlanks() {
303 assertRefactoringStatus( 303 assertRefactoringStatus(
304 validateFunctionName(" newName"), 304 validateFunctionName(" newName"),
305 RefactoringProblemSeverity.ERROR, 305 RefactoringProblemSeverity.FATAL,
306 expectedMessage: "Function name must not start or end with a blank."); 306 expectedMessage: "Function name must not start or end with a blank.");
307 } 307 }
308 308
309 void test_validateFunctionName_notIdentifierMiddle() { 309 void test_validateFunctionName_notIdentifierMiddle() {
310 assertRefactoringStatus( 310 assertRefactoringStatus(
311 validateFunctionName("new-Name"), 311 validateFunctionName("new-Name"),
312 RefactoringProblemSeverity.ERROR, 312 RefactoringProblemSeverity.FATAL,
313 expectedMessage: "Function name must not contain '-'."); 313 expectedMessage: "Function name must not contain '-'.");
314 } 314 }
315 315
316 void test_validateFunctionName_notIdentifierStart() { 316 void test_validateFunctionName_notIdentifierStart() {
317 assertRefactoringStatus( 317 assertRefactoringStatus(
318 validateFunctionName("2newName"), 318 validateFunctionName("2newName"),
319 RefactoringProblemSeverity.ERROR, 319 RefactoringProblemSeverity.FATAL,
320 expectedMessage: 320 expectedMessage:
321 "Function name must begin with a lowercase letter or underscore."); 321 "Function name must begin with a lowercase letter or underscore.");
322 } 322 }
323 323
324 void test_validateFunctionName_null() { 324 void test_validateFunctionName_null() {
325 assertRefactoringStatus( 325 assertRefactoringStatus(
326 validateFunctionName(null), 326 validateFunctionName(null),
327 RefactoringProblemSeverity.FATAL, 327 RefactoringProblemSeverity.FATAL,
328 expectedMessage: "Function name must not be null."); 328 expectedMessage: "Function name must not be null.");
329 } 329 }
330 330
331 void test_validateFunctionName_trailingBlanks() { 331 void test_validateFunctionName_trailingBlanks() {
332 assertRefactoringStatus( 332 assertRefactoringStatus(
333 validateFunctionName("newName "), 333 validateFunctionName("newName "),
334 RefactoringProblemSeverity.ERROR, 334 RefactoringProblemSeverity.FATAL,
335 expectedMessage: "Function name must not start or end with a blank."); 335 expectedMessage: "Function name must not start or end with a blank.");
336 } 336 }
337 337
338 void test_validateFunctionTypeAliasName_OK() { 338 void test_validateFunctionTypeAliasName_OK() {
339 assertRefactoringStatusOK(validateFunctionTypeAliasName("NewName")); 339 assertRefactoringStatusOK(validateFunctionTypeAliasName("NewName"));
340 } 340 }
341 341
342 void test_validateFunctionTypeAliasName_OK_leadingDollar() { 342 void test_validateFunctionTypeAliasName_OK_leadingDollar() {
343 assertRefactoringStatusOK(validateFunctionTypeAliasName("\$NewName")); 343 assertRefactoringStatusOK(validateFunctionTypeAliasName("\$NewName"));
344 } 344 }
(...skipping 17 matching lines...) Expand all
362 void test_validateFunctionTypeAliasName_empty() { 362 void test_validateFunctionTypeAliasName_empty() {
363 assertRefactoringStatus( 363 assertRefactoringStatus(
364 validateFunctionTypeAliasName(""), 364 validateFunctionTypeAliasName(""),
365 RefactoringProblemSeverity.FATAL, 365 RefactoringProblemSeverity.FATAL,
366 expectedMessage: "Function type alias name must not be empty."); 366 expectedMessage: "Function type alias name must not be empty.");
367 } 367 }
368 368
369 void test_validateFunctionTypeAliasName_leadingBlanks() { 369 void test_validateFunctionTypeAliasName_leadingBlanks() {
370 assertRefactoringStatus( 370 assertRefactoringStatus(
371 validateFunctionTypeAliasName(" NewName"), 371 validateFunctionTypeAliasName(" NewName"),
372 RefactoringProblemSeverity.ERROR, 372 RefactoringProblemSeverity.FATAL,
373 expectedMessage: 373 expectedMessage:
374 "Function type alias name must not start or end with a blank."); 374 "Function type alias name must not start or end with a blank.");
375 } 375 }
376 376
377 void test_validateFunctionTypeAliasName_notIdentifierMiddle() { 377 void test_validateFunctionTypeAliasName_notIdentifierMiddle() {
378 assertRefactoringStatus( 378 assertRefactoringStatus(
379 validateFunctionTypeAliasName("New-Name"), 379 validateFunctionTypeAliasName("New-Name"),
380 RefactoringProblemSeverity.ERROR, 380 RefactoringProblemSeverity.FATAL,
381 expectedMessage: "Function type alias name must not contain '-'."); 381 expectedMessage: "Function type alias name must not contain '-'.");
382 } 382 }
383 383
384 void test_validateFunctionTypeAliasName_notIdentifierStart() { 384 void test_validateFunctionTypeAliasName_notIdentifierStart() {
385 assertRefactoringStatus( 385 assertRefactoringStatus(
386 validateFunctionTypeAliasName("-NewName"), 386 validateFunctionTypeAliasName("-NewName"),
387 RefactoringProblemSeverity.ERROR, 387 RefactoringProblemSeverity.FATAL,
388 expectedMessage: 388 expectedMessage:
389 "Function type alias name must begin with an uppercase letter or und erscore."); 389 "Function type alias name must begin with an uppercase letter or und erscore.");
390 } 390 }
391 391
392 void test_validateFunctionTypeAliasName_null() { 392 void test_validateFunctionTypeAliasName_null() {
393 assertRefactoringStatus( 393 assertRefactoringStatus(
394 validateFunctionTypeAliasName(null), 394 validateFunctionTypeAliasName(null),
395 RefactoringProblemSeverity.FATAL, 395 RefactoringProblemSeverity.FATAL,
396 expectedMessage: "Function type alias name must not be null."); 396 expectedMessage: "Function type alias name must not be null.");
397 } 397 }
398 398
399 void test_validateFunctionTypeAliasName_trailingBlanks() { 399 void test_validateFunctionTypeAliasName_trailingBlanks() {
400 assertRefactoringStatus( 400 assertRefactoringStatus(
401 validateFunctionTypeAliasName("NewName "), 401 validateFunctionTypeAliasName("NewName "),
402 RefactoringProblemSeverity.ERROR, 402 RefactoringProblemSeverity.FATAL,
403 expectedMessage: 403 expectedMessage:
404 "Function type alias name must not start or end with a blank."); 404 "Function type alias name must not start or end with a blank.");
405 } 405 }
406 406
407 void test_validateImportPrefixName_OK() { 407 void test_validateImportPrefixName_OK() {
408 assertRefactoringStatusOK(validateImportPrefixName("newName")); 408 assertRefactoringStatusOK(validateImportPrefixName("newName"));
409 } 409 }
410 410
411 void test_validateImportPrefixName_OK_leadingUnderscore() { 411 void test_validateImportPrefixName_OK_leadingUnderscore() {
412 assertRefactoringStatusOK(validateImportPrefixName("_newName")); 412 assertRefactoringStatusOK(validateImportPrefixName("_newName"));
(...skipping 10 matching lines...) Expand all
423 expectedMessage: "Import prefix name should start with a lowercase lette r."); 423 expectedMessage: "Import prefix name should start with a lowercase lette r.");
424 } 424 }
425 425
426 void test_validateImportPrefixName_empty() { 426 void test_validateImportPrefixName_empty() {
427 assertRefactoringStatusOK(validateImportPrefixName("")); 427 assertRefactoringStatusOK(validateImportPrefixName(""));
428 } 428 }
429 429
430 void test_validateImportPrefixName_leadingBlanks() { 430 void test_validateImportPrefixName_leadingBlanks() {
431 assertRefactoringStatus( 431 assertRefactoringStatus(
432 validateImportPrefixName(" newName"), 432 validateImportPrefixName(" newName"),
433 RefactoringProblemSeverity.ERROR, 433 RefactoringProblemSeverity.FATAL,
434 expectedMessage: "Import prefix name must not start or end with a blank. "); 434 expectedMessage: "Import prefix name must not start or end with a blank. ");
435 } 435 }
436 436
437 void test_validateImportPrefixName_notIdentifierMiddle() { 437 void test_validateImportPrefixName_notIdentifierMiddle() {
438 assertRefactoringStatus( 438 assertRefactoringStatus(
439 validateImportPrefixName("new-Name"), 439 validateImportPrefixName("new-Name"),
440 RefactoringProblemSeverity.ERROR, 440 RefactoringProblemSeverity.FATAL,
441 expectedMessage: "Import prefix name must not contain '-'."); 441 expectedMessage: "Import prefix name must not contain '-'.");
442 } 442 }
443 443
444 void test_validateImportPrefixName_notIdentifierStart() { 444 void test_validateImportPrefixName_notIdentifierStart() {
445 assertRefactoringStatus( 445 assertRefactoringStatus(
446 validateImportPrefixName("2newName"), 446 validateImportPrefixName("2newName"),
447 RefactoringProblemSeverity.ERROR, 447 RefactoringProblemSeverity.FATAL,
448 expectedMessage: 448 expectedMessage:
449 "Import prefix name must begin with a lowercase letter or underscore ."); 449 "Import prefix name must begin with a lowercase letter or underscore .");
450 } 450 }
451 451
452 void test_validateImportPrefixName_null() { 452 void test_validateImportPrefixName_null() {
453 assertRefactoringStatus( 453 assertRefactoringStatus(
454 validateImportPrefixName(null), 454 validateImportPrefixName(null),
455 RefactoringProblemSeverity.FATAL, 455 RefactoringProblemSeverity.FATAL,
456 expectedMessage: "Import prefix name must not be null."); 456 expectedMessage: "Import prefix name must not be null.");
457 } 457 }
458 458
459 void test_validateImportPrefixName_trailingBlanks() { 459 void test_validateImportPrefixName_trailingBlanks() {
460 assertRefactoringStatus( 460 assertRefactoringStatus(
461 validateImportPrefixName("newName "), 461 validateImportPrefixName("newName "),
462 RefactoringProblemSeverity.ERROR, 462 RefactoringProblemSeverity.FATAL,
463 expectedMessage: "Import prefix name must not start or end with a blank. "); 463 expectedMessage: "Import prefix name must not start or end with a blank. ");
464 } 464 }
465 465
466 void test_validateLabelName_OK() { 466 void test_validateLabelName_OK() {
467 assertRefactoringStatusOK(validateLabelName("newName")); 467 assertRefactoringStatusOK(validateLabelName("newName"));
468 } 468 }
469 469
470 void test_validateLabelName_OK_leadingDollar() { 470 void test_validateLabelName_OK_leadingDollar() {
471 assertRefactoringStatusOK(validateLabelName("\$newName")); 471 assertRefactoringStatusOK(validateLabelName("\$newName"));
472 } 472 }
(...skipping 16 matching lines...) Expand all
489 void test_validateLabelName_empty() { 489 void test_validateLabelName_empty() {
490 assertRefactoringStatus( 490 assertRefactoringStatus(
491 validateLabelName(""), 491 validateLabelName(""),
492 RefactoringProblemSeverity.FATAL, 492 RefactoringProblemSeverity.FATAL,
493 expectedMessage: "Label name must not be empty."); 493 expectedMessage: "Label name must not be empty.");
494 } 494 }
495 495
496 void test_validateLabelName_leadingBlanks() { 496 void test_validateLabelName_leadingBlanks() {
497 assertRefactoringStatus( 497 assertRefactoringStatus(
498 validateLabelName(" newName"), 498 validateLabelName(" newName"),
499 RefactoringProblemSeverity.ERROR, 499 RefactoringProblemSeverity.FATAL,
500 expectedMessage: "Label name must not start or end with a blank."); 500 expectedMessage: "Label name must not start or end with a blank.");
501 } 501 }
502 502
503 void test_validateLabelName_notIdentifierMiddle() { 503 void test_validateLabelName_notIdentifierMiddle() {
504 assertRefactoringStatus( 504 assertRefactoringStatus(
505 validateLabelName("new-Name"), 505 validateLabelName("new-Name"),
506 RefactoringProblemSeverity.ERROR, 506 RefactoringProblemSeverity.FATAL,
507 expectedMessage: "Label name must not contain '-'."); 507 expectedMessage: "Label name must not contain '-'.");
508 } 508 }
509 509
510 void test_validateLabelName_notIdentifierStart() { 510 void test_validateLabelName_notIdentifierStart() {
511 assertRefactoringStatus( 511 assertRefactoringStatus(
512 validateLabelName("2newName"), 512 validateLabelName("2newName"),
513 RefactoringProblemSeverity.ERROR, 513 RefactoringProblemSeverity.FATAL,
514 expectedMessage: 514 expectedMessage:
515 "Label name must begin with a lowercase letter or underscore."); 515 "Label name must begin with a lowercase letter or underscore.");
516 } 516 }
517 517
518 void test_validateLabelName_null() { 518 void test_validateLabelName_null() {
519 assertRefactoringStatus( 519 assertRefactoringStatus(
520 validateLabelName(null), 520 validateLabelName(null),
521 RefactoringProblemSeverity.FATAL, 521 RefactoringProblemSeverity.FATAL,
522 expectedMessage: "Label name must not be null."); 522 expectedMessage: "Label name must not be null.");
523 } 523 }
524 524
525 void test_validateLabelName_trailingBlanks() { 525 void test_validateLabelName_trailingBlanks() {
526 assertRefactoringStatus( 526 assertRefactoringStatus(
527 validateLabelName("newName "), 527 validateLabelName("newName "),
528 RefactoringProblemSeverity.ERROR, 528 RefactoringProblemSeverity.FATAL,
529 expectedMessage: "Label name must not start or end with a blank."); 529 expectedMessage: "Label name must not start or end with a blank.");
530 } 530 }
531 531
532 void test_validateLibraryName_OK_oneIdentifier() { 532 void test_validateLibraryName_OK_oneIdentifier() {
533 assertRefactoringStatusOK(validateLibraryName("name")); 533 assertRefactoringStatusOK(validateLibraryName("name"));
534 } 534 }
535 535
536 void test_validateLibraryName_OK_severalIdentifiers() { 536 void test_validateLibraryName_OK_severalIdentifiers() {
537 assertRefactoringStatusOK(validateLibraryName("my.library.name")); 537 assertRefactoringStatusOK(validateLibraryName("my.library.name"));
538 } 538 }
539 539
540 void test_validateLibraryName_blank() { 540 void test_validateLibraryName_blank() {
541 assertRefactoringStatus( 541 assertRefactoringStatus(
542 validateLibraryName(""), 542 validateLibraryName(""),
543 RefactoringProblemSeverity.FATAL, 543 RefactoringProblemSeverity.FATAL,
544 expectedMessage: "Library name must not be blank."); 544 expectedMessage: "Library name must not be blank.");
545 assertRefactoringStatus( 545 assertRefactoringStatus(
546 validateLibraryName(" "), 546 validateLibraryName(" "),
547 RefactoringProblemSeverity.FATAL, 547 RefactoringProblemSeverity.FATAL,
548 expectedMessage: "Library name must not be blank."); 548 expectedMessage: "Library name must not be blank.");
549 } 549 }
550 550
551 void test_validateLibraryName_blank_identifier() { 551 void test_validateLibraryName_blank_identifier() {
552 assertRefactoringStatus( 552 assertRefactoringStatus(
553 validateLibraryName("my..name"), 553 validateLibraryName("my..name"),
554 RefactoringProblemSeverity.FATAL, 554 RefactoringProblemSeverity.FATAL,
555 expectedMessage: "Library name identifier must not be empty."); 555 expectedMessage: "Library name identifier must not be empty.");
556 assertRefactoringStatus( 556 assertRefactoringStatus(
557 validateLibraryName("my. .name"), 557 validateLibraryName("my. .name"),
558 RefactoringProblemSeverity.ERROR, 558 RefactoringProblemSeverity.FATAL,
559 expectedMessage: "Library name identifier must not start or end with a b lank."); 559 expectedMessage: "Library name identifier must not start or end with a b lank.");
560 } 560 }
561 561
562 void test_validateLibraryName_hasUpperCase() { 562 void test_validateLibraryName_hasUpperCase() {
563 assertRefactoringStatus( 563 assertRefactoringStatus(
564 validateLibraryName("my.newName"), 564 validateLibraryName("my.newName"),
565 RefactoringProblemSeverity.WARNING, 565 RefactoringProblemSeverity.WARNING,
566 expectedMessage: 566 expectedMessage:
567 "Library name should consist of lowercase identifier separated by do ts."); 567 "Library name should consist of lowercase identifier separated by do ts.");
568 } 568 }
569 569
570 void test_validateLibraryName_leadingBlanks() { 570 void test_validateLibraryName_leadingBlanks() {
571 assertRefactoringStatus( 571 assertRefactoringStatus(
572 validateLibraryName("my. name"), 572 validateLibraryName("my. name"),
573 RefactoringProblemSeverity.ERROR, 573 RefactoringProblemSeverity.FATAL,
574 expectedMessage: "Library name identifier must not start or end with a b lank."); 574 expectedMessage: "Library name identifier must not start or end with a b lank.");
575 } 575 }
576 576
577 void test_validateLibraryName_notIdentifierMiddle() { 577 void test_validateLibraryName_notIdentifierMiddle() {
578 assertRefactoringStatus( 578 assertRefactoringStatus(
579 validateLibraryName("my.ba-d.name"), 579 validateLibraryName("my.ba-d.name"),
580 RefactoringProblemSeverity.ERROR, 580 RefactoringProblemSeverity.FATAL,
581 expectedMessage: "Library name identifier must not contain '-'."); 581 expectedMessage: "Library name identifier must not contain '-'.");
582 } 582 }
583 583
584 void test_validateLibraryName_notIdentifierStart() { 584 void test_validateLibraryName_notIdentifierStart() {
585 assertRefactoringStatus( 585 assertRefactoringStatus(
586 validateLibraryName("my.2bad.name"), 586 validateLibraryName("my.2bad.name"),
587 RefactoringProblemSeverity.ERROR, 587 RefactoringProblemSeverity.FATAL,
588 expectedMessage: 588 expectedMessage:
589 "Library name identifier must begin with a lowercase letter or under score."); 589 "Library name identifier must begin with a lowercase letter or under score.");
590 } 590 }
591 591
592 void test_validateLibraryName_null() { 592 void test_validateLibraryName_null() {
593 assertRefactoringStatus( 593 assertRefactoringStatus(
594 validateLibraryName(null), 594 validateLibraryName(null),
595 RefactoringProblemSeverity.FATAL, 595 RefactoringProblemSeverity.FATAL,
596 expectedMessage: "Library name must not be null."); 596 expectedMessage: "Library name must not be null.");
597 } 597 }
598 598
599 void test_validateLibraryName_trailingBlanks() { 599 void test_validateLibraryName_trailingBlanks() {
600 assertRefactoringStatus( 600 assertRefactoringStatus(
601 validateLibraryName("my.bad .name"), 601 validateLibraryName("my.bad .name"),
602 RefactoringProblemSeverity.ERROR, 602 RefactoringProblemSeverity.FATAL,
603 expectedMessage: "Library name identifier must not start or end with a b lank."); 603 expectedMessage: "Library name identifier must not start or end with a b lank.");
604 } 604 }
605 605
606 void test_validateMethodName_OK() { 606 void test_validateMethodName_OK() {
607 assertRefactoringStatusOK(validateMethodName("newName")); 607 assertRefactoringStatusOK(validateMethodName("newName"));
608 } 608 }
609 609
610 void test_validateMethodName_OK_leadingUnderscore() { 610 void test_validateMethodName_OK_leadingUnderscore() {
611 assertRefactoringStatusOK(validateMethodName("_newName")); 611 assertRefactoringStatusOK(validateMethodName("_newName"));
612 } 612 }
(...skipping 12 matching lines...) Expand all
625 void test_validateMethodName_empty() { 625 void test_validateMethodName_empty() {
626 assertRefactoringStatus( 626 assertRefactoringStatus(
627 validateMethodName(""), 627 validateMethodName(""),
628 RefactoringProblemSeverity.FATAL, 628 RefactoringProblemSeverity.FATAL,
629 expectedMessage: "Method name must not be empty."); 629 expectedMessage: "Method name must not be empty.");
630 } 630 }
631 631
632 void test_validateMethodName_leadingBlanks() { 632 void test_validateMethodName_leadingBlanks() {
633 assertRefactoringStatus( 633 assertRefactoringStatus(
634 validateMethodName(" newName"), 634 validateMethodName(" newName"),
635 RefactoringProblemSeverity.ERROR, 635 RefactoringProblemSeverity.FATAL,
636 expectedMessage: "Method name must not start or end with a blank."); 636 expectedMessage: "Method name must not start or end with a blank.");
637 } 637 }
638 638
639 void test_validateMethodName_notIdentifierMiddle() { 639 void test_validateMethodName_notIdentifierMiddle() {
640 assertRefactoringStatus( 640 assertRefactoringStatus(
641 validateMethodName("new-Name"), 641 validateMethodName("new-Name"),
642 RefactoringProblemSeverity.ERROR, 642 RefactoringProblemSeverity.FATAL,
643 expectedMessage: "Method name must not contain '-'."); 643 expectedMessage: "Method name must not contain '-'.");
644 } 644 }
645 645
646 void test_validateMethodName_notIdentifierStart() { 646 void test_validateMethodName_notIdentifierStart() {
647 assertRefactoringStatus( 647 assertRefactoringStatus(
648 validateMethodName("2newName"), 648 validateMethodName("2newName"),
649 RefactoringProblemSeverity.ERROR, 649 RefactoringProblemSeverity.FATAL,
650 expectedMessage: 650 expectedMessage:
651 "Method name must begin with a lowercase letter or underscore."); 651 "Method name must begin with a lowercase letter or underscore.");
652 } 652 }
653 653
654 void test_validateMethodName_null() { 654 void test_validateMethodName_null() {
655 assertRefactoringStatus( 655 assertRefactoringStatus(
656 validateMethodName(null), 656 validateMethodName(null),
657 RefactoringProblemSeverity.FATAL, 657 RefactoringProblemSeverity.FATAL,
658 expectedMessage: "Method name must not be null."); 658 expectedMessage: "Method name must not be null.");
659 } 659 }
660 660
661 void test_validateMethodName_trailingBlanks() { 661 void test_validateMethodName_trailingBlanks() {
662 assertRefactoringStatus( 662 assertRefactoringStatus(
663 validateMethodName("newName "), 663 validateMethodName("newName "),
664 RefactoringProblemSeverity.ERROR, 664 RefactoringProblemSeverity.FATAL,
665 expectedMessage: "Method name must not start or end with a blank."); 665 expectedMessage: "Method name must not start or end with a blank.");
666 } 666 }
667 667
668 void test_validateParameterName_OK() { 668 void test_validateParameterName_OK() {
669 assertRefactoringStatusOK(validateParameterName("newName")); 669 assertRefactoringStatusOK(validateParameterName("newName"));
670 } 670 }
671 671
672 void test_validateParameterName_OK_leadingUnderscore() { 672 void test_validateParameterName_OK_leadingUnderscore() {
673 assertRefactoringStatusOK(validateParameterName("_newName")); 673 assertRefactoringStatusOK(validateParameterName("_newName"));
674 } 674 }
(...skipping 12 matching lines...) Expand all
687 void test_validateParameterName_empty() { 687 void test_validateParameterName_empty() {
688 assertRefactoringStatus( 688 assertRefactoringStatus(
689 validateParameterName(""), 689 validateParameterName(""),
690 RefactoringProblemSeverity.FATAL, 690 RefactoringProblemSeverity.FATAL,
691 expectedMessage: "Parameter name must not be empty."); 691 expectedMessage: "Parameter name must not be empty.");
692 } 692 }
693 693
694 void test_validateParameterName_leadingBlanks() { 694 void test_validateParameterName_leadingBlanks() {
695 assertRefactoringStatus( 695 assertRefactoringStatus(
696 validateParameterName(" newName"), 696 validateParameterName(" newName"),
697 RefactoringProblemSeverity.ERROR, 697 RefactoringProblemSeverity.FATAL,
698 expectedMessage: "Parameter name must not start or end with a blank."); 698 expectedMessage: "Parameter name must not start or end with a blank.");
699 } 699 }
700 700
701 void test_validateParameterName_notIdentifierMiddle() { 701 void test_validateParameterName_notIdentifierMiddle() {
702 assertRefactoringStatus( 702 assertRefactoringStatus(
703 validateParameterName("new-Name"), 703 validateParameterName("new-Name"),
704 RefactoringProblemSeverity.ERROR, 704 RefactoringProblemSeverity.FATAL,
705 expectedMessage: "Parameter name must not contain '-'."); 705 expectedMessage: "Parameter name must not contain '-'.");
706 } 706 }
707 707
708 void test_validateParameterName_notIdentifierStart() { 708 void test_validateParameterName_notIdentifierStart() {
709 assertRefactoringStatus( 709 assertRefactoringStatus(
710 validateParameterName("2newName"), 710 validateParameterName("2newName"),
711 RefactoringProblemSeverity.ERROR, 711 RefactoringProblemSeverity.FATAL,
712 expectedMessage: 712 expectedMessage:
713 "Parameter name must begin with a lowercase letter or underscore."); 713 "Parameter name must begin with a lowercase letter or underscore.");
714 } 714 }
715 715
716 void test_validateParameterName_null() { 716 void test_validateParameterName_null() {
717 assertRefactoringStatus( 717 assertRefactoringStatus(
718 validateParameterName(null), 718 validateParameterName(null),
719 RefactoringProblemSeverity.FATAL, 719 RefactoringProblemSeverity.FATAL,
720 expectedMessage: "Parameter name must not be null."); 720 expectedMessage: "Parameter name must not be null.");
721 } 721 }
722 722
723 void test_validateParameterName_trailingBlanks() { 723 void test_validateParameterName_trailingBlanks() {
724 assertRefactoringStatus( 724 assertRefactoringStatus(
725 validateParameterName("newName "), 725 validateParameterName("newName "),
726 RefactoringProblemSeverity.ERROR, 726 RefactoringProblemSeverity.FATAL,
727 expectedMessage: "Parameter name must not start or end with a blank."); 727 expectedMessage: "Parameter name must not start or end with a blank.");
728 } 728 }
729 729
730 void test_validateVariableName_OK() { 730 void test_validateVariableName_OK() {
731 assertRefactoringStatusOK(validateVariableName("newName")); 731 assertRefactoringStatusOK(validateVariableName("newName"));
732 } 732 }
733 733
734 void test_validateVariableName_OK_leadingDollar() { 734 void test_validateVariableName_OK_leadingDollar() {
735 assertRefactoringStatusOK(validateVariableName("\$newName")); 735 assertRefactoringStatusOK(validateVariableName("\$newName"));
736 } 736 }
(...skipping 16 matching lines...) Expand all
753 void test_validateVariableName_empty() { 753 void test_validateVariableName_empty() {
754 assertRefactoringStatus( 754 assertRefactoringStatus(
755 validateVariableName(""), 755 validateVariableName(""),
756 RefactoringProblemSeverity.FATAL, 756 RefactoringProblemSeverity.FATAL,
757 expectedMessage: "Variable name must not be empty."); 757 expectedMessage: "Variable name must not be empty.");
758 } 758 }
759 759
760 void test_validateVariableName_leadingBlanks() { 760 void test_validateVariableName_leadingBlanks() {
761 assertRefactoringStatus( 761 assertRefactoringStatus(
762 validateVariableName(" newName"), 762 validateVariableName(" newName"),
763 RefactoringProblemSeverity.ERROR, 763 RefactoringProblemSeverity.FATAL,
764 expectedMessage: "Variable name must not start or end with a blank."); 764 expectedMessage: "Variable name must not start or end with a blank.");
765 } 765 }
766 766
767 void test_validateVariableName_notIdentifierMiddle() { 767 void test_validateVariableName_notIdentifierMiddle() {
768 assertRefactoringStatus( 768 assertRefactoringStatus(
769 validateVariableName("new-Name"), 769 validateVariableName("new-Name"),
770 RefactoringProblemSeverity.ERROR, 770 RefactoringProblemSeverity.FATAL,
771 expectedMessage: "Variable name must not contain '-'."); 771 expectedMessage: "Variable name must not contain '-'.");
772 } 772 }
773 773
774 void test_validateVariableName_notIdentifierStart() { 774 void test_validateVariableName_notIdentifierStart() {
775 assertRefactoringStatus( 775 assertRefactoringStatus(
776 validateVariableName("2newName"), 776 validateVariableName("2newName"),
777 RefactoringProblemSeverity.ERROR, 777 RefactoringProblemSeverity.FATAL,
778 expectedMessage: 778 expectedMessage:
779 "Variable name must begin with a lowercase letter or underscore."); 779 "Variable name must begin with a lowercase letter or underscore.");
780 } 780 }
781 781
782 void test_validateVariableName_null() { 782 void test_validateVariableName_null() {
783 assertRefactoringStatus( 783 assertRefactoringStatus(
784 validateVariableName(null), 784 validateVariableName(null),
785 RefactoringProblemSeverity.FATAL, 785 RefactoringProblemSeverity.FATAL,
786 expectedMessage: "Variable name must not be null."); 786 expectedMessage: "Variable name must not be null.");
787 } 787 }
788 788
789 void test_validateVariableName_trailingBlanks() { 789 void test_validateVariableName_trailingBlanks() {
790 assertRefactoringStatus( 790 assertRefactoringStatus(
791 validateVariableName("newName "), 791 validateVariableName("newName "),
792 RefactoringProblemSeverity.ERROR, 792 RefactoringProblemSeverity.FATAL,
793 expectedMessage: "Variable name must not start or end with a blank."); 793 expectedMessage: "Variable name must not start or end with a blank.");
794 } 794 }
795 } 795 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/services/refactoring/extract_method_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698