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

Side by Side Diff: test/chain/chain_test.dart

Issue 1871763002: Fix the remaining strong mode warnings. (Closed) Base URL: https://github.com/dart-lang/stack_trace.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « pubspec.yaml ('k') | test/chain/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:path/path.dart' as p; 7 import 'package:path/path.dart' as p;
8 import 'package:stack_trace/stack_trace.dart'; 8 import 'package:stack_trace/stack_trace.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 10
11 import 'utils.dart'; 11 import 'utils.dart';
12 12
13 typedef void ChainErrorCallback(stack, Chain chain);
14
13 void main() { 15 void main() {
14 group('Chain.parse()', () { 16 group('Chain.parse()', () {
15 test('parses a real Chain', () { 17 test('parses a real Chain', () {
16 return captureFuture(() => inMicrotask(() => throw 'error')) 18 return captureFuture(() => inMicrotask(() => throw 'error'))
17 .then((chain) { 19 .then((chain) {
18 expect(new Chain.parse(chain.toString()).toString(), 20 expect(new Chain.parse(chain.toString()).toString(),
19 equals(chain.toString())); 21 equals(chain.toString()));
20 }); 22 });
21 }); 23 });
22 24
(...skipping 18 matching lines...) Expand all
41 expect(Chain.capture(() => new Future.error("oh no"), when: false), 43 expect(Chain.capture(() => new Future.error("oh no"), when: false),
42 throwsA("oh no")); 44 throwsA("oh no"));
43 }); 45 });
44 46
45 test("with onError blocks errors", () { 47 test("with onError blocks errors", () {
46 Chain.capture(() { 48 Chain.capture(() {
47 return new Future.error("oh no"); 49 return new Future.error("oh no");
48 }, onError: expectAsync((error, chain) { 50 }, onError: expectAsync((error, chain) {
49 expect(error, equals("oh no")); 51 expect(error, equals("oh no"));
50 expect(chain, new isInstanceOf<Chain>()); 52 expect(chain, new isInstanceOf<Chain>());
51 }), when: false); 53 }) as ChainErrorCallback, when: false);
54 // TODO(rnystrom): Remove this cast if expectAsync() gets a better type.
nweiz 2016/04/08 00:24:03 I generally haven't been making tests strong mode
52 }); 55 });
53 }); 56 });
54 57
55 test("toString() ensures that all traces are aligned", () { 58 test("toString() ensures that all traces are aligned", () {
56 var chain = new Chain([ 59 var chain = new Chain([
57 new Trace.parse('short 10:11 Foo.bar\n'), 60 new Trace.parse('short 10:11 Foo.bar\n'),
58 new Trace.parse('loooooooooooong 10:11 Zop.zoop') 61 new Trace.parse('loooooooooooong 10:11 Zop.zoop')
59 ]); 62 ]);
60 63
61 expect(chain.toString(), equals( 64 expect(chain.toString(), equals(
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 controller = new StreamController()..addError('error', trace); 306 controller = new StreamController()..addError('error', trace);
304 expect(Chain.track(controller.stream).toList() 307 expect(Chain.track(controller.stream).toList()
305 .catchError((e, stackTrace) { 308 .catchError((e, stackTrace) {
306 expect(e, equals('error')); 309 expect(e, equals('error'));
307 expect(stackTrace.toString(), equals(trace.toString())); 310 expect(stackTrace.toString(), equals(trace.toString()));
308 }), completes); 311 }), completes);
309 }); 312 });
310 }); 313 });
311 }); 314 });
312 } 315 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/chain/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698