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); |
+} |