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

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

Issue 908463004: Convert refactoring tests to use 'await'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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
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.rename_library; 5 library test.services.refactoring.rename_library;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analyzer/src/generated/source.dart'; 8 import 'package:analyzer/src/generated/source.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 28 matching lines...) Expand all
39 RefactoringProblemSeverity.FATAL, 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() async {
50 Source unitSource = addSource('/part.dart', ''' 50 Source unitSource = addSource('/part.dart', '''
51 part of my.app; 51 part of my.app;
52 '''); 52 ''');
53 indexTestUnit(''' 53 indexTestUnit('''
54 library my.app; 54 library my.app;
55 part 'part.dart'; 55 part 'part.dart';
56 '''); 56 ''');
57 index.indexUnit( 57 index.indexUnit(
58 context, 58 context,
59 context.resolveCompilationUnit2(unitSource, testSource)); 59 context.resolveCompilationUnit2(unitSource, testSource));
60 // configure refactoring 60 // configure refactoring
61 _createRenameRefactoring(); 61 _createRenameRefactoring();
62 expect(refactoring.refactoringName, 'Rename Library'); 62 expect(refactoring.refactoringName, 'Rename Library');
63 expect(refactoring.elementKindName, 'library'); 63 expect(refactoring.elementKindName, 'library');
64 refactoring.newName = 'the.new.name'; 64 refactoring.newName = 'the.new.name';
65 // validate change 65 // validate change
66 return assertSuccessfulRefactoring(''' 66 await assertSuccessfulRefactoring('''
67 library the.new.name; 67 library the.new.name;
68 part 'part.dart'; 68 part 'part.dart';
69 ''').then((_) { 69 ''');
70 assertFileChangeResult('/part.dart', ''' 70 assertFileChangeResult('/part.dart', '''
71 part of the.new.name; 71 part of the.new.name;
72 '''); 72 ''');
73 });
74 } 73 }
75 74
76 void _createRenameRefactoring() { 75 void _createRenameRefactoring() {
77 createRenameRefactoringForElement(testUnitElement.library); 76 createRenameRefactoringForElement(testUnitElement.library);
78 } 77 }
79 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698