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

Side by Side Diff: tests/corelib_strong/error_stack_trace_test.dart

Issue 2987793002: Migrate test block 7 to Dart 2.0. (Closed)
Patch Set: Final review comment, dropping static multitest 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
« no previous file with comments | « tests/corelib_strong/error_stack_trace2_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 import "package:expect/expect.dart";
6
7 void argument() {
8 throw new ArgumentError(499);
9 }
10
11 void noSuchMethod() {
12 (499).doesNotExist();
13 }
14
15 void nullThrown() {
16 throw null;
17 }
18
19 void range() {
20 throw new RangeError.range(0, 1, 2);
21 }
22
23 void fallThrough() {
24 nested() {}
25
26 switch (5) {
27 case 5:
28 nested();
29 default:
30 Expect.fail("Should not reach");
31 }
32 }
33
34 abstract class A {
35 foo();
36 }
37
38 void abstractClassInstantiation() {
39 new A();
40 }
41
42 void unsupported() {
43 throw new UnsupportedError("unsupported");
44 }
45
46 void unimplemented() {
47 throw new UnimplementedError("unimplemented");
48 }
49
50 void state() {
51 return [1, 2].single;
52 }
53
54 void type() {
55 return 1 + "string";
56 }
57
58 main() {
59 List<Function> errorFunctions = [
60 argument,
61 noSuchMethod,
62 nullThrown,
63 range,
64 fallThrough,
65 abstractClassInstantiation,
66 unsupported,
67 unimplemented,
68 state,
69 type
70 ];
71
72 for (var f in errorFunctions) {
73 bool hasThrown = false;
74 try {
75 f();
76 } catch (e) {
77 hasThrown = true;
78 Expect.isTrue(
79 e.stackTrace is StackTrace, "$e doesn't have a non-null stack trace");
80 }
81 Expect.isTrue(hasThrown);
82 }
83 }
OLDNEW
« no previous file with comments | « tests/corelib_strong/error_stack_trace2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698