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

Side by Side Diff: test/codegen/corelib/stacktrace_fromstring_test.dart

Issue 1945153002: Add corelib tests (Closed) Base URL: https://github.com/dart-lang/dev_compiler@master
Patch Set: error_test and range_error_test now pass Created 4 years, 7 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 // 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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "package:expect/expect.dart";
6 import "package:async_helper/async_helper.dart";
7 import "dart:async";
8
9 void main() {
10 StackTrace stack;
11 try { throw 0; } catch (e, s) { stack = s; }
12 var string = "$stack";
13 StackTrace stringTrace = new StackTrace.fromString(string);
14 Expect.isTrue(stringTrace is StackTrace);
15 Expect.equals(stack.toString(), stringTrace.toString());
16
17 string = "some random string, nothing like a StackTrace";
18 stringTrace = new StackTrace.fromString(string);
19 Expect.isTrue(stringTrace is StackTrace);
20 Expect.equals(string, stringTrace.toString());
21
22 // Use stacktrace asynchronously.
23 asyncStart();
24 var c = new Completer();
25 c.completeError(0, stringTrace);
26 c.future.then((v) {
27 throw "Unexpected value: $v";
28 }, onError: (e, s) {
29 Expect.equals(string, s.toString());
30 }).then((_) {
31 var c = new StreamController();
32 c.stream.listen((v) {
33 throw "Unexpected value: $v";
34 }, onError: (e, s) {
35 Expect.equals(string, s.toString());
36 asyncEnd();
37 });
38 c.addError(0, stringTrace);
39 c.close();
40 });
41 }
OLDNEW
« no previous file with comments | « test/codegen/corelib/stacktrace_current_test.dart ('k') | test/codegen/corelib/stopwatch2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698