| 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/protocol.dart' | 7 import 'package:analysis_server/src/protocol.dart' |
| 8 show RefactoringProblemSeverity; | 8 show 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 validateMethodName("NewName"), RefactoringProblemSeverity.WARNING, | 472 validateMethodName("NewName"), RefactoringProblemSeverity.WARNING, |
| 473 expectedMessage: "Method name should start with a lowercase letter."); | 473 expectedMessage: "Method name should start with a lowercase letter."); |
| 474 } | 474 } |
| 475 | 475 |
| 476 void test_validateMethodName_empty() { | 476 void test_validateMethodName_empty() { |
| 477 assertRefactoringStatus( | 477 assertRefactoringStatus( |
| 478 validateMethodName(""), RefactoringProblemSeverity.FATAL, | 478 validateMethodName(""), RefactoringProblemSeverity.FATAL, |
| 479 expectedMessage: "Method name must not be empty."); | 479 expectedMessage: "Method name must not be empty."); |
| 480 } | 480 } |
| 481 | 481 |
| 482 void test_validateMethodName_keyword() { |
| 483 assertRefactoringStatus( |
| 484 validateMethodName("for"), RefactoringProblemSeverity.FATAL, |
| 485 expectedMessage: "Method name must not be a keyword."); |
| 486 } |
| 487 |
| 482 void test_validateMethodName_leadingBlanks() { | 488 void test_validateMethodName_leadingBlanks() { |
| 483 assertRefactoringStatus( | 489 assertRefactoringStatus( |
| 484 validateMethodName(" newName"), RefactoringProblemSeverity.FATAL, | 490 validateMethodName(" newName"), RefactoringProblemSeverity.FATAL, |
| 485 expectedMessage: "Method name must not start or end with a blank."); | 491 expectedMessage: "Method name must not start or end with a blank."); |
| 486 } | 492 } |
| 487 | 493 |
| 488 void test_validateMethodName_notIdentifierMiddle() { | 494 void test_validateMethodName_notIdentifierMiddle() { |
| 489 assertRefactoringStatus( | 495 assertRefactoringStatus( |
| 490 validateMethodName("new-Name"), RefactoringProblemSeverity.FATAL, | 496 validateMethodName("new-Name"), RefactoringProblemSeverity.FATAL, |
| 491 expectedMessage: "Method name must not contain '-'."); | 497 expectedMessage: "Method name must not contain '-'."); |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 void test_validateVariableName_OK_middleUnderscore() { | 632 void test_validateVariableName_OK_middleUnderscore() { |
| 627 assertRefactoringStatusOK(validateVariableName("new_name")); | 633 assertRefactoringStatusOK(validateVariableName("new_name")); |
| 628 } | 634 } |
| 629 | 635 |
| 630 void test_validateVariableName_trailingBlanks() { | 636 void test_validateVariableName_trailingBlanks() { |
| 631 assertRefactoringStatus( | 637 assertRefactoringStatus( |
| 632 validateVariableName("newName "), RefactoringProblemSeverity.FATAL, | 638 validateVariableName("newName "), RefactoringProblemSeverity.FATAL, |
| 633 expectedMessage: "Variable name must not start or end with a blank."); | 639 expectedMessage: "Variable name must not start or end with a blank."); |
| 634 } | 640 } |
| 635 } | 641 } |
| OLD | NEW |