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

Side by Side Diff: tests/language_strong/async_test.dart

Issue 2989993002: fix unsound cast failures in tests (Closed)
Patch Set: fix Created 3 years, 4 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 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 topLevelFunction() async {} 9 topLevelFunction() async {}
10 10
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 class B { 40 class B {
41 final _y; 41 final _y;
42 const B._internal(this._y); 42 const B._internal(this._y);
43 43
44 B() : _y = null; 44 B() : _y = null;
45 } 45 }
46 46
47 main() { 47 main() {
48 var asyncReturn; 48 Future asyncReturn;
49 49
50 asyncReturn = topLevelFunction(); 50 asyncReturn = topLevelFunction();
51 Expect.isTrue(asyncReturn is Future); 51 Expect.isTrue(asyncReturn is Future);
52 52
53 asyncReturn = topLevelWithParameter(4); 53 asyncReturn = topLevelWithParameter(4);
54 Expect.isTrue(asyncReturn is Future); 54 Expect.isTrue(asyncReturn is Future);
55 asyncReturn.then((int result) => Expect.equals(result, 11)); 55 asyncReturn.then((int result) => Expect.equals(result, 11));
56 56
57 asyncReturn = topLevelGetter; 57 asyncReturn = topLevelGetter;
58 Expect.isTrue(asyncReturn is Future); 58 Expect.isTrue(asyncReturn is Future);
(...skipping 28 matching lines...) Expand all
87 var moreNesting = (int shadowP1, String p2, num p3) { 87 var moreNesting = (int shadowP1, String p2, num p3) {
88 var z = 3; 88 var z = 3;
89 aa(int shadowP1) async { 89 aa(int shadowP1) async {
90 return foo + z + p3 + shadowP1; 90 return foo + z + p3 + shadowP1;
91 } 91 }
92 92
93 return aa(6); 93 return aa(6);
94 }; 94 };
95 asyncReturn = moreNesting(1, "ignore", 2); 95 asyncReturn = moreNesting(1, "ignore", 2);
96 Expect.isTrue(asyncReturn is Future); 96 Expect.isTrue(asyncReturn is Future);
97 asyncReturn.then((int result) => Expect.equals(result, 28)); 97 asyncReturn.then((num result) => Expect.equals(result, 28));
98 98
99 var checkAsync = (var someFunc) { 99 var checkAsync = (var someFunc) {
100 var toTest = someFunc(); 100 var toTest = someFunc();
101 Expect.isTrue(toTest is Future); 101 Expect.isTrue(toTest is Future);
102 toTest.then((int result) => Expect.equals(result, 4)); 102 toTest.then((int result) => Expect.equals(result, 4));
103 }; 103 };
104 checkAsync(() async => 4); 104 checkAsync(() async => 4);
105 } 105 }
OLDNEW
« no previous file with comments | « tests/corelib_strong/sort_helper.dart ('k') | tests/language_strong/many_named_arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698