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

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

Issue 2939723002: Clean up some hints (Closed)
Patch Set: Created 3 years, 6 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
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 import 'package:analyzer/src/generated/source.dart';
6 import 'package:analyzer_plugin/protocol/protocol_common.dart'; 5 import 'package:analyzer_plugin/protocol/protocol_common.dart';
7 import 'package:test/test.dart'; 6 import 'package:test/test.dart';
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; 7 import 'package:test_reflective_loader/test_reflective_loader.dart';
9 8
10 import 'abstract_rename.dart'; 9 import 'abstract_rename.dart';
11 10
12 main() { 11 main() {
13 defineReflectiveSuite(() { 12 defineReflectiveSuite(() {
14 defineReflectiveTests(RenameLibraryTest); 13 defineReflectiveTests(RenameLibraryTest);
15 }); 14 });
(...skipping 18 matching lines...) Expand all
34 expectedMessage: "Library name must not be blank."); 33 expectedMessage: "Library name must not be blank.");
35 // same name 34 // same name
36 refactoring.newName = 'my.app'; 35 refactoring.newName = 'my.app';
37 assertRefactoringStatus( 36 assertRefactoringStatus(
38 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL, 37 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
39 expectedMessage: 38 expectedMessage:
40 "The new name must be different than the current name."); 39 "The new name must be different than the current name.");
41 } 40 }
42 41
43 test_createChange() async { 42 test_createChange() async {
44 Source unitSource = addSource( 43 addSource(
45 '/part.dart', 44 '/part.dart',
46 ''' 45 '''
47 part of my.app; 46 part of my.app;
48 '''); 47 ''');
49 await indexTestUnit(''' 48 await indexTestUnit('''
50 library my.app; 49 library my.app;
51 part 'part.dart'; 50 part 'part.dart';
52 '''); 51 ''');
53 // configure refactoring 52 // configure refactoring
54 _createRenameRefactoring(); 53 _createRenameRefactoring();
55 expect(refactoring.refactoringName, 'Rename Library'); 54 expect(refactoring.refactoringName, 'Rename Library');
56 expect(refactoring.elementKindName, 'library'); 55 expect(refactoring.elementKindName, 'library');
57 refactoring.newName = 'the.new.name'; 56 refactoring.newName = 'the.new.name';
58 // validate change 57 // validate change
59 await assertSuccessfulRefactoring(''' 58 await assertSuccessfulRefactoring('''
60 library the.new.name; 59 library the.new.name;
61 part 'part.dart'; 60 part 'part.dart';
62 '''); 61 ''');
63 assertFileChangeResult( 62 assertFileChangeResult(
64 '/part.dart', 63 '/part.dart',
65 ''' 64 '''
66 part of the.new.name; 65 part of the.new.name;
67 '''); 66 ''');
68 } 67 }
69 68
70 test_createChange_hasWhitespaces() async { 69 test_createChange_hasWhitespaces() async {
71 Source unitSource = addSource( 70 addSource(
72 '/part.dart', 71 '/part.dart',
73 ''' 72 '''
74 part of my . app; 73 part of my . app;
75 '''); 74 ''');
76 await indexTestUnit(''' 75 await indexTestUnit('''
77 library my . app; 76 library my . app;
78 part 'part.dart'; 77 part 'part.dart';
79 '''); 78 ''');
80 // configure refactoring 79 // configure refactoring
81 _createRenameRefactoring(); 80 _createRenameRefactoring();
82 expect(refactoring.refactoringName, 'Rename Library'); 81 expect(refactoring.refactoringName, 'Rename Library');
83 expect(refactoring.elementKindName, 'library'); 82 expect(refactoring.elementKindName, 'library');
84 refactoring.newName = 'the.new.name'; 83 refactoring.newName = 'the.new.name';
85 // validate change 84 // validate change
86 await assertSuccessfulRefactoring(''' 85 await assertSuccessfulRefactoring('''
87 library the.new.name; 86 library the.new.name;
88 part 'part.dart'; 87 part 'part.dart';
89 '''); 88 ''');
90 assertFileChangeResult( 89 assertFileChangeResult(
91 '/part.dart', 90 '/part.dart',
92 ''' 91 '''
93 part of the.new.name; 92 part of the.new.name;
94 '''); 93 ''');
95 } 94 }
96 95
97 void _createRenameRefactoring() { 96 void _createRenameRefactoring() {
98 createRenameRefactoringForElement(testUnitElement.library); 97 createRenameRefactoringForElement(testUnitElement.library);
99 } 98 }
100 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698