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

Side by Side Diff: runtime/vm/exceptions_test.cc

Issue 10917006: More uses of the new try-catch syntax. (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 | « pkg/unittest/vm_config.dart ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "vm/dart_api_impl.h" 7 #include "vm/dart_api_impl.h"
8 #include "vm/unit_test.h" 8 #include "vm/unit_test.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 " static int method1(int param) {\n" 107 " static int method1(int param) {\n"
108 " UnhandledExceptions.invoke();\n" 108 " UnhandledExceptions.invoke();\n"
109 " return 2;\n" 109 " return 2;\n"
110 " }\n" 110 " }\n"
111 " static int method2() {\n" 111 " static int method2() {\n"
112 " throw new Second();\n" 112 " throw new Second();\n"
113 " }\n" 113 " }\n"
114 " static int method3(int param) {\n" 114 " static int method3(int param) {\n"
115 " try {\n" 115 " try {\n"
116 " UnhandledExceptions.invoke2();\n" 116 " UnhandledExceptions.invoke2();\n"
117 " } catch (Second e) {\n" 117 " } on Second catch (e) {\n"
118 " return 3;\n" 118 " return 3;\n"
119 " }\n" 119 " }\n"
120 " return 2;\n" 120 " return 2;\n"
121 " }\n" 121 " }\n"
122 "}\n" 122 "}\n"
123 "testMain() {\n" 123 "testMain() {\n"
124 " UnhandledExceptions.equals(2, Second.method1(1));\n" 124 " UnhandledExceptions.equals(2, Second.method1(1));\n"
125 " UnhandledExceptions.equals(3, Second.method3(1));\n" 125 " UnhandledExceptions.equals(3, Second.method3(1));\n"
126 "}"; 126 "}";
127 Dart_Handle lib = TestCase::LoadTestScript( 127 Dart_Handle lib = TestCase::LoadTestScript(
128 kScriptChars, 128 kScriptChars,
129 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup)); 129 reinterpret_cast<Dart_NativeEntryResolver>(native_lookup));
130 EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL)); 130 EXPECT_VALID(Dart_Invoke(lib, Dart_NewString("testMain"), 0, NULL));
131 } 131 }
132 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 132 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
133 133
134 } // namespace dart 134 } // namespace dart
OLDNEW
« no previous file with comments | « pkg/unittest/vm_config.dart ('k') | runtime/vm/isolate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698