| OLD | NEW |
| 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/protocol2.dart' show | 7 import 'package:analysis_server/src/protocol2.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 void test_validateClassName_doesNotStartWithLowerCase() { | 44 void test_validateClassName_doesNotStartWithLowerCase() { |
| 45 assertRefactoringStatus( | 45 assertRefactoringStatus( |
| 46 validateClassName("newName"), | 46 validateClassName("newName"), |
| 47 RefactoringProblemSeverity.WARNING, | 47 RefactoringProblemSeverity.WARNING, |
| 48 expectedMessage: "Class name should start with an uppercase letter."); | 48 expectedMessage: "Class name should start with an uppercase letter."); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void test_validateClassName_empty() { | 51 void test_validateClassName_empty() { |
| 52 assertRefactoringStatus( | 52 assertRefactoringStatus( |
| 53 validateClassName(""), | 53 validateClassName(""), |
| 54 RefactoringProblemSeverity.ERROR, | 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 138 assertRefactoringStatus( | 138 assertRefactoringStatus( |
| 139 validateConstantName("99_RED_BALLOONS"), | 139 validateConstantName("99_RED_BALLOONS"), |
| 140 RefactoringProblemSeverity.ERROR, | 140 RefactoringProblemSeverity.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 assertRefactoringStatus( | 193 assertRefactoringStatus( |
| 194 validateConstructorName("2name"), | 194 validateConstructorName("2name"), |
| 195 RefactoringProblemSeverity.ERROR, | 195 RefactoringProblemSeverity.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 226 void test_validateFieldName_doesNotStartWithLowerCase() { | 226 void test_validateFieldName_doesNotStartWithLowerCase() { |
| 227 assertRefactoringStatus( | 227 assertRefactoringStatus( |
| 228 validateFieldName("NewName"), | 228 validateFieldName("NewName"), |
| 229 RefactoringProblemSeverity.WARNING, | 229 RefactoringProblemSeverity.WARNING, |
| 230 expectedMessage: "Field name should start with a lowercase letter."); | 230 expectedMessage: "Field name should start with a lowercase letter."); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void test_validateFieldName_empty() { | 233 void test_validateFieldName_empty() { |
| 234 assertRefactoringStatus( | 234 assertRefactoringStatus( |
| 235 validateFieldName(""), | 235 validateFieldName(""), |
| 236 RefactoringProblemSeverity.ERROR, | 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 288 void test_validateFunctionName_doesNotStartWithLowerCase() { | 288 void test_validateFunctionName_doesNotStartWithLowerCase() { |
| 289 assertRefactoringStatus( | 289 assertRefactoringStatus( |
| 290 validateFunctionName("NewName"), | 290 validateFunctionName("NewName"), |
| 291 RefactoringProblemSeverity.WARNING, | 291 RefactoringProblemSeverity.WARNING, |
| 292 expectedMessage: "Function name should start with a lowercase letter."); | 292 expectedMessage: "Function name should start with a lowercase letter."); |
| 293 } | 293 } |
| 294 | 294 |
| 295 void test_validateFunctionName_empty() { | 295 void test_validateFunctionName_empty() { |
| 296 assertRefactoringStatus( | 296 assertRefactoringStatus( |
| 297 validateFunctionName(""), | 297 validateFunctionName(""), |
| 298 RefactoringProblemSeverity.ERROR, | 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 355 assertRefactoringStatus( | 355 assertRefactoringStatus( |
| 356 validateFunctionTypeAliasName("newName"), | 356 validateFunctionTypeAliasName("newName"), |
| 357 RefactoringProblemSeverity.WARNING, | 357 RefactoringProblemSeverity.WARNING, |
| 358 expectedMessage: | 358 expectedMessage: |
| 359 "Function type alias name should start with an uppercase letter."); | 359 "Function type alias name should start with an uppercase letter."); |
| 360 } | 360 } |
| 361 | 361 |
| 362 void test_validateFunctionTypeAliasName_empty() { | 362 void test_validateFunctionTypeAliasName_empty() { |
| 363 assertRefactoringStatus( | 363 assertRefactoringStatus( |
| 364 validateFunctionTypeAliasName(""), | 364 validateFunctionTypeAliasName(""), |
| 365 RefactoringProblemSeverity.ERROR, | 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 assertRefactoringStatus( | 445 assertRefactoringStatus( |
| 446 validateImportPrefixName("2newName"), | 446 validateImportPrefixName("2newName"), |
| 447 RefactoringProblemSeverity.ERROR, | 447 RefactoringProblemSeverity.ERROR, |
| 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.ERROR, | 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.ERROR, |
| 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_validateLibraryName_OK_oneIdentifier() { | 466 void test_validateLibraryName_OK_oneIdentifier() { |
| 467 assertRefactoringStatusOK(validateLibraryName("name")); | 467 assertRefactoringStatusOK(validateLibraryName("name")); |
| 468 } | 468 } |
| 469 | 469 |
| 470 void test_validateLibraryName_OK_severalIdentifiers() { | 470 void test_validateLibraryName_OK_severalIdentifiers() { |
| 471 assertRefactoringStatusOK(validateLibraryName("my.library.name")); | 471 assertRefactoringStatusOK(validateLibraryName("my.library.name")); |
| 472 } | 472 } |
| 473 | 473 |
| 474 void test_validateLibraryName_blank() { | 474 void test_validateLibraryName_blank() { |
| 475 assertRefactoringStatus( | 475 assertRefactoringStatus( |
| 476 validateLibraryName(""), | 476 validateLibraryName(""), |
| 477 RefactoringProblemSeverity.ERROR, | 477 RefactoringProblemSeverity.FATAL, |
| 478 expectedMessage: "Library name must not be blank."); | 478 expectedMessage: "Library name must not be blank."); |
| 479 assertRefactoringStatus( | 479 assertRefactoringStatus( |
| 480 validateLibraryName(" "), | 480 validateLibraryName(" "), |
| 481 RefactoringProblemSeverity.ERROR, | 481 RefactoringProblemSeverity.FATAL, |
| 482 expectedMessage: "Library name must not be blank."); | 482 expectedMessage: "Library name must not be blank."); |
| 483 } | 483 } |
| 484 | 484 |
| 485 void test_validateLibraryName_blank_identifier() { | 485 void test_validateLibraryName_blank_identifier() { |
| 486 assertRefactoringStatus( | 486 assertRefactoringStatus( |
| 487 validateLibraryName("my..name"), | 487 validateLibraryName("my..name"), |
| 488 RefactoringProblemSeverity.ERROR, | 488 RefactoringProblemSeverity.FATAL, |
| 489 expectedMessage: "Library name identifier must not be empty."); | 489 expectedMessage: "Library name identifier must not be empty."); |
| 490 assertRefactoringStatus( | 490 assertRefactoringStatus( |
| 491 validateLibraryName("my. .name"), | 491 validateLibraryName("my. .name"), |
| 492 RefactoringProblemSeverity.ERROR, | 492 RefactoringProblemSeverity.ERROR, |
| 493 expectedMessage: "Library name identifier must not start or end with a b
lank."); | 493 expectedMessage: "Library name identifier must not start or end with a b
lank."); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void test_validateLibraryName_hasUpperCase() { | 496 void test_validateLibraryName_hasUpperCase() { |
| 497 assertRefactoringStatus( | 497 assertRefactoringStatus( |
| 498 validateLibraryName("my.newName"), | 498 validateLibraryName("my.newName"), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 519 assertRefactoringStatus( | 519 assertRefactoringStatus( |
| 520 validateLibraryName("my.2bad.name"), | 520 validateLibraryName("my.2bad.name"), |
| 521 RefactoringProblemSeverity.ERROR, | 521 RefactoringProblemSeverity.ERROR, |
| 522 expectedMessage: | 522 expectedMessage: |
| 523 "Library name identifier must begin with a lowercase letter or under
score."); | 523 "Library name identifier must begin with a lowercase letter or under
score."); |
| 524 } | 524 } |
| 525 | 525 |
| 526 void test_validateLibraryName_null() { | 526 void test_validateLibraryName_null() { |
| 527 assertRefactoringStatus( | 527 assertRefactoringStatus( |
| 528 validateLibraryName(null), | 528 validateLibraryName(null), |
| 529 RefactoringProblemSeverity.ERROR, | 529 RefactoringProblemSeverity.FATAL, |
| 530 expectedMessage: "Library name must not be null."); | 530 expectedMessage: "Library name must not be null."); |
| 531 } | 531 } |
| 532 | 532 |
| 533 void test_validateLibraryName_trailingBlanks() { | 533 void test_validateLibraryName_trailingBlanks() { |
| 534 assertRefactoringStatus( | 534 assertRefactoringStatus( |
| 535 validateLibraryName("my.bad .name"), | 535 validateLibraryName("my.bad .name"), |
| 536 RefactoringProblemSeverity.ERROR, | 536 RefactoringProblemSeverity.ERROR, |
| 537 expectedMessage: "Library name identifier must not start or end with a b
lank."); | 537 expectedMessage: "Library name identifier must not start or end with a b
lank."); |
| 538 } | 538 } |
| 539 | 539 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 552 void test_validateMethodName_doesNotStartWithLowerCase() { | 552 void test_validateMethodName_doesNotStartWithLowerCase() { |
| 553 assertRefactoringStatus( | 553 assertRefactoringStatus( |
| 554 validateMethodName("NewName"), | 554 validateMethodName("NewName"), |
| 555 RefactoringProblemSeverity.WARNING, | 555 RefactoringProblemSeverity.WARNING, |
| 556 expectedMessage: "Method name should start with a lowercase letter."); | 556 expectedMessage: "Method name should start with a lowercase letter."); |
| 557 } | 557 } |
| 558 | 558 |
| 559 void test_validateMethodName_empty() { | 559 void test_validateMethodName_empty() { |
| 560 assertRefactoringStatus( | 560 assertRefactoringStatus( |
| 561 validateMethodName(""), | 561 validateMethodName(""), |
| 562 RefactoringProblemSeverity.ERROR, | 562 RefactoringProblemSeverity.FATAL, |
| 563 expectedMessage: "Method name must not be empty."); | 563 expectedMessage: "Method name must not be empty."); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void test_validateMethodName_leadingBlanks() { | 566 void test_validateMethodName_leadingBlanks() { |
| 567 assertRefactoringStatus( | 567 assertRefactoringStatus( |
| 568 validateMethodName(" newName"), | 568 validateMethodName(" newName"), |
| 569 RefactoringProblemSeverity.ERROR, | 569 RefactoringProblemSeverity.ERROR, |
| 570 expectedMessage: "Method name must not start or end with a blank."); | 570 expectedMessage: "Method name must not start or end with a blank."); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void test_validateMethodName_notIdentifierMiddle() { | 573 void test_validateMethodName_notIdentifierMiddle() { |
| 574 assertRefactoringStatus( | 574 assertRefactoringStatus( |
| 575 validateMethodName("new-Name"), | 575 validateMethodName("new-Name"), |
| 576 RefactoringProblemSeverity.ERROR, | 576 RefactoringProblemSeverity.ERROR, |
| 577 expectedMessage: "Method name must not contain '-'."); | 577 expectedMessage: "Method name must not contain '-'."); |
| 578 } | 578 } |
| 579 | 579 |
| 580 void test_validateMethodName_notIdentifierStart() { | 580 void test_validateMethodName_notIdentifierStart() { |
| 581 assertRefactoringStatus( | 581 assertRefactoringStatus( |
| 582 validateMethodName("2newName"), | 582 validateMethodName("2newName"), |
| 583 RefactoringProblemSeverity.ERROR, | 583 RefactoringProblemSeverity.ERROR, |
| 584 expectedMessage: | 584 expectedMessage: |
| 585 "Method name must begin with a lowercase letter or underscore."); | 585 "Method name must begin with a lowercase letter or underscore."); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void test_validateMethodName_null() { | 588 void test_validateMethodName_null() { |
| 589 assertRefactoringStatus( | 589 assertRefactoringStatus( |
| 590 validateMethodName(null), | 590 validateMethodName(null), |
| 591 RefactoringProblemSeverity.ERROR, | 591 RefactoringProblemSeverity.FATAL, |
| 592 expectedMessage: "Method name must not be null."); | 592 expectedMessage: "Method name must not be null."); |
| 593 } | 593 } |
| 594 | 594 |
| 595 void test_validateMethodName_trailingBlanks() { | 595 void test_validateMethodName_trailingBlanks() { |
| 596 assertRefactoringStatus( | 596 assertRefactoringStatus( |
| 597 validateMethodName("newName "), | 597 validateMethodName("newName "), |
| 598 RefactoringProblemSeverity.ERROR, | 598 RefactoringProblemSeverity.ERROR, |
| 599 expectedMessage: "Method name must not start or end with a blank."); | 599 expectedMessage: "Method name must not start or end with a blank."); |
| 600 } | 600 } |
| 601 | 601 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 614 void test_validateParameterName_doesNotStartWithLowerCase() { | 614 void test_validateParameterName_doesNotStartWithLowerCase() { |
| 615 assertRefactoringStatus( | 615 assertRefactoringStatus( |
| 616 validateParameterName("NewName"), | 616 validateParameterName("NewName"), |
| 617 RefactoringProblemSeverity.WARNING, | 617 RefactoringProblemSeverity.WARNING, |
| 618 expectedMessage: "Parameter name should start with a lowercase letter.")
; | 618 expectedMessage: "Parameter name should start with a lowercase letter.")
; |
| 619 } | 619 } |
| 620 | 620 |
| 621 void test_validateParameterName_empty() { | 621 void test_validateParameterName_empty() { |
| 622 assertRefactoringStatus( | 622 assertRefactoringStatus( |
| 623 validateParameterName(""), | 623 validateParameterName(""), |
| 624 RefactoringProblemSeverity.ERROR, | 624 RefactoringProblemSeverity.FATAL, |
| 625 expectedMessage: "Parameter name must not be empty."); | 625 expectedMessage: "Parameter name must not be empty."); |
| 626 } | 626 } |
| 627 | 627 |
| 628 void test_validateParameterName_leadingBlanks() { | 628 void test_validateParameterName_leadingBlanks() { |
| 629 assertRefactoringStatus( | 629 assertRefactoringStatus( |
| 630 validateParameterName(" newName"), | 630 validateParameterName(" newName"), |
| 631 RefactoringProblemSeverity.ERROR, | 631 RefactoringProblemSeverity.ERROR, |
| 632 expectedMessage: "Parameter name must not start or end with a blank."); | 632 expectedMessage: "Parameter name must not start or end with a blank."); |
| 633 } | 633 } |
| 634 | 634 |
| 635 void test_validateParameterName_notIdentifierMiddle() { | 635 void test_validateParameterName_notIdentifierMiddle() { |
| 636 assertRefactoringStatus( | 636 assertRefactoringStatus( |
| 637 validateParameterName("new-Name"), | 637 validateParameterName("new-Name"), |
| 638 RefactoringProblemSeverity.ERROR, | 638 RefactoringProblemSeverity.ERROR, |
| 639 expectedMessage: "Parameter name must not contain '-'."); | 639 expectedMessage: "Parameter name must not contain '-'."); |
| 640 } | 640 } |
| 641 | 641 |
| 642 void test_validateParameterName_notIdentifierStart() { | 642 void test_validateParameterName_notIdentifierStart() { |
| 643 assertRefactoringStatus( | 643 assertRefactoringStatus( |
| 644 validateParameterName("2newName"), | 644 validateParameterName("2newName"), |
| 645 RefactoringProblemSeverity.ERROR, | 645 RefactoringProblemSeverity.ERROR, |
| 646 expectedMessage: | 646 expectedMessage: |
| 647 "Parameter name must begin with a lowercase letter or underscore."); | 647 "Parameter name must begin with a lowercase letter or underscore."); |
| 648 } | 648 } |
| 649 | 649 |
| 650 void test_validateParameterName_null() { | 650 void test_validateParameterName_null() { |
| 651 assertRefactoringStatus( | 651 assertRefactoringStatus( |
| 652 validateParameterName(null), | 652 validateParameterName(null), |
| 653 RefactoringProblemSeverity.ERROR, | 653 RefactoringProblemSeverity.FATAL, |
| 654 expectedMessage: "Parameter name must not be null."); | 654 expectedMessage: "Parameter name must not be null."); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void test_validateParameterName_trailingBlanks() { | 657 void test_validateParameterName_trailingBlanks() { |
| 658 assertRefactoringStatus( | 658 assertRefactoringStatus( |
| 659 validateParameterName("newName "), | 659 validateParameterName("newName "), |
| 660 RefactoringProblemSeverity.ERROR, | 660 RefactoringProblemSeverity.ERROR, |
| 661 expectedMessage: "Parameter name must not start or end with a blank."); | 661 expectedMessage: "Parameter name must not start or end with a blank."); |
| 662 } | 662 } |
| 663 | 663 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 680 void test_validateVariableName_doesNotStartWithLowerCase() { | 680 void test_validateVariableName_doesNotStartWithLowerCase() { |
| 681 assertRefactoringStatus( | 681 assertRefactoringStatus( |
| 682 validateVariableName("NewName"), | 682 validateVariableName("NewName"), |
| 683 RefactoringProblemSeverity.WARNING, | 683 RefactoringProblemSeverity.WARNING, |
| 684 expectedMessage: "Variable name should start with a lowercase letter."); | 684 expectedMessage: "Variable name should start with a lowercase letter."); |
| 685 } | 685 } |
| 686 | 686 |
| 687 void test_validateVariableName_empty() { | 687 void test_validateVariableName_empty() { |
| 688 assertRefactoringStatus( | 688 assertRefactoringStatus( |
| 689 validateVariableName(""), | 689 validateVariableName(""), |
| 690 RefactoringProblemSeverity.ERROR, | 690 RefactoringProblemSeverity.FATAL, |
| 691 expectedMessage: "Variable name must not be empty."); | 691 expectedMessage: "Variable name must not be empty."); |
| 692 } | 692 } |
| 693 | 693 |
| 694 void test_validateVariableName_leadingBlanks() { | 694 void test_validateVariableName_leadingBlanks() { |
| 695 assertRefactoringStatus( | 695 assertRefactoringStatus( |
| 696 validateVariableName(" newName"), | 696 validateVariableName(" newName"), |
| 697 RefactoringProblemSeverity.ERROR, | 697 RefactoringProblemSeverity.ERROR, |
| 698 expectedMessage: "Variable name must not start or end with a blank."); | 698 expectedMessage: "Variable name must not start or end with a blank."); |
| 699 } | 699 } |
| 700 | 700 |
| 701 void test_validateVariableName_notIdentifierMiddle() { | 701 void test_validateVariableName_notIdentifierMiddle() { |
| 702 assertRefactoringStatus( | 702 assertRefactoringStatus( |
| 703 validateVariableName("new-Name"), | 703 validateVariableName("new-Name"), |
| 704 RefactoringProblemSeverity.ERROR, | 704 RefactoringProblemSeverity.ERROR, |
| 705 expectedMessage: "Variable name must not contain '-'."); | 705 expectedMessage: "Variable name must not contain '-'."); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void test_validateVariableName_notIdentifierStart() { | 708 void test_validateVariableName_notIdentifierStart() { |
| 709 assertRefactoringStatus( | 709 assertRefactoringStatus( |
| 710 validateVariableName("2newName"), | 710 validateVariableName("2newName"), |
| 711 RefactoringProblemSeverity.ERROR, | 711 RefactoringProblemSeverity.ERROR, |
| 712 expectedMessage: | 712 expectedMessage: |
| 713 "Variable name must begin with a lowercase letter or underscore."); | 713 "Variable name must begin with a lowercase letter or underscore."); |
| 714 } | 714 } |
| 715 | 715 |
| 716 void test_validateVariableName_null() { | 716 void test_validateVariableName_null() { |
| 717 assertRefactoringStatus( | 717 assertRefactoringStatus( |
| 718 validateVariableName(null), | 718 validateVariableName(null), |
| 719 RefactoringProblemSeverity.ERROR, | 719 RefactoringProblemSeverity.FATAL, |
| 720 expectedMessage: "Variable name must not be null."); | 720 expectedMessage: "Variable name must not be null."); |
| 721 } | 721 } |
| 722 | 722 |
| 723 void test_validateVariableName_trailingBlanks() { | 723 void test_validateVariableName_trailingBlanks() { |
| 724 assertRefactoringStatus( | 724 assertRefactoringStatus( |
| 725 validateVariableName("newName "), | 725 validateVariableName("newName "), |
| 726 RefactoringProblemSeverity.ERROR, | 726 RefactoringProblemSeverity.ERROR, |
| 727 expectedMessage: "Variable name must not start or end with a blank."); | 727 expectedMessage: "Variable name must not start or end with a blank."); |
| 728 } | 728 } |
| 729 } | 729 } |
| OLD | NEW |