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

Side by Side Diff: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart

Issue 2728653004: Default arg support continued (flutter-intellij#553). (Closed)
Patch Set: Review tweaks. Created 3 years, 9 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.completion.contributor.dart.local_ref; 5 library test.services.completion.contributor.dart.local_ref;
6 6
7 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol 7 import 'package:analysis_server/plugin/protocol/protocol.dart' as protocol
8 show Element, ElementKind; 8 show Element, ElementKind;
9 import 'package:analysis_server/plugin/protocol/protocol.dart' 9 import 'package:analysis_server/plugin/protocol/protocol.dart'
10 hide Element, ElementKind; 10 hide Element, ElementKind;
(...skipping 4602 matching lines...) Expand 10 before | Expand all | Expand 10 after
4613 addTestSource(''' 4613 addTestSource('''
4614 bool hasLength() => false; 4614 bool hasLength() => false;
4615 void main() {h^}'''); 4615 void main() {h^}''');
4616 await computeSuggestions(); 4616 await computeSuggestions();
4617 4617
4618 assertSuggestFunction('hasLength', 'bool', 4618 assertSuggestFunction('hasLength', 'bool',
4619 relevance: DART_RELEVANCE_LOCAL_FUNCTION, defaultArgListString: null); 4619 relevance: DART_RELEVANCE_LOCAL_FUNCTION, defaultArgListString: null);
4620 } 4620 }
4621 4621
4622 test_ArgDefaults_function_with_optional_positional() async { 4622 test_ArgDefaults_function_with_optional_positional() async {
4623 _addMetaPackageSource(); 4623 addMetaPackageSource();
4624 addTestSource(''' 4624 addTestSource('''
4625 import 'package:meta/meta.dart'; 4625 import 'package:meta/meta.dart';
4626 4626
4627 bool foo(int bar, [bool boo, int baz]) => false; 4627 bool foo(int bar, [bool boo, int baz]) => false;
4628 void main() {h^}'''); 4628 void main() {h^}''');
4629 await computeSuggestions(); 4629 await computeSuggestions();
4630 4630
4631 assertSuggestFunction('foo', 'bool', 4631 assertSuggestFunction('foo', 'bool',
4632 relevance: DART_RELEVANCE_LOCAL_FUNCTION, defaultArgListString: 'bar'); 4632 relevance: DART_RELEVANCE_LOCAL_FUNCTION, defaultArgListString: 'bar');
4633 } 4633 }
4634 4634
4635 test_ArgDefaults_function_with_required_named() async { 4635 test_ArgDefaults_function_with_required_named() async {
4636 _addMetaPackageSource(); 4636 addMetaPackageSource();
4637 addTestSource(''' 4637 addTestSource('''
4638 import 'package:meta/meta.dart'; 4638 import 'package:meta/meta.dart';
4639 4639
4640 bool foo(int bar, {bool boo, @required int baz}) => false; 4640 bool foo(int bar, {bool boo, @required int baz}) => false;
4641 void main() {h^}'''); 4641 void main() {h^}''');
4642 await computeSuggestions(); 4642 await computeSuggestions();
4643 4643
4644 assertSuggestFunction('foo', 'bool', 4644 assertSuggestFunction('foo', 'bool',
4645 relevance: DART_RELEVANCE_LOCAL_FUNCTION, 4645 relevance: DART_RELEVANCE_LOCAL_FUNCTION,
4646 defaultArgListString: 'bar, baz: null'); 4646 defaultArgListString: 'bar, baz: null');
4647 } 4647 }
4648 4648
4649 void _addMetaPackageSource() { 4649 test_ArgDefaults_method_with_required_named() async {
4650 addPackageSource( 4650 addMetaPackageSource();
4651 'meta', 4651 addTestSource('''
4652 'meta.dart', 4652 import 'package:meta/meta.dart';
4653 r'''
4654 library meta;
4655 4653
4656 const Required required = const Required(); 4654 class A {
4655 bool foo(int bar, {bool boo, @required int baz}) => false;
4656 baz() {
4657 f^
4658 }
4659 }''');
4660 await computeSuggestions();
4657 4661
4658 class Required { 4662 assertSuggestMethod('foo', 'A', 'bool',
4659 final String reason; 4663 relevance: DART_RELEVANCE_LOCAL_METHOD,
4660 const Required([this.reason]); 4664 defaultArgListString: 'bar, baz: null');
4661 }
4662 ''');
4663 } 4665 }
4664 } 4666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698