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

Unified Diff: pkg/analysis_services/test/refactoring/rename_import_test.dart

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_services/test/refactoring/rename_import_test.dart
diff --git a/pkg/analysis_services/test/refactoring/rename_import_test.dart b/pkg/analysis_services/test/refactoring/rename_import_test.dart
deleted file mode 100644
index 1374c552c97921d66f74f576920a6bb7885f4416..0000000000000000000000000000000000000000
--- a/pkg/analysis_services/test/refactoring/rename_import_test.dart
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.services.refactoring.rename_import;
-
-import 'package:analysis_services/correction/status.dart';
-import 'package:analysis_testing/reflective_tests.dart';
-import 'package:analyzer/src/generated/ast.dart';
-import 'package:unittest/unittest.dart';
-
-import 'abstract_rename.dart';
-
-
-main() {
- groupSep = ' | ';
- runReflectiveTests(RenameImportTest);
-}
-
-
-@ReflectiveTestCase()
-class RenameImportTest extends RenameRefactoringTest {
- test_checkNewName() {
- indexTestUnit("import 'dart:async' as test;");
- _createRefactoring("import 'dart:");
- expect(refactoring.oldName, 'test');
- // null
- refactoring.newName = null;
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringStatusSeverity.ERROR,
- expectedMessage: "Import prefix name must not be null.");
- // same
- refactoring.newName = 'test';
- assertRefactoringStatus(
- refactoring.checkNewName(),
- RefactoringStatusSeverity.FATAL,
- expectedMessage: "The new name must be different than the current name.");
- // empty
- refactoring.newName = '';
- assertRefactoringStatusOK(refactoring.checkNewName());
- // OK
- refactoring.newName = 'newName';
- assertRefactoringStatusOK(refactoring.checkNewName());
- }
-
- test_createChange_add() {
- indexTestUnit('''
-import 'dart:async';
-import 'dart:math' show Random, min hide max;
-main() {
- Future f;
- Random r;
- min(1, 2);
-}
-''');
- // configure refactoring
- _createRefactoring("import 'dart:math");
- expect(refactoring.refactoringName, 'Rename Import Prefix');
- refactoring.newName = 'newName';
- // validate change
- return assertSuccessfulRename('''
-import 'dart:async';
-import 'dart:math' as newName show Random, min hide max;
-main() {
- Future f;
- newName.Random r;
- newName.min(1, 2);
-}
-''');
- }
-
- test_createChange_change_className() {
- indexTestUnit('''
-import 'dart:math' as test;
-import 'dart:async' as test;
-main() {
- test.Future f;
-}
-''');
- // configure refactoring
- _createRefactoring("import 'dart:async");
- expect(refactoring.refactoringName, 'Rename Import Prefix');
- expect(refactoring.oldName, 'test');
- refactoring.newName = 'newName';
- // validate change
- return assertSuccessfulRename('''
-import 'dart:math' as test;
-import 'dart:async' as newName;
-main() {
- newName.Future f;
-}
-''');
- }
-
- test_createChange_change_function() {
- indexTestUnit('''
-import 'dart:math' as test;
-import 'dart:async' as test;
-main() {
- test.max(1, 2);
- test.Future f;
-}
-''');
- // configure refactoring
- _createRefactoring("import 'dart:math");
- expect(refactoring.refactoringName, 'Rename Import Prefix');
- expect(refactoring.oldName, 'test');
- refactoring.newName = 'newName';
- // validate change
- return assertSuccessfulRename('''
-import 'dart:math' as newName;
-import 'dart:async' as test;
-main() {
- newName.max(1, 2);
- test.Future f;
-}
-''');
- }
-
- test_createChange_remove() {
- indexTestUnit('''
-import 'dart:math' as test;
-import 'dart:async' as test;
-main() {
- test.Future f;
-}
-''');
- // configure refactoring
- _createRefactoring("import 'dart:async");
- expect(refactoring.refactoringName, 'Rename Import Prefix');
- expect(refactoring.oldName, 'test');
- refactoring.newName = '';
- // validate change
- return assertSuccessfulRename('''
-import 'dart:math' as test;
-import 'dart:async';
-main() {
- Future f;
-}
-''');
- }
-
- void _createRefactoring(String search) {
- ImportDirective directive =
- findNodeAtString(search, (node) => node is ImportDirective);
- createRenameRefactoringForElement(directive.element);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698