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

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

Issue 694373002: Support for inlining methods when some arguments are missing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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/inline_method.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/inline_method_test.dart
diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
index d665de6f6dc65057421c905808573db1f8792d72..5a87e765debb4113e3eee2aae27a0321a9ac1672 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
@@ -998,6 +998,85 @@ main() {
''');
}
+ test_noArgument_named_hasDefault() {
+ verifyNoTestUnitErrors = false;
+ indexTestUnit(r'''
+test({a: 42}) {
+ print(a);
+}
+main() {
+ test();
+}
+''');
+ _createRefactoring('test(');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+main() {
+ print(42);
+}
+''');
+ }
+
+ test_noArgument_positional_hasDefault() {
+ verifyNoTestUnitErrors = false;
+ indexTestUnit(r'''
+test([a = 42]) {
+ print(a);
+}
+main() {
+ test();
+}
+''');
+ _createRefactoring('test(');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+main() {
+ print(42);
+}
+''');
+ }
+
+ test_noArgument_positional_noDefault() {
+ verifyNoTestUnitErrors = false;
+ indexTestUnit(r'''
+test([a]) {
+ print(a);
+}
+main() {
+ test();
+}
+''');
+ _createRefactoring('test(');
+ // validate change
+ return _assertSuccessfulRefactoring(r'''
+main() {
+ print(null);
+}
+''');
+ }
+
+ test_noArgument_required() {
+ verifyNoTestUnitErrors = false;
+ indexTestUnit(r'''
+test(a) {
+ print(a);
+}
+main() {
+ test();
+}
+''');
+ _createRefactoring('test();');
+ // error
+ return refactoring.checkAllConditions().then((status) {
+ var location = new SourceRange(findOffset('test();'), 'test()'.length);
+ assertRefactoringStatus(
+ status,
+ RefactoringProblemSeverity.ERROR,
+ expectedMessage: 'No argument for the parameter "a".',
+ expectedContextRange: location);
+ });
+ }
+
test_reference_expressionBody() {
indexTestUnit(r'''
String message() => 'Hello, World!';
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/inline_method.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698