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

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

Issue 10383238: Fix tests in language suite: eliminate String + (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/date.dart ('k') | tests/language/const_string_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 4
5 // Tests that we can call functions through getters which return null. 5 // Tests that we can call functions through getters which return null.
6 6
7 final TOP_LEVEL_NULL = null; 7 final TOP_LEVEL_NULL = null;
8 8
9 var topLevel; 9 var topLevel;
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 A a = new A(); 45 A a = new A();
46 46
47 a.field = null; 47 a.field = null;
48 expectThrowsObjectNotClosureException(() { a.method()(); }); 48 expectThrowsObjectNotClosureException(() { a.method()(); });
49 } 49 }
50 50
51 static void expectThrowsNullPointerException(fn) { 51 static void expectThrowsNullPointerException(fn) {
52 var exception = catchException(fn); 52 var exception = catchException(fn);
53 if (!(exception is NullPointerException)) { 53 if (!(exception is NullPointerException)) {
54 Expect.fail("Wrong exception. Expected: NullPointerException" 54 Expect.fail("Wrong exception. Expected: NullPointerException"
55 + " got: ${exception}"); 55 " got: ${exception}");
56 } 56 }
57 } 57 }
58 58
59 static void expectThrowsObjectNotClosureException(fn) { 59 static void expectThrowsObjectNotClosureException(fn) {
60 var exception = catchException(fn); 60 var exception = catchException(fn);
61 if (!(exception is ObjectNotClosureException)) { 61 if (!(exception is ObjectNotClosureException)) {
62 Expect.fail("Wrong exception. Expected: ObjectNotClosureException" 62 Expect.fail("Wrong exception. Expected: ObjectNotClosureException"
63 + " got: ${exception}"); 63 " got: ${exception}");
64 } 64 }
65 } 65 }
66 66
67 static catchException(fn) { 67 static catchException(fn) {
68 bool caught = false; 68 bool caught = false;
69 var result = null; 69 var result = null;
70 try { 70 try {
71 fn(); 71 fn();
72 Expect.equals(true, false); // Shouldn't reach this. 72 Expect.equals(true, false); // Shouldn't reach this.
73 } catch (var e) { 73 } catch (var e) {
(...skipping 12 matching lines...) Expand all
86 A() { } 86 A() { }
87 var field; 87 var field;
88 get getter() { return field; } 88 get getter() { return field; }
89 method() { return field; } 89 method() { return field; }
90 90
91 } 91 }
92 92
93 main() { 93 main() {
94 CallThroughNullGetterTest.testMain(); 94 CallThroughNullGetterTest.testMain();
95 } 95 }
OLDNEW
« no previous file with comments | « runtime/lib/date.dart ('k') | tests/language/const_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698