Chromium Code Reviews| Index: pkg/analysis_server/test/services/correction/fix_test.dart |
| diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart |
| index d6bd2db659c3a682a8e929ed8b544a6d3f96e969..070e85199631182962f54ec830af24a73fbff453 100644 |
| --- a/pkg/analysis_server/test/services/correction/fix_test.dart |
| +++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
| @@ -296,6 +296,65 @@ main() { |
| await assertNoFix(DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL); |
| } |
| + void _addMetaPackageSource() { |
|
scheglov
2017/02/14 22:06:07
Please format and sort and files that you change i
pquitslund
2017/02/14 23:41:38
Whoops! I got confused by the "Rearrange Code" ac
|
| + addPackageSource('meta', 'meta.dart', r''' |
| +library meta; |
| + |
| +const Required required = const Required(); |
| + |
| +class Required { |
| + final String reason; |
| + const Required([this.reason]); |
| +} |
| +'''); |
| + } |
| + |
| + test_addMissingRequiredParam_single() async { |
| + _addMetaPackageSource(); |
| + |
| + await resolveTestUnit(''' |
| +import 'package:meta/meta.dart'; |
| + |
| +test({@required int a}) {} |
| +main() { |
| + test(); |
| +} |
| +'''); |
| + await assertHasFix( |
| + DartFixKind.ADD_MISSING_REQUIRED_PARAMETER, |
| + ''' |
| +import 'package:meta/meta.dart'; |
| + |
| +test({@required int a}) {} |
| +main() { |
| + test(a: null); |
| +} |
| +'''); |
| + } |
| + |
| + test_addMissingRequiredParam_multiple() async { |
|
scheglov
2017/02/14 22:06:07
This looks like "_hasOtherArgument" test.
But yes,
pquitslund
2017/02/14 23:41:38
Acknowledged.
|
| + _addMetaPackageSource(); |
| + |
| + await resolveTestUnit(''' |
| +import 'package:meta/meta.dart'; |
| + |
| +test({@required int a, @required int b}) {} |
| +main() { |
| + test(a: 3); |
| +} |
| +'''); |
| + await assertHasFix( |
| + DartFixKind.ADD_MISSING_REQUIRED_PARAMETER, |
| + ''' |
| +import 'package:meta/meta.dart'; |
| + |
| +test({@required int a, @required int b}) {} |
| +main() { |
| + test(a: 3, b: null); |
| +} |
| +'''); |
| + } |
| + |
| test_addMissingParameter_function_positional_hasZero() async { |
| await resolveTestUnit(''' |
| test() {} |