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

Side by Side Diff: test/codegen/expect/language/stack_trace_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
OLDNEW
(Empty)
1 dart_library.library('language/stack_trace_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__stack_trace_test(exports, dart_sdk, expect) {
5 'use strict';
6 const core = dart_sdk.core;
7 const dart = dart_sdk.dart;
8 const dartx = dart_sdk.dartx;
9 const expect$ = expect.expect;
10 const stack_trace_test = Object.create(null);
11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT ype(dart.dynamic, [])))();
12 stack_trace_test.MyException = class MyException extends core.Object {
13 new(message) {
14 this.message_ = message;
15 }
16 };
17 dart.setSignature(stack_trace_test.MyException, {
18 constructors: () => ({new: dart.definiteFunctionType(stack_trace_test.MyExce ption, [core.String])})
19 });
20 stack_trace_test.Helper = class Helper extends core.Object {
21 static f1(i) {
22 try {
23 i = stack_trace_test.Helper.func();
24 i = 10;
25 } catch (exception) {
26 if (stack_trace_test.MyException.is(exception)) {
27 let stacktrace = dart.stackTrace(exception);
28 i = 50;
29 core.print(exception.message_);
30 expect$.Expect.isNotNull(stacktrace);
31 core.print(stacktrace);
32 } else
33 throw exception;
34 }
35
36 try {
37 let j = null;
38 i = stack_trace_test.Helper.func1();
39 i = 200;
40 } catch (exception) {
41 if (stack_trace_test.MyException.is(exception)) {
42 let stacktrace = dart.stackTrace(exception);
43 i = 50;
44 core.print(exception.message_);
45 expect$.Expect.isNotNull(stacktrace);
46 core.print(stacktrace);
47 } else
48 throw exception;
49 }
50
51 try {
52 let j = null;
53 i = stack_trace_test.Helper.func2();
54 i = 200;
55 } catch (exception) {
56 if (stack_trace_test.MyException.is(exception)) {
57 let stacktrace = dart.stackTrace(exception);
58 i = 50;
59 core.print(exception.message_);
60 expect$.Expect.isNotNull(stacktrace);
61 core.print(stacktrace);
62 } else
63 throw exception;
64 }
65 finally {
66 i = dart.notNull(i) + 800;
67 }
68 return i;
69 }
70 static func() {
71 let i = 0;
72 while (i < 10) {
73 i++;
74 }
75 if (i > 0) {
76 dart.throw(new stack_trace_test.MyException("Exception Test for stack tr ace being printed"));
77 }
78 return 10;
79 }
80 static func1() {
81 try {
82 stack_trace_test.Helper.func();
83 } catch (exception) {
84 if (stack_trace_test.MyException.is(exception)) {
85 dart.throw(new stack_trace_test.MyException("Exception Test for stack trace being printed"));
86 ;
87 } else
88 throw exception;
89 }
90
91 return 10;
92 }
93 static func2() {
94 try {
95 stack_trace_test.Helper.func();
96 } catch (exception) {
97 if (stack_trace_test.MyException.is(exception)) {
98 throw exception;
99 } else
100 throw exception;
101 }
102
103 return 10;
104 }
105 };
106 dart.setSignature(stack_trace_test.Helper, {
107 statics: () => ({
108 f1: dart.definiteFunctionType(core.int, [core.int]),
109 func: dart.definiteFunctionType(core.int, []),
110 func1: dart.definiteFunctionType(core.int, []),
111 func2: dart.definiteFunctionType(core.int, [])
112 }),
113 names: ['f1', 'func', 'func1', 'func2']
114 });
115 stack_trace_test.StackTraceTest = class StackTraceTest extends core.Object {
116 static testMain() {
117 expect$.Expect.equals(850, stack_trace_test.Helper.f1(1));
118 }
119 };
120 dart.setSignature(stack_trace_test.StackTraceTest, {
121 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}),
122 names: ['testMain']
123 });
124 stack_trace_test.RethrowStacktraceTest = class RethrowStacktraceTest extends c ore.Object {
125 new() {
126 this.config = 0;
127 }
128 issue12940() {
129 dart.throw("Progy");
130 }
131 b() {
132 this.issue12940();
133 }
134 c() {
135 if (this.config == 0) {
136 try {
137 this.b();
138 } catch (e) {
139 throw e;
140 }
141
142 } else {
143 try {
144 this.b();
145 } catch (e) {
146 let s = dart.stackTrace(e);
147 throw e;
148 }
149
150 }
151 }
152 d() {
153 this.c();
154 }
155 testBoth() {
156 for (this.config = 0; dart.notNull(this.config) < 2; this.config = dart.no tNull(this.config) + 1) {
157 try {
158 this.d();
159 } catch (e) {
160 let s = dart.stackTrace(e);
161 expect$.Expect.isTrue(s.toString()[dartx.contains]("issue12940"));
162 }
163
164 }
165 }
166 static testMain() {
167 let test = new stack_trace_test.RethrowStacktraceTest();
168 test.testBoth();
169 }
170 };
171 dart.setSignature(stack_trace_test.RethrowStacktraceTest, {
172 methods: () => ({
173 issue12940: dart.definiteFunctionType(dart.dynamic, []),
174 b: dart.definiteFunctionType(dart.dynamic, []),
175 c: dart.definiteFunctionType(dart.dynamic, []),
176 d: dart.definiteFunctionType(dart.dynamic, []),
177 testBoth: dart.definiteFunctionType(dart.dynamic, [])
178 }),
179 statics: () => ({testMain: dart.definiteFunctionType(dart.dynamic, [])}),
180 names: ['testMain']
181 });
182 stack_trace_test.main = function() {
183 stack_trace_test.StackTraceTest.testMain();
184 stack_trace_test.RethrowStacktraceTest.testMain();
185 };
186 dart.fn(stack_trace_test.main, VoidTodynamic());
187 // Exports:
188 exports.stack_trace_test = stack_trace_test;
189 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698