Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// General type checking tests | 5 /// General type checking tests |
| 6 library dev_compiler.test.checker_test; | 6 library dev_compiler.test.checker_test; |
| 7 | 7 |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 | 9 |
| 10 import 'package:dev_compiler/src/testing.dart'; | 10 import 'package:dev_compiler/src/testing.dart'; |
| (...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2662 test('custom URL mappings', () => testChecker({ | 2662 test('custom URL mappings', () => testChecker({ |
| 2663 '/main.dart': ''' | 2663 '/main.dart': ''' |
| 2664 import 'dart:foobar' show Baz; | 2664 import 'dart:foobar' show Baz; |
| 2665 main() { | 2665 main() { |
| 2666 print(Baz.quux); | 2666 print(Baz.quux); |
| 2667 }''' | 2667 }''' |
| 2668 }, | 2668 }, |
| 2669 customUrlMappings: { | 2669 customUrlMappings: { |
| 2670 'dart:foobar': '$testDirectory/checker/dart_foobar.dart' | 2670 'dart:foobar': '$testDirectory/checker/dart_foobar.dart' |
| 2671 })); | 2671 })); |
| 2672 | |
| 2673 group('function modifiers', () { | |
| 2674 test('async', () => testChecker({ | |
| 2675 '/main.dart': ''' | |
| 2676 import 'dart:async'; | |
| 2677 | |
| 2678 dynamic x; | |
| 2679 | |
| 2680 foo1() async => x; | |
| 2681 Future foo2() async => x; | |
| 2682 Future<int> foo3() async => (/*info:DynamicCast*/x); | |
| 2683 Future<int> foo4() async => (/*severe:StaticTypeError*/new Future<int>(x )); | |
| 2684 | |
| 2685 bar1() async { return x; } | |
| 2686 Future bar2() async { return x; } | |
| 2687 Future<int> bar3() async { return (/*info:DynamicCast*/x); } | |
| 2688 Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future< int>(x)); } | |
| 2689 ''' | |
| 2690 })); | |
| 2691 | |
| 2692 test('async*', () => testChecker({ | |
| 2693 '/main.dart': ''' | |
| 2694 import 'dart:async'; | |
| 2695 | |
| 2696 dynamic x; | |
| 2697 | |
| 2698 bar1() async* { yield x; } | |
| 2699 Stream bar2() async* { yield x; } | |
| 2700 Stream<int> bar3() async* { yield (/*info:DynamicCast*/x); } | |
| 2701 Stream<int> bar4() async* { yield (/*severe:StaticTypeError*/new Stream< int>()); } | |
|
Leaf
2015/06/19 22:15:27
Maybe test yield* as well?
| |
| 2702 ''' | |
| 2703 })); | |
| 2704 | |
| 2705 test('sync*', () => testChecker({ | |
| 2706 '/main.dart': ''' | |
| 2707 import 'dart:async'; | |
| 2708 | |
| 2709 dynamic x; | |
| 2710 | |
| 2711 bar1() sync* { yield x; } | |
| 2712 Iterable bar2() sync* { yield x; } | |
| 2713 Iterable<int> bar3() sync* { yield (/*info:DynamicCast*/x); } | |
| 2714 Iterable<int> bar4() sync* { yield (/*severe:StaticTypeError*/new Iterab le<int>()); } | |
| 2715 ''' | |
| 2716 })); | |
| 2717 }); | |
| 2672 } | 2718 } |
| OLD | NEW |