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

Unified Diff: pkg/analysis_server/test/services/refactoring/extract_local_test.dart

Issue 1498523005: Extract Local refactoring: skip method names in invocations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_local.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/refactoring/extract_local_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
index 4dfb55d29e2b95310f0bd5825deffea3bb2c9dad..1cb626f0071248e2c17056b98d71bb71e8766137 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_local_test.dart
@@ -69,17 +69,16 @@ main() {
expectedMessage: 'Cannot extract the left-hand side of an assignment.');
}
- test_checkInitialConditions_methodName_reference() async {
+ test_checkInitialConditions_namePartOfDeclaration_function() async {
indexTestUnit('''
main() {
- main();
}
''');
- _createRefactoringWithSuffix('main', '();');
+ _createRefactoringWithSuffix('main', '()');
// check conditions
RefactoringStatus status = await refactoring.checkAllConditions();
assertRefactoringStatus(status, RefactoringProblemSeverity.FATAL,
- expectedMessage: 'Cannot extract a single method name.');
+ expectedMessage: 'Cannot extract the name part of a declaration.');
}
test_checkInitialConditions_namePartOfDeclaration_variable() async {
@@ -859,6 +858,24 @@ main() {
''');
}
+ test_singleExpression_methodName_reference() async {
+ indexTestUnit('''
+main() {
+ var v = foo().length;
+}
+String foo() => '';
+''');
+ _createRefactoringWithSuffix('foo', '().');
+ // apply refactoring
+ return _assertSuccessfulRefactoring('''
+main() {
+ var res = foo();
+ var v = res.length;
+}
+String foo() => '';
+''');
+ }
+
test_singleExpression_nameOfProperty_prefixedIdentifier() async {
indexTestUnit('''
main(p) {
@@ -894,7 +911,7 @@ String foo() => '';
}
/**
- * Here we use knowledge how exactly `1 + 2 + 3 + 41 is parsed. We know that
+ * Here we use knowledge how exactly `1 + 2 + 3 + 4` is parsed. We know that
* `1 + 2` will be a separate and complete binary expression, so it can be
* handled as a single expression.
*/
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/extract_local.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698