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

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

Issue 18529003: Add stackTrace to Error object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments and add bug numbers to status files. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « tests/corelib/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, noSuchMethod, nullThrown, range, fallThrough,
61 abstractClassInstantiation, unsupported, unimplemented, state,
62 type ];
63
64 for (var f in errorFunctions) {
65 bool hasThrown = false;
66 try {
67 f();
68 } catch(e) {
69 hasThrown = true;
70 Expect.isTrue(e.stackTrace is StackTrace,
71 "$e doesn't have a non-null stack trace");
72 }
73 Expect.isTrue(hasThrown);
74 }
75 }
OLDNEW
« no previous file with comments | « tests/corelib/error_stack_trace2_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698