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

Unified Diff: tests/language/src/CallThroughNullGetterTest.dart

Issue 8528050: Fix throwing ObjectNotClosure instead of null exception if closure is null. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/CallThroughNullGetterTest.dart
===================================================================
--- tests/language/src/CallThroughNullGetterTest.dart (revision 1537)
+++ tests/language/src/CallThroughNullGetterTest.dart (working copy)
@@ -19,33 +19,33 @@
static void testTopLevel() {
topLevel = null;
- expectThrowsNullPointerException(() { topLevel(); });
- expectThrowsNullPointerException(() { (topLevel)(); });
- expectThrowsNullPointerException(() { TOP_LEVEL_NULL(); });
- expectThrowsNullPointerException(() { (TOP_LEVEL_NULL)(); });
+ expectThrowsObjectNotClosureException(() { topLevel(); });
+ expectThrowsObjectNotClosureException(() { (topLevel)(); });
+ expectThrowsObjectNotClosureException(() { TOP_LEVEL_NULL(); });
+ expectThrowsObjectNotClosureException(() { (TOP_LEVEL_NULL)(); });
}
static void testField() {
A a = new A();
a.field = null;
- expectThrowsNullPointerException(() { a.field(); });
- expectThrowsNullPointerException(() { (a.field)(); });
+ expectThrowsObjectNotClosureException(() { a.field(); });
+ expectThrowsObjectNotClosureException(() { (a.field)(); });
}
static void testGetter() {
A a = new A();
a.field = null;
- expectThrowsNullPointerException(() { a.getter(); });
- expectThrowsNullPointerException(() { (a.getter)(); });
+ expectThrowsObjectNotClosureException(() { a.getter(); });
+ expectThrowsObjectNotClosureException(() { (a.getter)(); });
}
static void testMethod() {
A a = new A();
a.field = null;
- expectThrowsNullPointerException(() { a.method()(); });
+ expectThrowsObjectNotClosureException(() { a.method()(); });
}
static void expectThrowsNullPointerException(fn) {
@@ -56,6 +56,14 @@
}
}
+ static void expectThrowsObjectNotClosureException(fn) {
+ var exception = catchException(fn);
+ if (!(exception is ObjectNotClosureException)) {
+ Expect.fail("Wrong exception. Expected: ObjectNotClosureException"
+ + " got: ${exception}");
+ }
+ }
+
static catchException(fn) {
bool caught = false;
var result = null;
« no previous file with comments | « tests/language/language.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698