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

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

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/src/CallThroughGetterTest.dart ('k') | tests/language/src/CanonicalConstTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/src/CallThroughNullGetterTest.dart
diff --git a/tests/language/src/CallThroughNullGetterTest.dart b/tests/language/src/CallThroughNullGetterTest.dart
deleted file mode 100644
index 8897c852238279f11067c5e2bd50e7cbd45a60cc..0000000000000000000000000000000000000000
--- a/tests/language/src/CallThroughNullGetterTest.dart
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Tests that we can call functions through getters which return null.
-
-final TOP_LEVEL_NULL = null;
-
-var topLevel;
-
-class CallThroughNullGetterTest {
-
- static void testMain() {
- testTopLevel();
- testField();
- testGetter();
- testMethod();
- }
-
- static void testTopLevel() {
- topLevel = null;
- expectThrowsObjectNotClosureException(() { topLevel(); });
- expectThrowsObjectNotClosureException(() { (topLevel)(); });
- expectThrowsObjectNotClosureException(() { TOP_LEVEL_NULL(); });
- expectThrowsObjectNotClosureException(() { (TOP_LEVEL_NULL)(); });
- }
-
- static void testField() {
- A a = new A();
-
- a.field = null;
- expectThrowsObjectNotClosureException(() { a.field(); });
- expectThrowsObjectNotClosureException(() { (a.field)(); });
- }
-
- static void testGetter() {
- A a = new A();
-
- a.field = null;
- expectThrowsObjectNotClosureException(() { a.getter(); });
- expectThrowsObjectNotClosureException(() { (a.getter)(); });
- }
-
- static void testMethod() {
- A a = new A();
-
- a.field = null;
- expectThrowsObjectNotClosureException(() { a.method()(); });
- }
-
- static void expectThrowsNullPointerException(fn) {
- var exception = catchException(fn);
- if (!(exception is NullPointerException)) {
- Expect.fail("Wrong exception. Expected: NullPointerException"
- + " got: ${exception}");
- }
- }
-
- 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;
- try {
- fn();
- Expect.equals(true, false); // Shouldn't reach this.
- } catch (var e) {
- caught = true;
- result = e;
- }
- Expect.equals(true, caught);
- return result;
- }
-
-}
-
-
-class A {
-
- A() { }
- var field;
- get getter() { return field; }
- method() { return field; }
-
-}
-
-main() {
- CallThroughNullGetterTest.testMain();
-}
« no previous file with comments | « tests/language/src/CallThroughGetterTest.dart ('k') | tests/language/src/CanonicalConstTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698