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

Side by Side Diff: tests/language/rethrow_test.dart

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 1 month 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/language/reg_exp2_test.dart ('k') | tests/language/scope_variable_test.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 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Dart test program for testing throw statement 4 // Dart test program for testing throw statement
5 5
6 class MyException { 6 class MyException {
7 const MyException(); 7 const MyException();
8 } 8 }
9 9
10 class OtherException { 10 class OtherException {
11 const OtherException(); 11 const OtherException();
12 } 12 }
13 13
14 class RethrowTest { 14 class RethrowTest {
15 MyException currentException; 15 MyException currentException;
16 16
17 void throwException() { 17 void throwException() {
18 currentException = new MyException(); 18 currentException = new MyException();
19 throw currentException; 19 throw currentException;
20 } 20 }
21 21
22 void testRethrowPastUncaught() { 22 void testRethrowPastUncaught() {
23 try { 23 try {
24 try { 24 try {
25 try { 25 try {
26 throwException(); 26 throwException();
27 Expect.fail("Should have thrown an exception"); 27 Expect.fail("Should have thrown an exception");
28 } catch (e) { 28 } catch (e) {
29 Expect.equals(true, e === currentException); 29 Expect.equals(true, identical(e, currentException));
30 throw; 30 throw;
31 Expect.fail("Should have thrown an exception"); 31 Expect.fail("Should have thrown an exception");
32 } 32 }
33 } on OtherException catch (e) { 33 } on OtherException catch (e) {
34 Expect.fail("Should not have caught OtherException"); 34 Expect.fail("Should not have caught OtherException");
35 } 35 }
36 } catch (e) { 36 } catch (e) {
37 Expect.equals(true, e === currentException); 37 Expect.equals(true, identical(e, currentException));
38 } 38 }
39 } 39 }
40 40
41 void testRethrow() { 41 void testRethrow() {
42 try { 42 try {
43 try { 43 try {
44 throwException(); 44 throwException();
45 Expect.fail("Should have thrown an exception"); 45 Expect.fail("Should have thrown an exception");
46 } catch (e) { 46 } catch (e) {
47 Expect.equals(true, e === currentException); 47 Expect.equals(true, identical(e, currentException));
48 throw; 48 throw;
49 Expect.fail("Should have thrown an exception"); 49 Expect.fail("Should have thrown an exception");
50 } 50 }
51 } catch (e) { 51 } catch (e) {
52 Expect.equals(true, e === currentException); 52 Expect.equals(true, identical(e, currentException));
53 } 53 }
54 } 54 }
55 } 55 }
56 56
57 main() { 57 main() {
58 RethrowTest t = new RethrowTest(); 58 RethrowTest t = new RethrowTest();
59 t.testRethrow(); 59 t.testRethrow();
60 t.testRethrowPastUncaught(); 60 t.testRethrowPastUncaught();
61 } 61 }
OLDNEW
« no previous file with comments | « tests/language/reg_exp2_test.dart ('k') | tests/language/scope_variable_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698