Chromium Code Reviews| Index: test/checker/checker_test.dart |
| diff --git a/test/checker/checker_test.dart b/test/checker/checker_test.dart |
| index 182e682cc03431e74821bfdcdd384b7405a1b680..619b3fe4be126b2e0d43e4415d67a1404e84226d 100644 |
| --- a/test/checker/checker_test.dart |
| +++ b/test/checker/checker_test.dart |
| @@ -2669,4 +2669,50 @@ void main() { |
| customUrlMappings: { |
| 'dart:foobar': '$testDirectory/checker/dart_foobar.dart' |
| })); |
| + |
| + group('function modifiers', () { |
| + test('async', () => testChecker({ |
| + '/main.dart': ''' |
| + import 'dart:async'; |
| + |
| + dynamic x; |
| + |
| + foo1() async => x; |
| + Future foo2() async => x; |
| + Future<int> foo3() async => (/*info:DynamicCast*/x); |
| + Future<int> foo4() async => (/*severe:StaticTypeError*/new Future<int>(x)); |
| + |
| + bar1() async { return x; } |
| + Future bar2() async { return x; } |
| + Future<int> bar3() async { return (/*info:DynamicCast*/x); } |
| + Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future<int>(x)); } |
| + ''' |
| + })); |
| + |
| + test('async*', () => testChecker({ |
| + '/main.dart': ''' |
| + import 'dart:async'; |
| + |
| + dynamic x; |
| + |
| + bar1() async* { yield x; } |
| + Stream bar2() async* { yield x; } |
| + Stream<int> bar3() async* { yield (/*info:DynamicCast*/x); } |
| + Stream<int> bar4() async* { yield (/*severe:StaticTypeError*/new Stream<int>()); } |
|
Leaf
2015/06/19 22:15:27
Maybe test yield* as well?
|
| + ''' |
| + })); |
| + |
| + test('sync*', () => testChecker({ |
| + '/main.dart': ''' |
| + import 'dart:async'; |
| + |
| + dynamic x; |
| + |
| + bar1() sync* { yield x; } |
| + Iterable bar2() sync* { yield x; } |
| + Iterable<int> bar3() sync* { yield (/*info:DynamicCast*/x); } |
| + Iterable<int> bar4() sync* { yield (/*severe:StaticTypeError*/new Iterable<int>()); } |
| + ''' |
| + })); |
| + }); |
| } |