| 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.rename_library; | 5 library test.services.refactoring.rename_library; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/protocol2.dart'; | 7 import 'package:analysis_server/src/protocol2.dart'; |
| 8 import 'package:analysis_testing/reflective_tests.dart'; | 8 import 'package:analysis_testing/reflective_tests.dart'; |
| 9 import 'package:analyzer/src/generated/source.dart'; | 9 import 'package:analyzer/src/generated/source.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class RenameLibraryTest extends RenameRefactoringTest { | 23 class RenameLibraryTest extends RenameRefactoringTest { |
| 24 void test_checkNewName() { | 24 void test_checkNewName() { |
| 25 indexTestUnit(''' | 25 indexTestUnit(''' |
| 26 library my.app; | 26 library my.app; |
| 27 '''); | 27 '''); |
| 28 _createRenameRefactoring(); | 28 _createRenameRefactoring(); |
| 29 // null | 29 // null |
| 30 refactoring.newName = null; | 30 refactoring.newName = null; |
| 31 assertRefactoringStatus( | 31 assertRefactoringStatus( |
| 32 refactoring.checkNewName(), | 32 refactoring.checkNewName(), |
| 33 RefactoringProblemSeverity.ERROR, | 33 RefactoringProblemSeverity.FATAL, |
| 34 expectedMessage: "Library name must not be null."); | 34 expectedMessage: "Library name must not be null."); |
| 35 // empty | 35 // empty |
| 36 refactoring.newName = ''; | 36 refactoring.newName = ''; |
| 37 assertRefactoringStatus( | 37 assertRefactoringStatus( |
| 38 refactoring.checkNewName(), | 38 refactoring.checkNewName(), |
| 39 RefactoringProblemSeverity.ERROR, | 39 RefactoringProblemSeverity.FATAL, |
| 40 expectedMessage: "Library name must not be blank."); | 40 expectedMessage: "Library name must not be blank."); |
| 41 // same name | 41 // same name |
| 42 refactoring.newName = 'my.app'; | 42 refactoring.newName = 'my.app'; |
| 43 assertRefactoringStatus( | 43 assertRefactoringStatus( |
| 44 refactoring.checkNewName(), | 44 refactoring.checkNewName(), |
| 45 RefactoringProblemSeverity.FATAL, | 45 RefactoringProblemSeverity.FATAL, |
| 46 expectedMessage: "The new name must be different than the current name."
); | 46 expectedMessage: "The new name must be different than the current name."
); |
| 47 } | 47 } |
| 48 | 48 |
| 49 test_createChange() { | 49 test_createChange() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 69 assertFileChangeResult('/part.dart', ''' | 69 assertFileChangeResult('/part.dart', ''' |
| 70 part of the.new.name; | 70 part of the.new.name; |
| 71 '''); | 71 '''); |
| 72 }); | 72 }); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void _createRenameRefactoring() { | 75 void _createRenameRefactoring() { |
| 76 createRenameRefactoringForElement(testUnitElement.library); | 76 createRenameRefactoringForElement(testUnitElement.library); |
| 77 } | 77 } |
| 78 } | 78 } |
| OLD | NEW |