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

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

Issue 1266923004: More fixes for failures on the Windows bot (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 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:test_reflective_loader/test_reflective_loader.dart'; 9 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 import '../../utils.dart';
12 import 'abstract_rename.dart'; 13 import 'abstract_rename.dart';
13 14
14 main() { 15 main() {
15 groupSep = ' | '; 16 initializeTestEnvironment();
16 defineReflectiveTests(RenameLibraryTest); 17 defineReflectiveTests(RenameLibraryTest);
17 } 18 }
18 19
19 @reflectiveTest 20 @reflectiveTest
20 class RenameLibraryTest extends RenameRefactoringTest { 21 class RenameLibraryTest extends RenameRefactoringTest {
21 void test_checkNewName() { 22 void test_checkNewName() {
22 indexTestUnit(''' 23 indexTestUnit('''
23 library my.app; 24 library my.app;
24 '''); 25 ''');
25 _createRenameRefactoring(); 26 _createRenameRefactoring();
26 // null 27 // null
27 refactoring.newName = null; 28 refactoring.newName = null;
28 assertRefactoringStatus( 29 assertRefactoringStatus(
29 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL, 30 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
30 expectedMessage: "Library name must not be null."); 31 expectedMessage: "Library name must not be null.");
31 // empty 32 // empty
32 refactoring.newName = ''; 33 refactoring.newName = '';
33 assertRefactoringStatus( 34 assertRefactoringStatus(
34 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL, 35 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
35 expectedMessage: "Library name must not be blank."); 36 expectedMessage: "Library name must not be blank.");
36 // same name 37 // same name
37 refactoring.newName = 'my.app'; 38 refactoring.newName = 'my.app';
38 assertRefactoringStatus( 39 assertRefactoringStatus(
39 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL, 40 refactoring.checkNewName(), RefactoringProblemSeverity.FATAL,
40 expectedMessage: "The new name must be different than the current name." ); 41 expectedMessage:
42 "The new name must be different than the current name.");
41 } 43 }
42 44
43 test_createChange() async { 45 test_createChange() async {
44 Source unitSource = addSource('/part.dart', ''' 46 Source unitSource = addSource(
47 '/part.dart',
48 '''
45 part of my.app; 49 part of my.app;
46 '''); 50 ''');
47 indexTestUnit(''' 51 indexTestUnit('''
48 library my.app; 52 library my.app;
49 part 'part.dart'; 53 part 'part.dart';
50 '''); 54 ''');
51 index.indexUnit( 55 index.indexUnit(
52 context, context.resolveCompilationUnit2(unitSource, testSource)); 56 context, context.resolveCompilationUnit2(unitSource, testSource));
53 // configure refactoring 57 // configure refactoring
54 _createRenameRefactoring(); 58 _createRenameRefactoring();
55 expect(refactoring.refactoringName, 'Rename Library'); 59 expect(refactoring.refactoringName, 'Rename Library');
56 expect(refactoring.elementKindName, 'library'); 60 expect(refactoring.elementKindName, 'library');
57 refactoring.newName = 'the.new.name'; 61 refactoring.newName = 'the.new.name';
58 // validate change 62 // validate change
59 await assertSuccessfulRefactoring(''' 63 await assertSuccessfulRefactoring('''
60 library the.new.name; 64 library the.new.name;
61 part 'part.dart'; 65 part 'part.dart';
62 '''); 66 ''');
63 assertFileChangeResult('/part.dart', ''' 67 assertFileChangeResult(
68 '/part.dart',
69 '''
64 part of the.new.name; 70 part of the.new.name;
65 '''); 71 ''');
66 } 72 }
67 73
68 void _createRenameRefactoring() { 74 void _createRenameRefactoring() {
69 createRenameRefactoringForElement(testUnitElement.library); 75 createRenameRefactoringForElement(testUnitElement.library);
70 } 76 }
71 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698