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

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

Issue 1877813003: Use exact name lookup for static fields in mirrors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/lib/mirrors/private_class_field_other.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/private_class_field_test.dart
diff --git a/tests/lib/mirrors/private_class_field_test.dart b/tests/lib/mirrors/private_class_field_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cedf9032c5a9ffe2d4a0f4f8a74835eaa00e8667
--- /dev/null
+++ b/tests/lib/mirrors/private_class_field_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, 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.
+
+// Test a private field name doesn't match the equivalent private name from
+// another library.
+
+import 'dart:mirrors';
+import 'package:expect/expect.dart';
+
+import 'private_class_field_other.dart';
+
+void main() {
+ var classMirror = reflectClass(C);
+ // The symbol is private w/r/t the wrong library.
+ Expect.throws(() => classMirror.getField(#_privateField),
+ (e) => e is NoSuchMethodError);
+
+ Expect.equals(42, classMirror.getField(privateFieldSymbolInOther).reflectee);
+}
« no previous file with comments | « tests/lib/mirrors/private_class_field_other.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698