| Index: tests/lib_strong/mirrors/mirrors_nsm_test.dart
|
| diff --git a/tests/lib_strong/mirrors/mirrors_nsm_test.dart b/tests/lib_strong/mirrors/mirrors_nsm_test.dart
|
| index b236e79ae750d67ec25ef514dab95d6db0f3bbfd..1510003cd89ba5762b05c2d0c225d90982351aa0 100644
|
| --- a/tests/lib_strong/mirrors/mirrors_nsm_test.dart
|
| +++ b/tests/lib_strong/mirrors/mirrors_nsm_test.dart
|
| @@ -12,14 +12,16 @@ bool isNSMContainingFieldName(e, String fieldName, bool isSetter) {
|
| if (e is! NoSuchMethodError) return false;
|
| String needle = fieldName;
|
| if (isSetter) needle += "=";
|
| - return "$e".contains(needle) && ! "$e".contains(needle + "=");
|
| + return "$e".contains(needle) && !"$e".contains(needle + "=");
|
| }
|
|
|
| final finalTopLevel = 0;
|
| +
|
| class A {
|
| final finalInstance = 0;
|
| static final finalStatic = 0;
|
| }
|
| +
|
| class B {
|
| B(a, b);
|
| factory B.fac(a, b) => new B(a, b);
|
| @@ -29,46 +31,46 @@ testMessageContents() {
|
| var mirrors = currentMirrorSystem();
|
| var libMirror = mirrors.findLibrary(#MirrorsTest);
|
| Expect.throws(() => libMirror.invoke(#foo, []),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => libMirror.getField(#foo),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => libMirror.setField(#foo, null),
|
| - (e) => isNSMContainingFieldName(e, "foo", true));
|
| + (e) => isNSMContainingFieldName(e, "foo", true));
|
| Expect.throws(() => libMirror.setField(#finalTopLevel, null),
|
| - (e) => isNSMContainingFieldName(e, "finalTopLevel", true));
|
| + (e) => isNSMContainingFieldName(e, "finalTopLevel", true));
|
|
|
| var classMirror = reflectClass(A);
|
| Expect.throws(() => classMirror.invoke(#foo, []),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => classMirror.getField(#foo),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => classMirror.setField(#foo, null),
|
| - (e) => isNSMContainingFieldName(e, "foo", true));
|
| + (e) => isNSMContainingFieldName(e, "foo", true));
|
| Expect.throws(() => classMirror.setField(#finalStatic, null),
|
| - (e) => isNSMContainingFieldName(e, "finalStatic", true));
|
| + (e) => isNSMContainingFieldName(e, "finalStatic", true));
|
|
|
| var instanceMirror = reflect(new A());
|
| Expect.throws(() => instanceMirror.invoke(#foo, []),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => instanceMirror.getField(#foo),
|
| - (e) => isNSMContainingFieldName(e, "foo", false));
|
| + (e) => isNSMContainingFieldName(e, "foo", false));
|
| Expect.throws(() => instanceMirror.setField(#foo, null),
|
| - (e) => isNSMContainingFieldName(e, "foo", true));
|
| + (e) => isNSMContainingFieldName(e, "foo", true));
|
| Expect.throws(() => instanceMirror.setField(#finalInstance, null),
|
| - (e) => isNSMContainingFieldName(e, "finalInstance", true));
|
| + (e) => isNSMContainingFieldName(e, "finalInstance", true));
|
| }
|
|
|
| expectMatchingErrors(reflectiveAction, baseAction) {
|
| var reflectiveError, baseError;
|
| try {
|
| reflectiveAction();
|
| - } catch(e) {
|
| + } catch (e) {
|
| reflectiveError = e;
|
| }
|
|
|
| try {
|
| baseAction();
|
| - } catch(e) {
|
| + } catch (e) {
|
| baseError = e;
|
| }
|
|
|
| @@ -82,39 +84,33 @@ expectMatchingErrors(reflectiveAction, baseAction) {
|
| testMatchingMessages() {
|
| var mirrors = currentMirrorSystem();
|
| var libMirror = mirrors.findLibrary(#MirrorsTest);
|
| - expectMatchingErrors(() => libMirror.invoke(#foo, []),
|
| - () => foo());
|
| - expectMatchingErrors(() => libMirror.getField(#foo),
|
| - () => foo);
|
| - expectMatchingErrors(() => libMirror.setField(#foo, null),
|
| - () => foo= null);
|
| + expectMatchingErrors(() => libMirror.invoke(#foo, []), () => foo());
|
| + expectMatchingErrors(() => libMirror.getField(#foo), () => foo);
|
| + expectMatchingErrors(() => libMirror.setField(#foo, null), () => foo = null);
|
| expectMatchingErrors(() => libMirror.setField(#finalTopLevel, null),
|
| - () => finalTopLevel= null);
|
| + () => finalTopLevel = null);
|
|
|
| var classMirror = reflectClass(A);
|
| - expectMatchingErrors(() => classMirror.invoke(#foo, []),
|
| - () => A.foo());
|
| - expectMatchingErrors(() => classMirror.getField(#foo),
|
| - () => A.foo);
|
| - expectMatchingErrors(() => classMirror.setField(#foo, null),
|
| - () => A.foo= null);
|
| + expectMatchingErrors(() => classMirror.invoke(#foo, []), () => A.foo());
|
| + expectMatchingErrors(() => classMirror.getField(#foo), () => A.foo);
|
| + expectMatchingErrors(
|
| + () => classMirror.setField(#foo, null), () => A.foo = null);
|
| expectMatchingErrors(() => classMirror.setField(#finalStatic, null),
|
| - () => A.finalStatic= null);
|
| + () => A.finalStatic = null);
|
| expectMatchingErrors(() => classMirror.newInstance(#constructor, [1, 2, 3]),
|
| - () => new A.constructor(1, 2, 3));
|
| + () => new A.constructor(1, 2, 3));
|
|
|
| var instanceMirror = reflect(new A());
|
| - expectMatchingErrors(() => instanceMirror.invoke(#foo, []),
|
| - () => new A().foo());
|
| - expectMatchingErrors(() => instanceMirror.getField(#foo),
|
| - () => new A().foo);
|
| - expectMatchingErrors(() => instanceMirror.setField(#foo, null),
|
| - () => new A().foo= null);
|
| + expectMatchingErrors(
|
| + () => instanceMirror.invoke(#foo, []), () => new A().foo());
|
| + expectMatchingErrors(() => instanceMirror.getField(#foo), () => new A().foo);
|
| + expectMatchingErrors(
|
| + () => instanceMirror.setField(#foo, null), () => new A().foo = null);
|
| expectMatchingErrors(() => instanceMirror.setField(#finalInstance, null),
|
| - () => new A().finalInstance= null);
|
| + () => new A().finalInstance = null);
|
| }
|
|
|
| main() {
|
| testMessageContents();
|
| testMatchingMessages(); //# dart2js: ok
|
| -}
|
| +}
|
|
|