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

Unified Diff: tests/lib/mirrors/find_in_context_test.dart

Issue 276043003: Lay waste to ClosureMirror.findInContext. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove stub in dart2js Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/lib/mirrors/find_in_context_private_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/find_in_context_test.dart
diff --git a/tests/lib/mirrors/find_in_context_test.dart b/tests/lib/mirrors/find_in_context_test.dart
deleted file mode 100644
index 348cd3a5ed60436b2c8aae37e3806b1b9f92bc2c..0000000000000000000000000000000000000000
--- a/tests/lib/mirrors/find_in_context_test.dart
+++ /dev/null
@@ -1,157 +0,0 @@
-// Copyright (c) 2013, 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.
-
-// VMOptions=--support_find_in_context=true
-
-import "dart:mirrors";
-
-import "stringify.dart";
-
-import "package:expect/expect.dart";
-
-import "closure_mirror_import1.dart";
-import "closure_mirror_import1.dart" as imp1;
-import "closure_mirror_import1.dart" as imp1_hidden
- hide globalVariableInImport, StaticClass;
-import "closure_mirror_import2.dart" as imp2;
-
-var globalVariable = "globalVariable";
-
-globalFoo() => 17;
-
-class S {
- static staticFooInS() => "staticFooInS";
- static var staticInS = "staticInS";
- var instanceInS = "instanceInS";
-}
-
-class C extends S {
- static staticFooInC() => "staticFooInC";
- static var staticInC = "staticInC";
- var instanceInC = "instanceInC";
-
- foo() => null;
-
- bar() {
- var x = 7;
- var instanceInC = 11; // Shadowing the instance field.
- var y = 3; // Not in context.
- baz() {
- if (x) {}
- if (instanceInC) {}
- };
- return reflect(baz);
- }
-
- baz() {
- var instanceInC = null; // Shadowing with a null value.
- return reflect(() => instanceInC);
- }
-}
-
-main() {
- C c = new C();
- ClosureMirror cm = reflect(c.foo);
-
- var result;
-
- result = cm.findInContext(#globalVariable);
- expect("Instance(value = globalVariable)", result);
-
- result = cm.findInContext(#globalFoo);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = 17)", result.apply(const []));
-
- result = cm.findInContext(#S.staticInS);
- expect("Instance(value = staticInS)", result);
-
- result = cm.findInContext(#staticInS);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#staticFooInS);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#S.staticFooInS);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = staticFooInS)", result.apply(const []));
-
- result = cm.findInContext(#C.staticFooInS);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#C.staticInC);
- expect("Instance(value = staticInC)", result);
-
- result = cm.findInContext(#staticInC);
- expect("Instance(value = staticInC)", result);
-
- result = cm.findInContext(#C.staticFooInC);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = staticFooInC)", result.apply(const []));
-
- result = cm.findInContext(#staticFooInC);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = staticFooInC)", result.apply(const []));
-
- result = cm.findInContext(#instanceInC);
- expect("Instance(value = instanceInC)", result);
-
- result = cm.findInContext(#instanceInS);
- expect("Instance(value = instanceInS)", result);
-
- result = cm.findInContext(#globalVariableInImport1);
- expect("Instance(value = globalVariableInImport1)", result);
-
- result = cm.findInContext(#StaticClass.staticField);
- expect("Instance(value = staticField)", result);
-
- result = cm.findInContext(#StaticClass.staticFunctionInStaticClass);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = staticFunctionInStaticClass)",
- result.apply(const []));
-
- result = cm.findInContext(#imp1.StaticClass.staticFunctionInStaticClass);
- Expect.isTrue(result is ClosureMirror);
- expect("Instance(value = staticFunctionInStaticClass)",
- result.apply(const []));
-
- result = cm.findInContext(#imp1.globalVariableInImport1);
- expect("Instance(value = globalVariableInImport1)", result);
-
- result = cm.findInContext(#imp2.globalVariableInImport);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#imp1.StaticClass.staticField);
- expect("Instance(value = staticField)", result);
-
- result = cm.findInContext(#imp1_hidden.StaticClass.staticField);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#firstGlobalVariableInImport2);
- expect("Instance(value = firstGlobalVariableInImport2)", result);
-
- result = cm.findInContext(#secondGlobalVariableInImport2);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = cm.findInContext(#imp2.secondGlobalVariableInImport2);
- expect("Instance(value = secondGlobalVariableInImport2)", result);
-
- result = c.bar().findInContext(#x);
- expect("Instance(value = 7)", result);
-
- result = c.bar().findInContext(#instanceInC);
- expect("Instance(value = 11)", result);
-
- result = c.bar().findInContext(#y);
- Expect.isFalse(result is InstanceMirror);
- Expect.equals(null, result);
-
- result = c.baz().findInContext(#instanceInC);
- expect("Instance(value = <null>)", result);
-}
« no previous file with comments | « tests/lib/mirrors/find_in_context_private_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698