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

Side by Side Diff: utils/tests/string_encoding/dunit.dart

Issue 10887023: Use new try-catch syntax in runtime/, tools/, and utils/. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « utils/tests/pub/test_pub.dart ('k') | utils/tests/template/real_app.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 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #library("dunit"); 6 #library("dunit");
7 7
8 typedef void Test(); 8 typedef void Test();
9 typedef TestResult SynchTest(); 9 typedef TestResult SynchTest();
10 typedef Future<TestResult> AsynchTest(); 10 typedef Future<TestResult> AsynchTest();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 class TestClass { 98 class TestClass {
99 void register(String description, Function test, TestSuite suite) { 99 void register(String description, Function test, TestSuite suite) {
100 suite._registerTest(TestResult _() { 100 suite._registerTest(TestResult _() {
101 setUp(); 101 setUp();
102 try { 102 try {
103 test(); 103 test();
104 tearDown(); 104 tearDown();
105 return new PassedTest(description); 105 return new PassedTest(description);
106 } catch (ExpectException x) { 106 } on ExpectException catch (x) {
107 tearDown(); 107 tearDown();
108 return new FailedTest(description, x); 108 return new FailedTest(description, x);
109 } catch (var x, var stacktrace) { 109 } catch (x, stacktrace) {
110 tearDown(); 110 tearDown();
111 return new TestError(description, x, stacktrace); 111 return new TestError(description, x, stacktrace);
112 } 112 }
113 }); 113 });
114 } 114 }
115 115
116 abstract void registerTests(TestSuite suite); 116 abstract void registerTests(TestSuite suite);
117 void setUp() {} 117 void setUp() {}
118 void tearDown() {} 118 void tearDown() {}
119 } 119 }
OLDNEW
« no previous file with comments | « utils/tests/pub/test_pub.dart ('k') | utils/tests/template/real_app.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698