| Index: tests/lib/mirrors/invoke_named_test.dart
|
| diff --git a/tests/lib/mirrors/invoke_named_test.dart b/tests/lib/mirrors/invoke_named_test.dart
|
| index da0b54b2c2c5b69f8be767e7190eef2f30205bea..6acdbeeb2243ab15f115076d4db776a38aa3369f 100644
|
| --- a/tests/lib/mirrors/invoke_named_test.dart
|
| +++ b/tests/lib/mirrors/invoke_named_test.dart
|
| @@ -121,99 +121,6 @@ testSyncInvoke(ObjectMirror om) {
|
| 'Unmatched named argument');
|
| }
|
|
|
| -testAsyncInvoke(ObjectMirror om) {
|
| - Future<InstanceMirror> future;
|
| -
|
| - future = om.invokeAsync(const Symbol('a'), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-null', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-null', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('a'), []);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = om.invokeAsync(const Symbol('a'), ['X', 'Y']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = om.invokeAsync(const Symbol('a'), ['X'], {const Symbol('undef') : 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = om.invokeAsync(const Symbol('b'), []);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('A-null-null', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('b'), [], {const Symbol('a') : 'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-null', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('b'), ['X']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = om.invokeAsync(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| - future = om.invokeAsync(const Symbol('c'), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-C', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('c'), ['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('c'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('c'), []);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = om.invokeAsync(const Symbol('c'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = om.invokeAsync(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = om.invokeAsync(const Symbol('d'), []);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('null-B-C', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('d'), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-C', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('d'), ['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('d'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('d'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = om.invokeAsync(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| - future = om.invokeAsync(const Symbol('e'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = om.invokeAsync(const Symbol('e'), ['X']);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = om.invokeAsync(const Symbol('e'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = om.invokeAsync(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -}
|
| -
|
| testSyncNewInstance() {
|
| ClassMirror cm = reflectClass(E);
|
| InstanceMirror result;
|
| @@ -291,102 +198,6 @@ testSyncNewInstance() {
|
| 'Unmatched named argument');
|
| }
|
|
|
| -testAsyncNewInstance() {
|
| - ClassMirror cm = reflectClass(E);
|
| - Future<InstanceMirror> future;
|
| -
|
| - future = cm.newInstanceAsync(const Symbol(''), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-null', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-null', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol(''), []);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol(''), ['X', 'Y']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol(''), ['X'], {const Symbol('undef') : 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = cm.newInstanceAsync(const Symbol('b'), []);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('A-null-null', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('b'), [], {const Symbol('a') : 'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-null', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('b'), [], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('b'), ['X']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('b'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = cm.newInstanceAsync(const Symbol('c'), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-C', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('c'), []);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('c'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('c'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = cm.newInstanceAsync(const Symbol('d'), []);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('null-B-C', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('d'), ['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-C', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('d'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('d'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - future = cm.newInstanceAsync(const Symbol('e'), ['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee.field);
|
| - });
|
| - future = cm.newInstanceAsync(const Symbol('e'), ['X']);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('e'), ['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.newInstanceAsync(const Symbol('e'), ['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -}
|
| -
|
| testSyncApply() {
|
| ClosureMirror cm;
|
| InstanceMirror result;
|
| @@ -469,125 +280,18 @@ testSyncApply() {
|
| 'Unmatched named argument');
|
| }
|
|
|
| -testAsyncApply() {
|
| - ClosureMirror cm;
|
| - Future<InstanceMirror> future;
|
| -
|
| - cm = reflect(a);
|
| - future = cm.applyAsync(['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-null', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X'], {const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-null', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X'], {const Symbol('c') : 'Z', const Symbol('b') : 'Y'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = cm.applyAsync([]);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.applyAsync(['X', 'Y']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.applyAsync(['X'], {const Symbol('undef') : 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - cm = reflect(b);
|
| - future = cm.applyAsync([]);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('A-null-null', result.reflectee);
|
| - });
|
| - future = cm.applyAsync([], {const Symbol('a') : 'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-null', result.reflectee);
|
| - });
|
| - future = cm.applyAsync([], {const Symbol('b') :'Y', const Symbol('c') :'Z', const Symbol('a') :'X'});
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - cm = reflect(c);
|
| - future = cm.applyAsync(['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-null-C', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = cm.applyAsync([]);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - cm = reflect(d);
|
| - future = cm.applyAsync([]);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('null-B-C', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-B-C', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X', 'Y']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-C', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -
|
| -
|
| - cm = reflect(e);
|
| - future = cm.applyAsync(['X', 'Y', 'Z']);
|
| - expectValueThen(future, (result) {
|
| - Expect.equals('X-Y-Z', result.reflectee);
|
| - });
|
| - future = cm.applyAsync(['X']);
|
| - expectError(future, isNoSuchMethodError, 'Insufficient positional arguments');
|
| - future = cm.applyAsync(['X', 'Y', 'Z', 'W']);
|
| - expectError(future, isNoSuchMethodError, 'Extra positional arguments');
|
| - future = cm.applyAsync(['X'], {const Symbol('undef'): 'Y'});
|
| - expectError(future, isNoSuchMethodError, 'Unmatched named argument');
|
| -}
|
| -
|
| main() {
|
| isDart2js = true; /// 01: ok
|
|
|
| testSyncInvoke(reflect(new C())); // InstanceMirror
|
| - if (!isDart2js) testSyncInvoke(reflectClass(D)); // ClassMirror
|
| - LibraryMirror lib = reflectClass(D).owner;
|
| - if (!isDart2js) testSyncInvoke(lib); // LibraryMirror
|
| -
|
| - testAsyncInvoke(reflect(new C())); // InstanceMirror
|
| -
|
| +
|
| if (isDart2js) return;
|
|
|
| - testAsyncInvoke(reflectClass(D)); // ClassMirror
|
| - testAsyncInvoke(lib); // LibraryMirror
|
| + testSyncInvoke(reflectClass(D)); // ClassMirror
|
| + LibraryMirror lib = reflectClass(D).owner;
|
| + testSyncInvoke(lib); // LibraryMirror
|
|
|
| testSyncNewInstance();
|
| - testAsyncNewInstance();
|
|
|
| testSyncApply();
|
| - testAsyncApply();
|
| }
|
|
|